New command line options "linenumbers" and "linelabels" which generate line
numbers and labels for each line. Generate HTML 4.01 instead of 4.0. git-svn-id: svn://svn.cc65.org/cc65/trunk@2514 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -7,10 +7,10 @@
|
|||||||
# #
|
# #
|
||||||
# #
|
# #
|
||||||
# #
|
# #
|
||||||
# (C) 2000 Ullrich von Bassewitz #
|
# (C) 2000-2003 Ullrich von Bassewitz #
|
||||||
# Wacholderweg 14 #
|
# R<EFBFBD>merstrasse 52 #
|
||||||
# D-70597 Stuttgart #
|
# D-70794 Filderstadt #
|
||||||
# EMail: uz@musoftware.de #
|
# EMail: uz@cc65.org #
|
||||||
# #
|
# #
|
||||||
# #
|
# #
|
||||||
# This software is provided 'as-is', without any expressed or implied #
|
# This software is provided 'as-is', without any expressed or implied #
|
||||||
@@ -77,6 +77,8 @@ my $IndexCols = 6; # Columns in the file listing
|
|||||||
my $IndexTitle = "Index"; # Title of index page
|
my $IndexTitle = "Index"; # Title of index page
|
||||||
my $IndexName = "index.html"; # Name of index page
|
my $IndexName = "index.html"; # Name of index page
|
||||||
my $IndexPage = 0; # Create an index page
|
my $IndexPage = 0; # Create an index page
|
||||||
|
my $LineLabels = 0; # Add a HTML label to each line
|
||||||
|
my $LineNumbers = 0; # Add line numbers to the output
|
||||||
my $LinkStyle = 0; # Default link style
|
my $LinkStyle = 0; # Default link style
|
||||||
my $ReplaceExt = 0; # Replace extension instead of appending
|
my $ReplaceExt = 0; # Replace extension instead of appending
|
||||||
my $TextColor = "#000000"; # Text color
|
my $TextColor = "#000000"; # Text color
|
||||||
@@ -172,7 +174,7 @@ sub DocHeader {
|
|||||||
my $OUT = shift (@_);
|
my $OUT = shift (@_);
|
||||||
my $Asm = shift (@_);
|
my $Asm = shift (@_);
|
||||||
print $OUT <<"EOF";
|
print $OUT <<"EOF";
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html-40/loose.dtd">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
@@ -200,7 +202,7 @@ sub DocFooter {
|
|||||||
<p><br><p>
|
<p><br><p>
|
||||||
<hr size=1 noshade>
|
<hr size=1 noshade>
|
||||||
<address>
|
<address>
|
||||||
<a href="http://validator.w3.org/check/referer"><img border=0 src="http://validator.w3.org/images/vh40" alt="Valid HTML 4.0!" height=31 width=88 align=right></a>
|
<a href="http://validator.w3.org/check/referer"><img border="0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" height="31" width="88" align=right></a>
|
||||||
$Name; generated on $Today by ca65html<br>
|
$Name; generated on $Today by ca65html<br>
|
||||||
<a href=\"mailto:uz\@cc65.org\">uz\@cc65.org</a>
|
<a href=\"mailto:uz\@cc65.org\">uz\@cc65.org</a>
|
||||||
</address>
|
</address>
|
||||||
@@ -443,14 +445,29 @@ sub Process2 {
|
|||||||
|
|
||||||
# Read the input file, replacing references by hyperlinks and mark
|
# Read the input file, replacing references by hyperlinks and mark
|
||||||
# labels as link targets.
|
# labels as link targets.
|
||||||
|
my $LineNo = 0;
|
||||||
while ($Line = <INPUT>) {
|
while ($Line = <INPUT>) {
|
||||||
|
|
||||||
|
# Count input lines
|
||||||
|
$LineNo++;
|
||||||
|
|
||||||
# Remove the newline
|
# Remove the newline
|
||||||
chop ($Line);
|
chop ($Line);
|
||||||
|
|
||||||
# Clear the output line
|
# Clear the output line
|
||||||
$OutLine = "";
|
$OutLine = "";
|
||||||
|
|
||||||
|
# If requested, add a html label to each line with a name "linexxx",
|
||||||
|
# so it can be referenced from the outside (this is the same convention
|
||||||
|
# that is used by c2html). If we have line numbers enabled, add them.
|
||||||
|
if ($LineLabels && $LineNumbers) {
|
||||||
|
$OutLine .= sprintf ("<a name=\"line%d\">%6d</a>: ", $LineNo, $LineNo);
|
||||||
|
} elsif ($LineLabels) {
|
||||||
|
$OutLine .= sprintf ("<a name=\"line%d\"></a>", $LineNo);
|
||||||
|
} elsif ($LineNumbers) {
|
||||||
|
$OutLine .= sprintf ("%6d: ", $LineNo);
|
||||||
|
}
|
||||||
|
|
||||||
# Check for a label. If we have one, process it and remove it
|
# Check for a label. If we have one, process it and remove it
|
||||||
# from the line
|
# from the line
|
||||||
if ($Line =~ /^\s*?(\@?)([_a-zA-Z][_\w]*)(\s*)(:|=)(.*)$/) {
|
if ($Line =~ /^\s*?(\@?)([_a-zA-Z][_\w]*)(\s*)(:|=)(.*)$/) {
|
||||||
@@ -808,7 +825,7 @@ sub CreateIndex {
|
|||||||
|
|
||||||
# Print the header
|
# Print the header
|
||||||
print INDEX <<"EOF";
|
print INDEX <<"EOF";
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html-40/loose.dtd">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content=\"text/html; charset=iso-8859-1">
|
<meta http-equiv="Content-Type" content=\"text/html; charset=iso-8859-1">
|
||||||
@@ -850,6 +867,7 @@ sub Usage {
|
|||||||
print " --indexname file Use file for the index file instead of $IndexName\n";
|
print " --indexname file Use file for the index file instead of $IndexName\n";
|
||||||
print " --indexpage Create an index page\n";
|
print " --indexpage Create an index page\n";
|
||||||
print " --indextitle title Use title as the index title instead of $IndexTitle\n";
|
print " --indextitle title Use title as the index title instead of $IndexTitle\n";
|
||||||
|
print " --linenumbers Add line numbers to the output\n";
|
||||||
print " --linkstyle style Use the given link style\n";
|
print " --linkstyle style Use the given link style\n";
|
||||||
print " --replaceext Replace source extension instead of appending .html\n";
|
print " --replaceext Replace source extension instead of appending .html\n";
|
||||||
print " --textcolor color Use text color c instead of $TextColor\n";
|
print " --textcolor color Use text color c instead of $TextColor\n";
|
||||||
@@ -873,6 +891,8 @@ GetOptions ("bgcolor=s" => \$BGColor,
|
|||||||
"indexname=s" => \$IndexName,
|
"indexname=s" => \$IndexName,
|
||||||
"indexpage" => \$IndexPage,
|
"indexpage" => \$IndexPage,
|
||||||
"indextitle=s" => \$IndexTitle,
|
"indextitle=s" => \$IndexTitle,
|
||||||
|
"linelabels" => \$LineLabels,
|
||||||
|
"linenumbers" => \$LineNumbers,
|
||||||
"linkstyle=i" => \$LinkStyle,
|
"linkstyle=i" => \$LinkStyle,
|
||||||
"replaceext" => \$ReplaceExt,
|
"replaceext" => \$ReplaceExt,
|
||||||
"textcolor=s" => \$TextColor,
|
"textcolor=s" => \$TextColor,
|
||||||
|
|||||||
Reference in New Issue
Block a user