PageDiffSize

Summary:Add an accurate count of characters added & removed to each edit summary
Version:2010-06-17
Prerequisites:PmWiki 2.2.x, preferably 2.2.12 or later
Status:beta
Maintainer: Petko (original author: Eemeli Aro)
Discussion: PageDiffSize-Talk?

Questions answered by this recipe

  • How can I automatically add an accurate indication of the size of an edit to its summary?

Description

PageDiffSize adds a count of the characters added and/or removed during a page edit to the edit's change summary that's displayed in the page's history as well as on RecentChanges pages. As an edit can contain both insertions and deletions of text as changes are made, the added count can contain two numbers, as in "+35/-15".

For the most accurate count, PageDiffSize can make use of the DiffRenderSource function included in scripts/pagerev.php since version 2.2.12. If that function isn't present, PageDiffSize defaults to a simpler change counter that will overcount if multiple changes are made to a single paragraph.

To install this recipe

  • Download pagediffsize.phpΔ to your cookbook directory
  • add the following line to your configuration file:
    if ($action=='edit') include_once("$FarmD/cookbook/pagediffsize.php");

Notes

You can customize the output of PageDiffSize by setting the value of $PageDiffSizeFmt; see the source code for the formatting.

This recipe was inspired in part by DeltaBytesRecentChanges, which does a very similar job but only compares the raw difference in length of the page text before and after an edit. The sum of PageDiffSize's counts should be equal to the difference reported by DeltaBytesRecentChanges.

Release Notes

See Also

Contributors

  • Petko is the maintainer of the recipe.
  • EemeliAro originally published the recipe.

Comments

See discussion at PageDiffSize-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.