Author: mcbrown
Date: 2007-09-24 11:47:57 +0200 (Mon, 24 Sep 2007)
New Revision: 7897
Log:
Fixing some issues in the docbook division script
Modified:
trunk/tools/divide-docbook-file.pl
Modified: trunk/tools/divide-docbook-file.pl
===================================================================
--- trunk/tools/divide-docbook-file.pl 2007-09-23 21:28:20 UTC (rev 7896)
+++ trunk/tools/divide-docbook-file.pl 2007-09-24 09:47:57 UTC (rev 7897)
Changed blocks: 2, Lines Added: 10, Lines Deleted: 12; 1337 bytes
@@ -43,18 +43,11 @@
# Determine the current document type info so we can copy it to the new file
my $doctype = undef;
-
-foreach my $child ($doc->getChildNodes())
+my $fh = IO::File->new($file);
+while(<$fh>)
{
- if ($child->getNodeType == DOCUMENT_TYPE_NODE)
- {
-# Remap it to a section
- my $currtype = $child->getName;
- $child->setName('section');
- $doctype = $child->toString;
- $child->setName($currtype);
- last;
- }
+ last if ($_ =~ m/<(section|chapter)/);
+ $doctype .= $_;
}
# Get the list of sections in this document
@@ -101,8 +94,13 @@
print STDERR "\nWARNING: Couldn't find IDs: ",join(', ',keys %{$idfoundlist}),"\n\n";
}
-$doc->printToFile("$file.new");
+my $finalfh = IO::File->new("$file.new",'w');
+binmode($finalfh,':utf8');
+print $finalfh $doc->toString;
+$finalfh->close();
+
$doc->dispose;
rename($file,"$file.old");
rename("$file.new","$file");
print STDERR "Renamed $file to $file.old\nNew file is in $file\n";
+print STDERR "Please make sure to fix $file and add the \n%all.entities;\n line to the
DOCTYPE header\n";
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r7897 - trunk/tools | mcbrown | 24 Sep |