#!/usr/bin/awk
# $Id: db-html2man,v 1.9 2002/09/03 19:44:24 nepto Exp $
function remove_lines(str)
{
while (getline) {
if (sub(str, "")) { print; break; }
}
return;
}
function handle_table(str)
{
entries = 0;
sub(/
]*>/, "");
print;
while (getline) {
# end of table
if (sub(/<\/table>/, "")) { return; }
if ($0 ~ //) {
remove_lines("^.*<\/thead>");
}
sub(/]*>/, "");
sub(/<\/tgroup>/, "");
sub(//, "");
sub(/<\/tbody>/, "");
if (sub(/]*>/, "")) { entries = 0; }
if (sub(/<\/row>/, "")) {
if (entries > 1)
print "";
}
if ($0 ~ //) {
entries++;
if (entries == 1 )
sub(//, "");
else {
if (entries == 2)
print "";
sub(//, "");
}
}
if ($0 ~ /<\/entry>/) {
if (entries == 1 )
sub(/<\/entry>/, "");
else {
sub(/<\/entry>/, "");
}
}
print;
}
}
# multiline MAN: comment
/$/) break;
print;
}
next;
}
# MAN: on one line
/");
for (i = 1; i <= n; i++) {
#printf "a[%d] = '%s'\n", i, a[i];
if (a[i] ~ /", a[i];
else printf "%s", a[i];
}
next;
}
# remove "" -- MUST be on begin of the line!
/");
next;
}
//, "");
print;
}
# vim: ft=awk cindent