Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode
[org-mode/org-tableheadings.git] / UTILITIES / manfull.pl
blob60f126dfc37118c1fda06416d2a1b0594581821f
1 #!/usr/bin/perl
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";
9 while (<IN>) {
10 if (/<meta http-equiv="Content-Style-Type" content="text\/css">/) {
11 print OUT;
12 print OUT '</style><link rel="stylesheet" href="http://orgmode.org/org.css" type="text/css" />';
13 } elsif (/<div class="contents">/) {
14 print OUT;
15 print OUT '<div id="table-of-contents">';
16 } elsif (/<h2>Table of Contents<\/h2>/) {
17 print OUT;
18 print OUT '<div id="text-table-of-contents">';
19 $toc = 1;
20 } elsif (/<\/div>/ and $toc) {
21 print OUT "</div></div></div>";
22 $toc = 0;
23 } else {
24 print OUT;
27 system "rm $page.orig";