Questions answered by this recipe
- How can I automatically add an accurate indication of the size of an edit to its summary?
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");
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.
- 2010-06-17Δ - removed dependency on Cookbook.InlineDiff + added automatic "(deleted)" to csum
- 2009-06-09Δ - first release
- Cookbook.DeltaBytesRecentChanges Display the number of bytes (characters) added or deleted to a page in RecentChanges.