@@ -769,6 +769,15 @@ sub word_txt {
769
769
}
770
770
}
771
771
772
+ sub html_filename ($) {
773
+ my ($node ) = @_ ;
774
+
775
+ (my $number = lc ($xrefnodes {$node })) =~ s / .*-// ;
776
+ my $fname =" nasmdocx.html" ;
777
+ substr ($fname ,8 - length $number , length $number ) = $number ;
778
+ return $fname ;
779
+ }
780
+
772
781
sub write_html {
773
782
# This is called from the top level, so I won't bother using
774
783
# my or local.
@@ -778,6 +787,8 @@ sub write_html {
778
787
print " writing contents file..." ;
779
788
open TEXT, ' >' , File::Spec-> catfile($out_path , ' nasmdoc0.html' );
780
789
select TEXT;
790
+ undef $html_nav_last ;
791
+ $html_nav_next = $tstruct_next {' Top' };
781
792
&html_preamble(0);
782
793
print " <p>This manual documents NASM, the Netwide Assembler: an assembler\n " ;
783
794
print " targeting the Intel x86 series of processors, with portable source.\n </p>" ;
@@ -797,12 +808,7 @@ sub write_html {
797
808
}
798
809
$level = $tstruct_level {$node };
799
810
if ($level == 1) {
800
- # Invent a file name.
801
- ($number = lc ($xrefnodes {$node })) =~ s / .*-// ;
802
- $fname =" nasmdocx.html" ;
803
- substr ($fname ,8 - length $number , length $number ) = $number ;
804
- $html_fnames {$node } = $fname ;
805
- $link = $fname ;
811
+ $link = $fname = html_filename($node );
806
812
} else {
807
813
# Use the preceding filename plus a marker point.
808
814
$link = $fname . " #$xrefnodes {$node }" ;
@@ -853,7 +859,7 @@ sub write_html {
853
859
$html_nav_last = $chapternode ;
854
860
$chapternode = $nodexrefs {$xref };
855
861
$html_nav_next = $tstruct_mnext {$chapternode };
856
- open (TEXT, ' >' , File::Spec-> catfile($out_path , $html_fnames { $ chapternode} ));
862
+ open (TEXT, ' >' , File::Spec-> catfile($out_path , html_filename( $ chapternode) ));
857
863
select TEXT;
858
864
&html_preamble(1);
859
865
foreach $i (@$pname ) {
@@ -871,7 +877,7 @@ sub write_html {
871
877
$html_nav_last = $chapternode ;
872
878
$chapternode = $nodexrefs {$xref };
873
879
$html_nav_next = $tstruct_mnext {$chapternode };
874
- open (TEXT, ' >' , File::Spec-> catfile($out_path , $html_fnames { $ chapternode} ));
880
+ open (TEXT, ' >' , File::Spec-> catfile($out_path , html_filename( $ chapternode) ));
875
881
select TEXT;
876
882
&html_preamble(1);
877
883
foreach $i (@$pname ) {
@@ -988,11 +994,11 @@ sub html_preamble {
988
994
# Navigation bar
989
995
print " <ul class=\" navbar\" >\n " ;
990
996
if (defined ($html_nav_last )) {
991
- my $lastf = $html_fnames { $ html_nav_last} ;
997
+ my $lastf = html_filename( $ html_nav_last) ;
992
998
print " <li class=\" first\" ><a class=\" prev\" href=\" $lastf \" >$html_nav_last </a></li>\n " ;
993
999
}
994
1000
if (defined ($html_nav_next )) {
995
- my $nextf = $html_fnames { $ html_nav_next} ;
1001
+ my $nextf = html_filename( $ html_nav_next) ;
996
1002
print " <li><a class=\" next\" href=\" $nextf \" >$html_nav_next </a></li>\n " ;
997
1003
}
998
1004
print " <li><a class=\" toc\" href=\" nasmdoc0.html\" >Contents</a></li>\n " ;
@@ -1114,7 +1120,7 @@ ($)
1114
1120
my $level = $tstruct_level {$node }; # and its level
1115
1121
my $up = $node , $uplev = $level -1;
1116
1122
$up = $tstruct_up {$up } while $uplev --; # get top node of containing file
1117
- my $file = ($up ne $chapternode ) ? $html_fnames { $up } : " " ;
1123
+ my $file = ($up ne $chapternode ) ? html_filename( $up ) : " " ;
1118
1124
my $marker = ($level == 1 and $file ) ? " " : " #$w " ;
1119
1125
return " <a href=\" $file$marker \" >" ;
1120
1126
} elsif ($wtype eq " xe" ) {
0 commit comments