Hi,
This is probably something specific to me but you never now it might be
useful to somebody else.  I want to take the XML output of cvs2cl and
transform it to HTML using XSLT - I want to do it like this rather than
use some other tool and go straight to HTML because this is for the
ChangeLog of the perl module XML::XSLT that I am currently maintaining ;-}
Anyhow, I would like to have separate items in the message as a list -
where I (and quite a few other developers it would seem) introduce each
new item with an asterisk at the beginning of the line.  I have introduced
a new element into the XML - <item /> - where the appropriate switch is
applied.
Here is the patch :
--- cvs2cl.pl~	Mon Feb 18 18:32:54 2002
+++ cvs2cl.pl	Mon Feb 18 19:07:20 2002
@@ -1,5 +1,6 @@
 #!/bin/sh
-exec perl -w -x $0 ${1+"$@"} # -*- mode: perl; perl-indent-level: 2; -*-
+exec perl -w -x $0 ${1+"$@"}
+# -*- mode: perl; perl-indent-level: 2; -*-
 #!perl -w
 ##############################################################
@@ -122,6 +123,9 @@
 # Format more for programs than for humans.
 my $XML_Output = 0;
+# Split message into separate <item> elements for $XML_Output
+my $Split_XML_Message = 0;
+
 # Do some special tweaks for log data that was written in FSF
 # ChangeLog style.
 my $FSF_Style = 0;
@@ -1225,6 +1229,22 @@
   if ($XML_Output)
   {
     $text = &xml_escape ($text);
+
+    if ( $Split_XML_Message ) {
+
+      my @items = $text =~ /\s*\*\s*([^*]+)\s*/sg;
+
+      if ( @items ) {
+         $text = '';
+         foreach my $item (@items ) {
+            $text .= "<item>$item</item>\n";
+         }
+      }
+      else {
+        $text = "<item>${text}</item>\n";
+      }
+    }
+
     $text = "<msg>${text}</msg>\n";
   }
   elsif (! $No_Wrap)
@@ -1600,6 +1620,9 @@
     elsif ($arg =~ /^--xml$/) {
       $XML_Output = 1;
     }
+    elsif ( $arg =~ /^(-s|--split-message)$/ ) {
+      $Split_XML_Message = 1;
+    }
     elsif ($arg =~ /^--hide-filenames$/) {
       $Hide_Filenames = 1;
       $After_Header = "";
@@ -1748,6 +1771,7 @@
   -w, --day-of-week            Show day of week
   --header FILE                Get ChangeLog header from FILE ("-" means stdin)
   --xml                        Output XML instead of ChangeLog format
+  -s, --split-message          Split message on '*' if --xml enabled.
   --hide-filenames             Don't show filenames (ignored for XML output)
   -P, --prune                  Don't show empty log messages
   -g OPTS, --global-opts OPTS  Invoke like this "cvs OPTS log ..."
Anyhow thanks for the extremely useful program :)
/J\
-- Jonathan Stowe | <http://www.gellyfish.com> | This space for rent |Received on Thu May 23 08:33:42 2002
This archive was generated by hypermail 2.1.8 : Wed Jan 21 2004 - 16:25:34 GMT