Website: Improve reading experience of the manual

The manual now used better the org.css file.  It also reacts to single
key presses like "n" and "p", and has a top-level table of contents
that is always active and visible.
This commit is contained in:
Carsten Dominik 2008-11-27 12:00:21 +01:00
parent 9aa72230a2
commit ab310f9405
4 changed files with 104 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2009-01-19 Carsten Dominik <carsten.dominik@gmail.com>
* Makefile (html_manual): Process the split html manual with the
new script.
* UTILITIES/mansplit.pl: New file.
2009-01-06 Carsten Dominik <carsten.dominik@gmail.com>

View File

@ -163,6 +163,7 @@ doc/org.pdf: doc/org.texi
doc/org.html: doc/org.texi
(cd doc; $(TEXI2HTML) --no-split -o org.html org.texi)
UTILITIES/manfull.pl doc/org.html
doc/orgcard.dvi: doc/orgcard.tex
(cd doc; tex orgcard.tex)
@ -194,6 +195,7 @@ html_manual: doc/org.texi
rm -rf doc/manual
mkdir doc/manual
$(TEXI2HTML) -o doc/manual doc/org.texi
UTILITIES/mansplit.pl doc/manual/*.html
info: doc/org

28
UTILITIES/manfull.pl Executable file
View File

@ -0,0 +1,28 @@
#!/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 '</style><link rel="stylesheet" href="http://orgmode.org/org.css" type="text/css" />';
} elsif (/<div class="contents">/) {
print OUT;
print OUT '<div id="table-of-contents">';
} elsif (/<h2>Table of Contents<\/h2>/) {
print OUT;
print OUT '<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";
}

68
UTILITIES/mansplit.pl Executable file
View File

@ -0,0 +1,68 @@
#!/usr/bin/perl
# Work on the files that are created by makeinfo for html output
# split into many small files.
# This will walk though the files listed on the command line, install
# Sebastian Rose's key reader and add a small top-level-only table
# of contents that will be placed into a special region and visible
# in all subfiles. The small contents is a constant and has to be updated
# by hand, currently.
$contents = <<EOF;
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a name="toc_Top" href="index.html#Top">Org Mode Manual</a>
<li><a name="toc_Introduction" href="Introduction.html#Introduction">1 Introduction</a>
<li><a name="toc_Document-Structure" href="Document-Structure.html#Document-Structure">2 Document Structure</a>
<li><a name="toc_Tables" href="Tables.html#Tables">3 Tables</a>
<li><a name="toc_Hyperlinks" href="Hyperlinks.html#Hyperlinks">4 Hyperlinks</a>
<li><a name="toc_TODO-Items" href="TODO-Items.html#TODO-Items">5 TODO Items</a>
<li><a name="toc_Tags" href="Tags.html#Tags">6 Tags</a>
<li><a name="toc_Properties-and-Columns" href="Properties-and-Columns.html#Properties-and-Columns">7 Properties and Columns</a>
<li><a name="toc_Dates-and-Times" href="Dates-and-Times.html#Dates-and-Times">8 Dates and Times</a>
<li><a name="toc_Capture" href="Capture.html#Capture">9 Capture</a>
<li><a name="toc_Agenda-Views" href="Agenda-Views.html#Agenda-Views">10 Agenda Views</a>
<li><a name="toc_Embedded-LaTeX" href="Embedded-LaTeX.html#Embedded-LaTeX">11 Embedded LaTeX</a>
<li><a name="toc_Exporting" href="Exporting.html#Exporting">12 Exporting</a>
<li><a name="toc_Publishing" href="Publishing.html#Publishing">13 Publishing</a>
<li><a name="toc_Miscellaneous" href="Miscellaneous.html#Miscellaneous">14 Miscellaneous</a>
<li><a name="toc_Extensions" href="Extensions.html#Extensions">A Extensions</a>
<li><a name="toc_Hacking" href="Hacking.html#Hacking">B Hacking</a>
<li><a name="toc_History-and-Acknowledgments" href="History-and-Acknowledgments.html#History-and-Acknowledgments">C History and Acknowledgments</a>
<li><a name="toc_Main-Index" href="Main-Index.html#Main-Index">Main Index</a>
<li><a name="toc_Key-Index" href="Key-Index.html#Key-Index">Key Index</a>
</li></ul>
</div>
</div>
</div>
EOF
$script = <<'EOF';
</style><link rel="stylesheet" href="http://orgmode.org/org.css" type="text/css" />
<script type="text/javascript" src="http://orgmode.org/org-keys.js"></script>
<script language="javascript" type="text/javascript">
<!--/*--><![CDATA[/*><!--*/
OrgKeyReader.registerHref('h', 'index.html');
OrgKeyReader.registerHref('t', 'index.html');
/*]]>*/-->
</script>
EOF
while ($page = shift) {
system "mv $page $page.orig";
open IN,"<$page.orig" or die "Cannot read from $page.orig\n";
undef $/;
$all = <IN>;
close IN;
$all =~ s/<meta http-equiv="Content-Style-Type" content="text\/css">/$&\n$script/;
$all =~ s/^<body>/<body onload="OrgKeyReader.init();">\n$contents/m;
open OUT,">$page" or die "Cannot write to $page\n";
print OUT $all;
close OUT;
system "rm $page.orig";
}