DiffDelay

Summary: In page histories, display vertical spacing proportional to the time between the edits.
Version: 2022-01-03
Prerequisites: PmWiki 2.3.0
Status: Preview
Maintainer: Petko
License: Public domain
Categories: Layout, Editing, Security, PHP81
Users: (view? / edit)
Discussion: DiffDelay-Talk?

When reviewing page histories, is there a way to easily distinguish between different batches/sessions of grouped edits?

Description

In page histories, display vertical spacing proportional to the time between the edits.

PmWiki 2.3.0 adds a dataset attribute with the compact delay between the edits, and 3 new classnames to the "diffbox" element:

  • "diffyear": more than a year without edits
  • "diffmonth": more than a month without edits
  • "diffweek": more than a week without edits
  • "diffday": more than 24 hours without edits

We can add styles to pub/css/local.css (or to Cookbook:LocalCSS) that will increase the top margins for these classnames, and to show a message like "More than a month without edits: ~3m".

The recipe is enabled on pmwiki.org, try the "History" link on any page, e.g. PmWiki.Passwords?action=diff.

Installation

Edit your file pub/css/local.css (if it doesn't exist, create it) and add these styles in it:

/* Cookbook:DiffDelay: vertical space relative
   to delay between edits in ?action=diff */
.diffbox:before {
  color: #888;
  margin-left: 0.4em;
  display:block;
}
/* more than 1 year */
.diffbox.diffyear:before {
  content: "More than a year without edits: ~" attr(data-delay);
  padding-top: 170px;
}
/* more than 1 month */
.diffbox.diffmonth:before {
  content: "More than a month without edits: ~" attr(data-delay);
  padding-top: 110px;
}
/* more than 1 week */
.diffbox.diffweek:before {
  content: "More than a week without edits: ~" attr(data-delay);
  padding-top: 70px;
}
/* more than 1 day */
.diffbox.diffday:before {
  content: "More than 24 hours without edits: ~" attr(data-delay);
  padding-top: 30px;
}

Configuration

In the above code you can change the margins (40px, 80px, 120px) to different values.

Internationalization

On an international wiki, you may want to translate the quoted texts on the content: lines above.

Usage

Just open any page history, e.g. PmWiki.Functions?action=diff.

Notes

To do / some day / maybe

  • Should we add a classname diffyear for more than 1 year between edits?
  • It would be very useful to be able to show a single/common diff for the grouped edits, like Cookbook:ViewDiff.

Change log / Release notes

  • 2022-01-03: Update suggested CSS.
  • 2022-01-02: first public release, enabled on PmWiki.org.

See also

Contributors

Written and maintained by Petko

Comments

See discussion at DiffDelay-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.