}
next;
}
- $header = $1;
+
+ # strip formatting directives in =item line
+ ($header = $1) =~ s/[A-Z]<(.*?)>/$1/g;
if ($header =~ /%[sd]/) {
$rhs = $lhs = $header;
#$lhs =~ s/\377([^\377]*)$/\Q$1\E\$/;
$lhs =~ s/\377([^\377]*)$/\Q$1\E/;
$lhs =~ s/\377//g;
+ $lhs =~ s/\.\*\?$/.*/; # Allow %s at the end to eat it all
}
- $transmo .= " s{^$lhs}\n {\Q$rhs\E}\n\t&& return 1;\n";
+ $transmo .= " s{^$lhs}\n {\Q$rhs\E}s\n\t&& return 1;\n";
} else {
$transmo .= " m{^\Q$header\E} && return 1;\n";
}
if ($standalone) {
if (!@ARGV and -t STDIN) { print STDERR "$0: Reading from STDIN\n" }
- while ($error = <>) {
+ while (defined ($error = <>)) {
splainthis($error) || print THITHER $error;
}
exit;
exists $HTML_Escapes{$1}
? do { $HTML_Escapes{$1} }
: do {
- warn "Unknown escape: $& in $_";
+ warn "Unknown escape: E<$1> in $_";
"E<$1>";
}
}
sub shorten {
my $line = $_[0];
- if (length $line > 79) {
+ if (length($line) > 79 and index($line, "\n") == -1) {
my $space_place = rindex($line, ' ', 79);
if ($space_place != -1) {
substr($line, $space_place, 1) = "\n\t";