This commit is contained in:
2007-12-24 01:20:10 +00:00
parent 23c849e75a
commit c8140861a0
8 changed files with 472 additions and 462 deletions

View File

@ -11,6 +11,7 @@ global list_count;
global table_row_count;
global table_row_line_count;
global table_in_th;
global tabs;
function print_text (full)
{
@ -18,6 +19,7 @@ function print_text (full)
gsub ("<", "\\&lt;", full);
gsub (">", "\\&gt;", full);
gsub (/\t/, tabs, full);
while (match (full, /\{[^{},]+,[^{},]+\}/) > 0)
{
@ -32,24 +34,33 @@ function print_text (full)
full = sprintf ("%s<a href='%s'>%s</a>%s", fra1, t2, t1, fra2);
}
while (match (full, /\[\[[^\[\][:space:]]+\]\]/) > 0)
while (match (full, /##\/[^\[\][:space:]]+\/##/) > 0)
{
fra1 = substr (full, 1, RSTART-1);
link = substr (full, RSTART+2, RLENGTH-4);
link = substr (full, RSTART+3, RLENGTH-6);
fra2 = substr (full, RSTART+RLENGTH, length(full)-RLENGTH);
full = sprintf ("%s<i>%s</i>%s", fra1, link, fra2);
}
while (match (full, /##[^#[:space:]]+##/) > 0)
while (match (full, /##=[^#[:space:]]+=##/) > 0)
{
fra1 = substr (full, 1, RSTART-1);
link = substr (full, RSTART+2, RLENGTH-4);
link = substr (full, RSTART+3, RLENGTH-6);
fra2 = substr (full, RSTART+RLENGTH, length(full)-RLENGTH);
full = sprintf ("%s<b>%s</b>%s", fra1, link, fra2);
}
while (match (full, /##-[^#[:space:]]+-##/) > 0)
{
fra1 = substr (full, 1, RSTART-1);
link = substr (full, RSTART+3, RLENGTH-6);
fra2 = substr (full, RSTART+RLENGTH, length(full)-RLENGTH);
full = sprintf ("%s<strike>%s</strike>%s", fra1, link, fra2);
}
print full;
}
@ -59,6 +70,8 @@ BEGIN {
empty_line_count = 0;
para_started = 0;
tabs = "\\&nbsp;\\&nbsp;\\&nbsp;\\&nbsp;\\&nbsp;\\&nbsp;\\&nbsp;\\&nbsp;";
#output=ARGV[1];
#gsub (/\.man/, ".html", output);
#print "OUTPUT TO: " output;
@ -78,6 +91,14 @@ header && /^\.[[:alpha:]]+[[:space:]]/ {
for (i = 2; i <= NF; i++) printf "%s ", $i;
print "</title>";
}
else if ($1 == ".tabstop")
{
if (NF >= 2)
{
local i;
for (i = 0; i < $2; i++) tabs = tabs . "\\&nbsp;";
}
}
}
header && !/^\.[[:alpha:]]+[[:space:]]/ {
@ -188,6 +209,10 @@ header && !/^\.[[:alpha:]]+[[:space:]]/ {
print "<table class='ase'>";
mode = 4;
table_row_count = 0;
print "<tr class='ase'>";
table_row_count++;
table_row_line_count = 0;
}
else
{
@ -324,6 +349,7 @@ header && !/^\.[[:alpha:]]+[[:space:]]/ {
if (table_row_line_count > 0)
print ((table_in_th)? "</th>": "</td>");
print "<td class='ase'>";
print_text (substr ($0, 3, length($0)-2));
table_in_th = 0;
table_row_line_count++;