Author: mcbrown
Date: 2006-09-04 18:13:18 +0200 (Mon, 04 Sep 2006)
New Revision: 3214
Log:
Adding a new script that adds a special code to the end of listings (for use with FrameMaker)
Added:
trunk/tools/formatlistingsCRLF.pl
Property changes on: trunk/tools/formatlistingsCRLF.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/tools/formatlistingsCRLF.pl
===================================================================
--- trunk/tools/formatlistingsCRLF.pl (rev 0)
+++ trunk/tools/formatlistingsCRLF.pl 2006-09-04 16:13:18 UTC (rev 3214)
Changed blocks: 1, Lines Added: 41, Lines Deleted: 0; 1362 bytes
@@ -0,0 +1,41 @@
+#!/usr/bin/perl -w
+
+# formatlistingsCRLF.pl - reformats the line endings in <programlisting>
+# to include the special character sequence !!CRLF!!; used for converting
+# our DocBook XML into a format that can be used within FrameMaker, which
+# otherwise ignores line endings
+#
+# Martin MC Brown
+# mc@stripped
+# 2006-09-03
+
+use utf8;
+use IO::File;
+use Encode;
+use strict;
+
+my $src = shift or die "You must specify the input file!\n";
+my $dst = shift or die "You must specify the output file!\n";
+
+my $source = IO::File->new($src,'r');
+binmode($source,':utf8');
+my $dest = IO::File->new($dst,'w');
+binmode($dest,':utf8)');
+
+my $inpl = 0;
+
+while(my $line = <$source>)
+{
+ chomp $line;
+ $inpl = 1 if ($line =~ m/<programlisting/);
+ $inpl = 0 if ($line =~ m{</programlisting>});
+
+ if ($inpl)
+ {
+ print $dest Encode::encode("utf8","$line!!CRLF!!\r\n");
+ }
+ else
+ {
+ print $dest Encode::encode("utf8","$line\n");
+ }
+}
Property changes on: trunk/tools/formatlistingsCRLF.pl
___________________________________________________________________
Name: svn:executable
+ *
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r3214 - trunk/tools | mcbrown | 4 Sep |