#!/usr/bin/perl # $Id: dtddiff2html,v 2.2 2005/07/16 03:22:57 ehood Exp $ # Author(s): Earl Hood, # POD at end of file. use Getopt::Long; use SGML::DTDParse; MAIN: { my %opts = (); GetOptions(\%opts, @SGML::DTDParse::CommonOptions ) || SGML::DTDParse::usage(-verbose => 0, -exitval => 1); SGML::DTDParse::process_common_options(\%opts); print < Diff
EOT

  my $in_chng = 0;
  while (<>) {
    chomp;
    if (/^[!]/) {
      if (/::=/) {
        print '', entify($_), "\n";
        $in_chng = 1;
        next;
      } else {
        print '', entify($_), "\n";
        next;
      }
    }

    if (/^(---|[*+\-])/) {
      if ($in_chng) {
        print "";
        $in_chng = 0;
      }
      elsif ($1 eq '---' || $1 eq '*') {
        print '', entify($_), "\n";
      }
      elsif ($1 eq '+') {
        print '', entify($_), "\n";
      }
      elsif ($1 eq '-') {
        print '', entify($_), "\n";
      }
      next;
    }

    if ($in_chng && !/\S/) {
      print "";
      $in_chng = 0;
    }

    print entify($_), "\n";
  }

  print qq{
\n}; } ############################################################################## sub entify { my $txt = shift; $txt =~ s/&/&/g; $txt =~ s//>/g; $txt; } ############################################################################## __END__ =head1 NAME dtddiff2html - Convert DTD difference to HTML. =head1 SYNOPSIS dtddiff parsed-dtd1.xml parsed-dtd2.xml > dtd-diff.txt dtddiff2html dtd-diff.txt > dtd-diff.html dtddiff parsed-dtd1.xml parsed-dtd2.xml | dtddiff2html > dtd-diff.html =head1 DESCRIPTION B converts the diff-style output of B into HTML. The HTML created basically provides color-highlighting of the diff output. =head1 OPTIONS =over 4 =item --version Print version and synopsis. =item --help Print synopsis and options available. =item --man Print manual page. =back =head1 SEE ALSO L See L for an overview of the DTDParse package. =head1 PREREQUISITES B =head1 AVAILABILITY EIE =head1 AUTHORS Earl Hood, =head1 COPYRIGHT AND LICENSE See L for copyright and license information.