@@ -769,6 +769,15 @@ sub word_txt {
769769 }
770770}
771771
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+
772781sub write_html {
773782 # This is called from the top level, so I won't bother using
774783 # my or local.
@@ -778,6 +787,8 @@ sub write_html {
778787 print " writing contents file..." ;
779788 open TEXT, ' >' , File::Spec-> catfile($out_path , ' nasmdoc0.html' );
780789 select TEXT;
790+ undef $html_nav_last ;
791+ $html_nav_next = $tstruct_next {' Top' };
781792 &html_preamble(0);
782793 print " <p>This manual documents NASM, the Netwide Assembler: an assembler\n " ;
783794 print " targeting the Intel x86 series of processors, with portable source.\n </p>" ;
@@ -797,12 +808,7 @@ sub write_html {
797808 }
798809 $level = $tstruct_level {$node };
799810 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 );
806812 } else {
807813 # Use the preceding filename plus a marker point.
808814 $link = $fname . " #$xrefnodes {$node }" ;
@@ -853,7 +859,7 @@ sub write_html {
853859 $html_nav_last = $chapternode ;
854860 $chapternode = $nodexrefs {$xref };
855861 $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) ));
857863 select TEXT;
858864 &html_preamble(1);
859865 foreach $i (@$pname ) {
@@ -871,7 +877,7 @@ sub write_html {
871877 $html_nav_last = $chapternode ;
872878 $chapternode = $nodexrefs {$xref };
873879 $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) ));
875881 select TEXT;
876882 &html_preamble(1);
877883 foreach $i (@$pname ) {
@@ -988,11 +994,11 @@ sub html_preamble {
988994 # Navigation bar
989995 print " <ul class=\" navbar\" >\n " ;
990996 if (defined ($html_nav_last )) {
991- my $lastf = $html_fnames { $ html_nav_last} ;
997+ my $lastf = html_filename( $ html_nav_last) ;
992998 print " <li class=\" first\" ><a class=\" prev\" href=\" $lastf \" >$html_nav_last </a></li>\n " ;
993999 }
9941000 if (defined ($html_nav_next )) {
995- my $nextf = $html_fnames { $ html_nav_next} ;
1001+ my $nextf = html_filename( $ html_nav_next) ;
9961002 print " <li><a class=\" next\" href=\" $nextf \" >$html_nav_next </a></li>\n " ;
9971003 }
9981004 print " <li><a class=\" toc\" href=\" nasmdoc0.html\" >Contents</a></li>\n " ;
@@ -1114,7 +1120,7 @@ ($)
11141120 my $level = $tstruct_level {$node }; # and its level
11151121 my $up = $node , $uplev = $level -1;
11161122 $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 ) : " " ;
11181124 my $marker = ($level == 1 and $file ) ? " " : " #$w " ;
11191125 return " <a href=\" $file$marker \" >" ;
11201126 } elsif ($wtype eq " xe" ) {
0 commit comments