Compare Revisions Add-On<-- One line description, required for extensions repository catalog.
On this page:
DescriptionThe CompareRevisionsAddOn compares two revisions of a document, like rdiff does. But in contrast to normal rdiff, the comparison is done with the rendered HTML output of the revisions instead of the Foswiki source text files. (This feature was proposed by many of our users, who found the normal rdiff output too technical - even with the sidebyside option - and wanted to see differences in the content of the page). Furthermore, the differences between the revisions are shown as close as possible. If necessary, this means that different words are marked instead of whole lines or even paragraphs. The differences may be shown in two formats, either side-by-side or as an interwoven output of the old and new revision (like it is done in Word or OpenOffice):
UsageCallhttp://sigproc.eng.cam.ac.uk/spars2015pub/bin/compare/Web/Topic?parameters from your browser
Parametersrev1=rev and rev2=rev Revision numbers of the two revisions which should be compared. Defaults to the last two revisions. (More exact: rev2 defaults to the latest edition, rev1 defaults to rev2 - 1) render=interweave or render=sidebyside Chooses the output format. May also be given in the preference variable COMPARERENDERSTYLE context=n The number n of unchanged sections which should be shown around changed sections. A section means a top-level section like a paragraph, table, etc. If n=-1 (the default), all unchanged sections are shown. May also be given in the preference variable COMPARECONTEXT skin=someskin Chooses someskin for the output. See section Templates below TemplatesThe output of the script is rendered by templates. Two templates are needed,comparesidebyside.tmpl (or comparesidebyside.skin.tmpl ) for the
side-by-side format, and compareinterweave.tmpl (or
compareinterweave.skin.tmpl ) for the interwoven format. The default
templates use a common compare.tmpl (or complare.skin.tmpl ) for things
used by both.
The templates themselves are broken into 7 parts:
template for start of page %REPEAT% template for unchanged section which is not printed according to context %REPEAT% template for unchanged section which is printed %REPEAT% template for changed section %REPEAT% template for added section %REPEAT% template for deleted section %REPEAT% template for end of pageAll empty templates for a section default to their predecessor. (E.g. if you do not specify a template for a deleted section, it defaults to the template for an added section, which in turn may default to the template for a changed section). In the templates for a section, %TEXT1% is replaced by the text of the old revision
and %TEXT2% is replaced by the text of the new revision.
In interwoven output, only %TEXT1% is used.
Examples for templates can be found in the default template files from
the distribution (compare.tmpl , comparesidebyside.tmpl , compareinterweave.tmpl ).
CSS StylesThe differences in the two revisions are marked with the help of CSS style classes, whose appearance should be defined in the templates. The following classes are used:craCompareAdd Class for added items (i.e. items which are in the newer revision, but not yet in the older one) craCompareDelete Class for deleted items (i.e. items which are in the older revision, but no more in the newer one) craCompareChange1 Class for the items from the older revision which have been changed. craCompareChange2 Class for the items from the newer revision which have been changed. In the default templates files from the distribution, the classes craCompareAdd and craCompareChange1 are defined with
a light red background and stroken out text, and craCompareDelete
and craCompareChange2 are defined with a light green background.
Add-On Installation InstructionsThis Add-On comes pre-installed on Foswiki. You should only need to re-install if there is an upgrade to the Add-On. You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server. Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install". If you have any problems, or if the extension isn't available inconfigure , then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.
Add-On Info
|