From 100196a5d4a73e4cb4daca82eaba7f698052e4a0 Mon Sep 17 00:00:00 2001 From: cuz Date: Wed, 6 Dec 2000 22:16:55 +0000 Subject: [PATCH] Fixed generation of invalid HTML code git-svn-id: svn://svn.cc65.org/cc65/trunk@565 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65html/ca65html | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/ca65html/ca65html b/src/ca65html/ca65html index ec6895ffd..aabb072d4 100755 --- a/src/ca65html/ca65html +++ b/src/ca65html/ca65html @@ -486,24 +486,28 @@ sub Process2 { $Line = $2; # Variable to assemble HTML representation - my $Item = $Id; + my $Contents = ""; + + # Make this import a link target + if (exists ($Imports{$OutName}{$Id})) { + $Label = $Imports{$OutName}{$1}; + $Contents .= sprintf (" name=\"%s\"", $Label); + } # If we have an export for this import, add a link to this # export definition if (exists ($Exports{$Id})) { $Label = $Exports{$Id}; - $Item = sprintf ("%s", $Label, $Item); + $Contents .= sprintf (" href=\"%s\"", $Label); } - # Make this import a link target - if (exists ($Imports{$OutName}{$Id})) { - $Label = $Imports{$OutName}{$1}; - $Item = sprintf ("%s", $Label, $Item); + # Add the HTML stuff to the output line + if ($Contents ne "") { + $OutLine .= sprintf ("%s", $Contents, $Id); + } else { + $OutLine .= $Id; } - # Add the HTML stuff to the output line - $OutLine .= $Item; - # Check if another identifier follows if ($Line =~ /^(\s*),(\s*)(.*)$/) { $OutLine .= "$1,$2"; @@ -531,13 +535,13 @@ sub Process2 { $Line = $2; # Variable to assemble HTML representation - my $Item = $Id; + my $Contents = ""; # If we have a definition for this export in this file, add # a link to the definition. if (exists ($Labels{$OutName}{$1})) { $Label = $Labels{$OutName}{$1}; - $Item = sprintf ("%s", $Label, $Item); + $Contents = sprintf (" href=\"#%s\"", $Label); } # If we have this identifier in the list of exports, add a @@ -545,12 +549,16 @@ sub Process2 { if (exists ($Exports{$Id})) { $Label = $Exports{$Id}; # Be sure to use only the label part - $Label =~ s/^(.*#)(.*)$/$2/; - $Item = sprintf ("%s", $Label, $Item); + $Label =~ s/^(.*#)(.*)$/$2/; # ##FIXME: Expensive + $Contents .= sprintf (" name=\"%s\"", $Label); } # Add the HTML stuff to the output line - $OutLine .= $Item; + if ($Contents ne "") { + $OutLine .= sprintf ("%s", $Contents, $Id); + } else { + $OutLine .= $Id; + } # Check if another identifier follows if ($Line =~ /^(\s*),(\s*)(.*)$/) { -- 2.39.5