Fix indentation; $ in the middle of regexps confuses Emacs, so use \Z

instead.  No functional changes.
This commit is contained in:
Markus Armbruster 2004-02-15 16:22:02 +00:00
parent eca121f709
commit cb5c45dcd2
2 changed files with 72 additions and 72 deletions

View file

@ -8,7 +8,7 @@ my @a;
line: while (<>) { line: while (<>) {
chomp; # strip record separator chomp; # strip record separator
s/([^\\](\\\\)*)\\\".*/$1/g;# strip comments s/([^\\](\\\\)*)\\\".*/$1/g; # strip comments
@a = req($_); @a = req($_);
@ -72,7 +72,7 @@ sub req {
if (/^([\.\'])[ \t]*([^ ]+) *(.*)/) { if (/^([\.\'])[ \t]*([^ ]+) *(.*)/) {
my @a = ($1, $2); my @a = ($1, $2);
$_ = $3; $_ = $3;
while (/(\"((\\.|[^\\\"])*)(\"|$))|(([^ ]|\\.)+) */g) { while (/(\"((\\.|[^\\\"])*)(\"|\Z))|(([^ ]|\\.)+) */g) {
push(@a, $2 || $5); push(@a, $2 || $5);
} }
return @a; return @a;
@ -98,38 +98,38 @@ sub anchor {
# Translate HTML special characters into escape sequences # Translate HTML special characters into escape sequences
sub htmlify { sub htmlify {
local ($_) = @_; local ($_) = @_;
die "funny escape character `$esc' not supported" die "funny escape character `$esc' not supported"
if $esc && $esc ne "\\"; if $esc && $esc ne "\\";
# translate some troff escapes # translate some troff escapes
s/\\&//g if $esc; # zero width space character s/\\&//g if $esc; # zero width space character
# escape HTML special characters # escape HTML special characters
s/\&/&amp;/g; s/\&/&amp;/g;
s/\</&lt;/g; s/\</&lt;/g;
s/\>/&gt;/g; s/\>/&gt;/g;
return $_ unless $esc; return $_ unless $esc;
# translate more troff escapes # translate more troff escapes
s/\\e/&\#92;/g; # escape character s/\\e/&\#92;/g; # escape character
# turn quoted strings that look like info names into links # turn quoted strings that look like info names into links
# tacky... # tacky...
while (/(\\\*Q)([A-Za-z0-9\-\.]+)(\\\*U)/) { while (/(\\\*Q)([A-Za-z0-9\-\.]+)(\\\*U)/) {
$_ = $` . anchor($2) . "$'"; $_ = $` . anchor($2) . "$'";
} }
while (/(\"info )([A-Za-z0-9\-\.]+)/) { while (/(\"info )([A-Za-z0-9\-\.]+)/) {
$_ = "$`\"info " . anchor($2) . "$'"; $_ = "$`\"info " . anchor($2) . "$'";
} }
# tranlate more troff escapes and strings # tranlate more troff escapes and strings
s/\\\*Q/<em>/g; s/\\\*Q/<em>/g;
s/\\\*U/<\/em>/g; s/\\\*U/<\/em>/g;
s/\\fI/<em>/g; s/\\fI/<em>/g;
s/\\fR/<\/em><\/em>/g; s/\\fR/<\/em><\/em>/g;
s/\\fB/<strong>/g; s/\\fB/<strong>/g;
s/\\fP/<\/strong><\/em>/g; s/\\fP/<\/strong><\/em>/g;
s/\\\*\(bF/<strong>/g; # bold font s/\\\*\(bF/<strong>/g; # bold font
s/\\\*\(pF/<\/strong><\/em>/g; # pica font s/\\\*\(pF/<\/strong><\/em>/g; # pica font
s/\\\*\(nF/<\/strong><\/em>/g; # normal font s/\\\*\(nF/<\/strong><\/em>/g; # normal font
s/\\\*\(iF/<em>/g; # italic font s/\\\*\(iF/<em>/g; # italic font
s/\\\(mu/x/g; # multiply symbol s/\\\(mu/x/g; # multiply symbol
s/\\ /&nbsp;/g; # non breaking space s/\\ /&nbsp;/g; # non breaking space
return $_; return $_;
} }

View file

@ -9,7 +9,7 @@ my @a;
line: while (<>) { line: while (<>) {
chomp; # strip record separator chomp; # strip record separator
s/([^\\](\\\\)*)\\\".*/$1/g;# strip comments s/([^\\](\\\\)*)\\\".*/$1/g; # strip comments
@a = req($_); @a = req($_);
@ -79,7 +79,7 @@ sub req {
if (/^([\.\'])[ \t]*([^ ]+) *(.*)/) { if (/^([\.\'])[ \t]*([^ ]+) *(.*)/) {
my @a = ($1, $2); my @a = ($1, $2);
$_ = $3; $_ = $3;
while (/(\"((\\.|[^\\\"])*)(\"|$))|(([^ ]|\\.)+) */g) { while (/(\"((\\.|[^\\\"])*)(\"|\Z))|(([^ ]|\\.)+) */g) {
push(@a, $2 || $5); push(@a, $2 || $5);
} }
return @a; return @a;
@ -105,38 +105,38 @@ sub anchor {
# Translate HTML special characters into escape sequences # Translate HTML special characters into escape sequences
sub htmlify { sub htmlify {
local ($_) = @_; local ($_) = @_;
die "funny escape character `$esc' not supported" die "funny escape character `$esc' not supported"
if $esc && $esc ne "\\"; if $esc && $esc ne "\\";
# translate some troff escapes # translate some troff escapes
s/\\&//g if $esc; # zero width space character s/\\&//g if $esc; # zero width space character
# escape HTML special characters # escape HTML special characters
s/\&/&amp;/g; s/\&/&amp;/g;
s/\</&lt;/g; s/\</&lt;/g;
s/\>/&gt;/g; s/\>/&gt;/g;
return $_ unless $esc; return $_ unless $esc;
# translate more troff escapes # translate more troff escapes
s/\\e/&\#92;/g; # escape character s/\\e/&\#92;/g; # escape character
# turn quoted strings that look like info names into links # turn quoted strings that look like info names into links
# tacky... # tacky...
while (/(\\\*Q)([A-Za-z0-9\-\.]+)(\\\*U)/) { while (/(\\\*Q)([A-Za-z0-9\-\.]+)(\\\*U)/) {
$_ = $` . anchor($2) . "$'"; $_ = $` . anchor($2) . "$'";
} }
while (/(\"info )([A-Za-z0-9\-\.]+)/) { while (/(\"info )([A-Za-z0-9\-\.]+)/) {
$_ = "$`\"info " . anchor($2) . "$'"; $_ = "$`\"info " . anchor($2) . "$'";
} }
# tranlate more troff escapes and strings # tranlate more troff escapes and strings
s/\\\*Q/<em>/g; s/\\\*Q/<em>/g;
s/\\\*U/<\/em>/g; s/\\\*U/<\/em>/g;
s/\\fI/<em>/g; s/\\fI/<em>/g;
s/\\fR/<\/em><\/em>/g; s/\\fR/<\/em><\/em>/g;
s/\\fB/<strong>/g; s/\\fB/<strong>/g;
s/\\fP/<\/strong><\/em>/g; s/\\fP/<\/strong><\/em>/g;
s/\\\*\(bF/<strong>/g; # bold font s/\\\*\(bF/<strong>/g; # bold font
s/\\\*\(pF/<\/strong><\/em>/g; # pica font s/\\\*\(pF/<\/strong><\/em>/g; # pica font
s/\\\*\(nF/<\/strong><\/em>/g; # normal font s/\\\*\(nF/<\/strong><\/em>/g; # normal font
s/\\\*\(iF/<em>/g; # italic font s/\\\*\(iF/<em>/g; # italic font
s/\\\(mu/x/g; # multiply symbol s/\\\(mu/x/g; # multiply symbol
s/\\ /&nbsp;/g; # non breaking space s/\\ /&nbsp;/g; # non breaking space
return $_; return $_;
} }