4 while ($page = shift) {
5 system "mv $page $page.orig";
6 open IN
,"<$page.orig" or die "Cannot read from $page.orig\n";
7 open OUT
,">$page" or die "Cannot write to $page\n";
10 if (/<meta http-equiv="Content-Style-Type" content="text\/css">/) {
12 print OUT '<link rel="stylesheet
" href="http
://orgmode
.org
/org-manual.css" type="text/css" />';
13 } elsif (/<div class="contents
">/) {
15 print OUT '<p>This is the official manual for the latest <a href="http
://orgmode
.org
">Org-mode</a> release.</p><div id="table
-of
-contents
">';
16 } elsif (/<h2>Table of Contents<\/h2>/) {
18 print OUT '<a href="http
://orgmode
.org
">http://orgmode.org</a><br/><div id="text
-table
-of
-contents
">';
20 } elsif (/<\/div>/ and $toc) {
21 print OUT "</div></div
></div
>";
27 system "rm
$page.orig
";