aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2017-04-14 01:50:13 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2017-04-14 01:50:13 -0700
commit22fe5b07601749f85a5250b0f537b71cea46d50f (patch)
tree8f7f66b69069ccefb6a4fafd73e6bd57cbace753 /doc
parent322401fcbc9d67f22e28a146fcf7917012d8d68d (diff)
downloadnasm-daily-22fe5b07601749f85a5250b0f537b71cea46d50f.tar.gz
nasm-daily-22fe5b07601749f85a5250b0f537b71cea46d50f.tar.xz
nasm-daily-22fe5b07601749f85a5250b0f537b71cea46d50f.zip
doc: generate proper XHTML for the contents and index
The table of contents and index needed rework to be valid (X)HTML. The TOC in particular needed some fairly significant rework - it is supposed to be an ordered list, after all. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/Makefile.in8
-rw-r--r--doc/nasmdoc.css21
-rw-r--r--doc/rdsrc.pl68
3 files changed, 69 insertions, 28 deletions
diff --git a/doc/Makefile.in b/doc/Makefile.in
index cc6969ec..ac091e99 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -25,8 +25,7 @@ RM_F = rm -f
RM_RF = rm -rf
CP_F = cp -f
-SRCS = nasmdoc.src inslist.src changes.src version.src \
- nasmdoc.css nasmlogw.png
+SRCS = nasmdoc.src inslist.src changes.src version.src
OUT = html nasmdoc.txt nasmdoc.pdf
.SUFFIXES: .pfa .ph
@@ -37,11 +36,14 @@ inslist.src: inslist.pl ../x86/insns.dat
$(PERL) $(srcdir)/inslist.pl $(srcdir)/../x86/insns.dat
.PHONY: html
-html: html/nasmdoc0.html html/nasmdoc.css html/nasmlogw.png
+html: $(SRCS) rdsrc.pl nasmdoc.css nasmlogw.png
+ mkdir -p html
+ $(MAKE) html/nasmdoc0.html html/nasmdoc.css html/nasmlogw.png
RDSRC = $(PERL) $(srcdir)/rdsrc.pl -I$(srcdir)/
html/nasmdoc0.html: $(SRCS) rdsrc.pl
+ $(RM_F) html/*.html
$(RDSRC) -ohtml html nasmdoc.src
html/nasmdoc.css: nasmdoc.css
diff --git a/doc/nasmdoc.css b/doc/nasmdoc.css
index 21f08d53..8c8e378f 100644
--- a/doc/nasmdoc.css
+++ b/doc/nasmdoc.css
@@ -20,6 +20,27 @@ code {
a {
text-decoration: none;
}
+div.toc {
+ padding-left: 0;
+ font-size: 195%;
+}
+div.toc li {
+ list-style-type: none;
+ padding-left: 0;
+}
+div.toc ol {
+ padding-left: 2em;
+ font-size: 80%;
+}
+li.toc1 {
+ padding-top: 0.7em;
+}
+li.toc2 {
+ padding-top: 0.3em;
+}
+ul.index {
+ list-style-type: none;
+}
@media not screen {
ul.navbar {
display: none;
diff --git a/doc/rdsrc.pl b/doc/rdsrc.pl
index afe93d68..719e9b2d 100644
--- a/doc/rdsrc.pl
+++ b/doc/rdsrc.pl
@@ -745,31 +745,48 @@ sub write_html {
select TEXT;
&html_preamble(0);
print "<p>This manual documents NASM, the Netwide Assembler: an assembler\n";
- print "targetting the Intel x86 series of processors, with portable source.\n";
- print "<p>";
+ print "targetting the Intel x86 series of processors, with portable source.\n</p>";
+ print "<div class=\"toc\">\n";
+ $level = 0;
for ($node = $tstruct_next{'Top'}; $node; $node = $tstruct_next{$node}) {
- if ($tstruct_level{$node} == 1) {
+ my $lastlevel = $level;
+ while ($tstruct_level{$node} < $level) {
+ print "</li>\n</ol>\n";
+ $level--;
+ }
+ while ($tstruct_level{$node} > $level) {
+ print "<ol class=\"toc", ++$level, "\">\n";
+ }
+ if ($lastlevel >= $level) {
+ print "</li>\n";
+ }
+ $level = $tstruct_level{$node};
+ if ($level == 1) {
# Invent a file name.
- ($number = lc($xrefnodes{$node})) =~ s/.*-//;
- $fname="nasmdocx.html";
- substr($fname,8 - length $number, length $number) = $number;
- $html_fnames{$node} = $fname;
- $link = $fname;
- print "<p>";
- } else {
- # Use the preceding filename plus a marker point.
- $link = $fname . "#$xrefnodes{$node}";
- }
- $title = "$node: ";
- $pname = $tstruct_pname{$node};
- foreach $i (@$pname) {
- $ww = &word_html($i);
- $title .= $ww unless $ww eq "\001";
- }
- print "<a href=\"$link\">$title</a><br>\n";
+ ($number = lc($xrefnodes{$node})) =~ s/.*-//;
+ $fname="nasmdocx.html";
+ substr($fname,8 - length $number, length $number) = $number;
+ $html_fnames{$node} = $fname;
+ $link = $fname;
+ } else {
+ # Use the preceding filename plus a marker point.
+ $link = $fname . "#$xrefnodes{$node}";
+ }
+ $title = '';
+ $pname = $tstruct_pname{$node};
+ foreach $i (@$pname) {
+ $ww = &word_html($i);
+ $title .= $ww unless $ww eq "\001";
+ }
+ print "<li class=\"toc${level}\">\n";
+ print "<span class=\"node\">$node: </span><a href=\"$link\">$title</a>\n";
}
- print "<p><a href=\"nasmdoci.html\">Index</a>\n";
- print "</body></html>\n";
+ while ($level--) {
+ print "</li>\n</ol>\n";
+ }
+ print "</div>\n";
+ print "</body>\n";
+ print "</html>\n";
select STDOUT;
close TEXT;
@@ -915,7 +932,7 @@ sub write_html {
open TEXT, '>', File::Spec->catfile($out_path, 'nasmdoci.html');
select TEXT;
&html_preamble(0);
- print "<h2 class=\"index\"><a href=\"nasmdoc0.html\">Index</a></h1>\n";
+ print "<h2 class=\"index\">Index</h2>\n";
print "<ul class=\"index\">\n";
&html_index;
print "</ul>\n</body>\n</html>\n";
@@ -961,6 +978,7 @@ sub html_index {
push @a, "sp", "x $xrefnodes{$node}", "n $node", "xe$xrefnodes{$node}";
$sep = 1;
}
+ print "<li class=\"index\">\n";
$line = '';
do {
do { $w = &word_html(shift @a) } while $w eq "\001"; # nasty hack
@@ -979,9 +997,9 @@ sub html_index {
} while ($w ne '' && $w ne undef);
if ($line =~ /\S/) {
$line =~ s/\s*$//; # trim trailing spaces
- print "$line\n";
+ print $line, "\n";
}
- print "<br>\n";
+ print "</li>\n";
}
}