mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-07-24 10:25:42 -04:00
doc: fix HTML table of contents generation
Fix the HTML table of contents being completely broken. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
49bbfed017
commit
b67d42380c
@ -7,6 +7,13 @@
|
||||
The NASM 2 series supports x86-64, and is the production version of NASM
|
||||
since 2007.
|
||||
|
||||
\S{cl-2.16.01} Version 2.16.01
|
||||
|
||||
\e{This is a documentation update release only.}
|
||||
|
||||
\b Fix the creation of the table of contents in the HTML version of
|
||||
the documentation.
|
||||
|
||||
\S{cl-2.16} Version 2.16
|
||||
|
||||
\b Support for the \c{rdf} format has been discontinued and all the
|
||||
|
70
doc/rdsrc.pl
70
doc/rdsrc.pl
@ -268,7 +268,7 @@ sub include {
|
||||
sub got_para {
|
||||
local ($_) = @_;
|
||||
my $pflags = "", $i, $w, $l, $t;
|
||||
my @para = ();
|
||||
my $para = [];
|
||||
|
||||
return if !/\S/;
|
||||
|
||||
@ -294,7 +294,7 @@ sub got_para {
|
||||
$l =~ s/\\\{/\{/g;
|
||||
$l =~ s/\\\}/}/g;
|
||||
$l =~ s/\\\\/\\/g;
|
||||
push @para, $l;
|
||||
push @$para, $l;
|
||||
}
|
||||
$_ = ''; # suppress word-by-word code
|
||||
} elsif (/^\\C/) {
|
||||
@ -308,7 +308,7 @@ sub got_para {
|
||||
die "badly formatted chapter heading: $_\n" if !/^\\C\{([^\}]*)\}\s*(.*)$/;
|
||||
$refs{$1} = "chapter $cnum";
|
||||
$node = "Chapter $cnum";
|
||||
&add_item($node, 1);
|
||||
&add_item($node, 1, $para);
|
||||
$xrefnodes{$node} = $xref; $nodexrefs{$xref} = $node;
|
||||
$xrefs{$1} = $xref;
|
||||
$_ = $2;
|
||||
@ -325,7 +325,7 @@ sub got_para {
|
||||
die "badly formatted appendix heading: $_\n" if !/^\\A\{([^\}]*)}\s*(.*)$/;
|
||||
$refs{$1} = "appendix $cnum";
|
||||
$node = "Appendix $cnum";
|
||||
&add_item($node, 1);
|
||||
&add_item($node, 1, $para);
|
||||
$xrefnodes{$node} = $xref; $nodexrefs{$xref} = $node;
|
||||
$xrefs{$1} = $xref;
|
||||
$_ = $2;
|
||||
@ -339,7 +339,7 @@ sub got_para {
|
||||
die "badly formatted heading: $_\n" if !/^\\[HP]\{([^\}]*)\}\s*(.*)$/;
|
||||
$refs{$1} = "section $cnum.$hnum";
|
||||
$node = "Section $cnum.$hnum";
|
||||
&add_item($node, 2);
|
||||
&add_item($node, 2, $para);
|
||||
$xrefnodes{$node} = $xref; $nodexrefs{$xref} = $node;
|
||||
$xrefs{$1} = $xref;
|
||||
$_ = $2;
|
||||
@ -352,7 +352,7 @@ sub got_para {
|
||||
die "badly formatted subheading: $_\n" if !/^\\S\{([^\}]*)\}\s*(.*)$/;
|
||||
$refs{$1} = "section $cnum.$hnum.$snum";
|
||||
$node = "Section $cnum.$hnum.$snum";
|
||||
&add_item($node, 3);
|
||||
&add_item($node, 3, $para);
|
||||
$xrefnodes{$node} = $xref; $nodexrefs{$xref} = $node;
|
||||
$xrefs{$1} = $xref;
|
||||
$_ = $2;
|
||||
@ -389,11 +389,11 @@ sub got_para {
|
||||
$pflags = "norm";
|
||||
}
|
||||
|
||||
# The word-by-word code: unless @para is already defined (which it
|
||||
# The word-by-word code: unless @$para is already defined (which it
|
||||
# will be in the case of a code paragraph), split the paragraph up
|
||||
# into words and push each on @para.
|
||||
# into words and push each on @$para.
|
||||
#
|
||||
# Each thing pushed on @para should have a two-character type
|
||||
# Each thing pushed on @$para should have a two-character type
|
||||
# code followed by the text.
|
||||
#
|
||||
# Type codes are:
|
||||
@ -416,7 +416,7 @@ sub got_para {
|
||||
# index-items arrays
|
||||
# "sp" for space
|
||||
while (/\S/) {
|
||||
s/^\s*//, push @para, "sp" if /^\s/;
|
||||
s/^\s*//, push @$para, "sp" if /^\s/;
|
||||
$indexing = $qindex = 0;
|
||||
if (/^(\\[iI])?\\c/) {
|
||||
$qindex = 1 if $1 eq "\\I";
|
||||
@ -429,8 +429,8 @@ sub got_para {
|
||||
$w =~ s/\\\}/\}/g;
|
||||
$w =~ s/\\-/-/g;
|
||||
$w =~ s/\\\\/\\/g;
|
||||
push(@para, addidx($node, $w, "c $w")) if ($indexing);
|
||||
push(@para, "c $w") if (!$qindex);
|
||||
push(@$para, addidx($node, $w, "c $w")) if ($indexing);
|
||||
push(@$para, "c $w") if (!$qindex);
|
||||
} elsif (/^\\[iIe]/) {
|
||||
/^(\\[iI])?(\\e)?/;
|
||||
$emph = 0;
|
||||
@ -456,7 +456,7 @@ sub got_para {
|
||||
if ($indexing) {
|
||||
$w =~ tr/A-Z/a-z/;
|
||||
pop @ientry; # remove final space
|
||||
push(@para, addidx($node, $w, @ientry));
|
||||
push(@$para, addidx($node, $w, @ientry));
|
||||
}
|
||||
if (!$qindex) {
|
||||
pop @pentry; # remove final space
|
||||
@ -465,7 +465,7 @@ sub got_para {
|
||||
} elsif ($emph) {
|
||||
substr($pentry[-1],0,2) = 'ee';
|
||||
}
|
||||
push(@para, @pentry);
|
||||
push(@$para, @pentry);
|
||||
}
|
||||
} elsif (/^\\[kK]/) {
|
||||
$t = "k ";
|
||||
@ -473,7 +473,7 @@ sub got_para {
|
||||
s/^\\[kK]//;
|
||||
die "badly formatted \\k: \\k$_\n" if !/\{([^\}]*)\}(.*)$/;
|
||||
$_ = $2;
|
||||
push @para,"$t$1";
|
||||
push @$para,"$t$1";
|
||||
} elsif (/^\\W/) {
|
||||
s/^\\W//;
|
||||
die "badly formatted \\W: \\W$_\n"
|
||||
@ -488,8 +488,8 @@ sub got_para {
|
||||
$w =~ s/\\\}/\}/g;
|
||||
$w =~ s/\\-/-/g;
|
||||
$w =~ s/\\\\/\\/g;
|
||||
push(@para, addidx($node, $w, "c $w")) if $indexing;
|
||||
push(@para, "$t<$l>$w");
|
||||
push(@$para, addidx($node, $w, "c $w")) if $indexing;
|
||||
push(@$para, "$t<$l>$w");
|
||||
} else {
|
||||
die "what the hell? $_\n" if !/^(([^\s\\\-]|\\[\\{}\-])*-?)(.*)$/;
|
||||
die "painful death! $_\n" if !length $1;
|
||||
@ -500,18 +500,18 @@ sub got_para {
|
||||
$w =~ s/\\-/-/g;
|
||||
$w =~ s/\\\\/\\/g;
|
||||
if ($w eq '--') {
|
||||
push @para, 'dm';
|
||||
push @$para, 'dm';
|
||||
} elsif ($w eq '-') {
|
||||
push @para, 'da';
|
||||
push @$para, 'da';
|
||||
} else {
|
||||
push @para,"n $w";
|
||||
push @$para,"n $w";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($irewrite ne undef) {
|
||||
addidx(undef, $irewrite, @para);
|
||||
addidx(undef, $irewrite, @$para);
|
||||
} else {
|
||||
push @pnames, [@para];
|
||||
push @pnames, $para;
|
||||
push @pflags, $pflags;
|
||||
}
|
||||
}
|
||||
@ -807,12 +807,8 @@ sub write_html {
|
||||
# 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";
|
||||
}
|
||||
$title = plist_to_html(@$pname);
|
||||
print "<li class=\"toc${level}\">\n";
|
||||
print "<span class=\"node\">$node: </span><a href=\"$link\">$title</a>\n";
|
||||
}
|
||||
@ -1066,7 +1062,19 @@ sub html_index {
|
||||
print "</ul>\n";
|
||||
}
|
||||
|
||||
sub word_html {
|
||||
sub plist_to_html(@) {
|
||||
my $ws = '';
|
||||
|
||||
foreach my $w (@_) {
|
||||
my $ww = word_html($w);
|
||||
next if ($ww eq "\001");
|
||||
$ws .= $ww;
|
||||
}
|
||||
|
||||
return $ws;
|
||||
}
|
||||
|
||||
sub word_html($) {
|
||||
my ($w) = @_;
|
||||
my $wtype, $wmajt, $pfx, $sfx;
|
||||
|
||||
@ -1119,11 +1127,11 @@ sub word_html {
|
||||
}
|
||||
|
||||
# Make tree structures. $tstruct_* is top-level and global.
|
||||
sub add_item {
|
||||
my ($item, $level) = @_;
|
||||
sub add_item($$$) {
|
||||
my ($item, $level, $para) = @_;
|
||||
my $i;
|
||||
|
||||
$tstruct_pname{$item} = $pname;
|
||||
$tstruct_pname{$item} = $para;
|
||||
$tstruct_next{$tstruct_previtem} = $item;
|
||||
$tstruct_prev{$item} = $tstruct_previtem;
|
||||
$tstruct_level{$item} = $level;
|
||||
|
Loading…
x
Reference in New Issue
Block a user