NAME

CGI::Wiki::Plugin::Diff - format differences between two CGI::Wiki pages

SYNOPSIS

  use CGI::Wiki::Plugin::Diff;
  my $plugin = CGI::Wiki::Plugin::Diff->new;
  $wiki->register_plugin( plugin => $plugin );   # called before any node reads
  my %diff = $plugin->differences( node => 'Imperial College',
                                left_version => 3,
                                right_version => 5);

DESCRIPTION

A plug-in for CGI::Wiki sites, which provides a nice extract of differences between two versions of a node.

METHODS

differences
  my %diff_vars = $plugin->differences(
      node          => "Home Page",
      left_version  => 3,
      right_version => 5
  );

Returns a hash with the key-value pairs:

  • left_version - The node version whose content we're considering canonical.

    right_version - The node version that we're showing the differences from.

    content - The (formatted) contents of the Left version of the node.

    meta_include - Filter the list of metadata fields to only include a certain list in the diff output. The default is to include all metadata fields.

    meta_exclude - Filter the list of metadata fields to exclude certain fields from the diff output. The default is the following list, to match previous version (OpenGuides) behaviour: username comment __categories__checksum __locales__checksum

    Agreed this list is hopelessly inadequate, especially for OpenGuides. Hopefully, future wiki designers will use the meta_include parameter to specify exactly what metadata they want to appear on the diff.

    diff - An array of hashrefs of hunks of differences between the versions. It is assumed that the display will be rendered in HTML, and SPAN tags are inserted with a class of diff1 or diff2, to highlight which individual words have actually changed. Display the contents of diff using a <table>, with each member of the array corresponding to a row <TR>, and keys {left} and {right} being two columns <TD>.

    Usually you will want to feed this through a templating system, such as Template Toolkit, which makes iterating the AoH very easy.

TODO

Write more tests for this module!

Make this module more generic, allow selection of formatting options. Add the ability to select which metadata fields are diffed.

Improve the OO'ness by making the module subclassable, substituting different methods for _serialise_metadata and _content_escape.

I am also looking to take the intradiff functionality out of this module and into its own freestanding module where it belongs.

BUGS AND ENHANCEMENTS

Please use rt.cpan.org to report any bugs in this module. If you have any ideas for how this module could be enhanced, please email the author, or post to the CGI::Wiki list (CGI (hyphen) wiki (hyphen) dev (at) earth (dot) li).

AUTHOR

I. P. Williams (IVORW [at] CPAN {dot} org)

COPYRIGHT

     Copyright (C) 2003 I. P. Williams (IVORW [at] CPAN {dot} org).
     All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

VCS::Lite, CGI::Wiki, CGI::Wiki::Plugin

1 POD Error

The following errors were encountered while parsing the POD:

Around line 201:

You forgot a '=back' before '=head1'