forked from mirrors/org-mode
* mk/manfull.pl: During patching of single-page html manuals allow current form of table of contents headers. Older makeinfo did not add "contents-heading" class to "<h2>" element. Helper script failed to properly modify HTML files generated by current version of makeinfo. With partially patched file, CSS stiles intended for table of contents were applied to all unordered lists, so e.g. in "Plain Lists" section items were bold and with missed markers.
29 lines
942 B
Perl
Executable file
29 lines
942 B
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
|
|
while ($page = shift) {
|
|
system "mv $page $page.orig";
|
|
open IN,"<$page.orig" or die "Cannot read from $page.orig\n";
|
|
open OUT,">$page" or die "Cannot write to $page\n";
|
|
|
|
while (<IN>) {
|
|
if (/<meta http-equiv="Content-Style-Type" content="text\/css">/) {
|
|
print OUT;
|
|
print OUT '<link rel="stylesheet" href="https://orgmode.org/org-manual.css" type="text/css" />';
|
|
} elsif (/<div class="contents">/) {
|
|
print OUT;
|
|
print OUT '<p>This is the official manual for the latest <a href="https://orgmode.org">Org mode</a> release.</p><div id="table-of-contents">';
|
|
} elsif (/<h2>Table of Contents<\/h2>|<h2 class="contents-heading">/) {
|
|
print OUT;
|
|
print OUT '<a href="https://orgmode.org">https://orgmode.org</a><br/><div id="text-table-of-contents">';
|
|
$toc = 1;
|
|
} elsif (/<\/div>/ and $toc) {
|
|
print OUT "</div></div></div>";
|
|
$toc = 0;
|
|
} else {
|
|
print OUT;
|
|
}
|
|
}
|
|
system "rm $page.orig";
|
|
}
|