Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

PageDiffSize

Summary:Add an accurate count of characters added & removed to each edit summary
Version:2009-06-09
Prerequisites:PmWiki 2.2.x, optionally InlineDiff
Status:beta
Maintainer:Eemeli Aro
Categories: Administration, Editing

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 Text_Diff package included by the cookbook recipe InlineDiff. If InlineDiff isn't present, PageDiffSize defaults to a simpler change counter that will overcount if multiple changes are made to a single paragrph.

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

Comments

User notes?: If you use, used or reviewed this recipe, you can add your name. The following format is recognized:
* (+) Optional positive comment. Name, date
* (-) Optional negative comment. Name, date

These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on June 09, 2009, at 05:42 AM