summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwl <wl>2012-05-24 11:38:14 +0000
committerwl <wl>2012-05-24 11:38:14 +0000
commit4352f08b127645122f482946192c93cefad60d43 (patch)
tree6610394914677157f4154d7ab895654b8e3386b6 /src
parent2510fd3081231040da91bf132856d1beea4d41ad (diff)
downloadgroff-4352f08b127645122f482946192c93cefad60d43.tar.gz
* src/roff/grog/grog.pl (process): Fix .so handling.
This does the same as the previous commit.
Diffstat (limited to 'src')
-rw-r--r--src/roff/grog/grog.pl26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/roff/grog/grog.pl b/src/roff/grog/grog.pl
index ff830153..81bc1ff6 100644
--- a/src/roff/grog/grog.pl
+++ b/src/roff/grog/grog.pl
@@ -131,25 +131,25 @@ sub process {
$Groff{'soelim'}++ if $level;
} elsif (/^\.TS$Sp/) {
$_ = <FILE>;
- if (!/^\./) {
+ if (!/^\./ || /^\.so/) {
$Groff{'tbl'}++;
$Groff{'soelim'}++ if $level;
}
} elsif (/^\.EQ$Sp/) {
$_ = <FILE>;
- if (!/^\./ || /^\.[0-9]/) {
+ if (!/^\./ || /^\.[0-9]/ || /^\.so/) {
$Groff{'eqn'}++;
$Groff{'soelim'}++ if $level;
}
} elsif (/^\.GS$Sp/) {
$_ = <FILE>;
- if (!/^\./) {
+ if (!/^\./ || /^\.so/) {
$Groff{'grn'}++;
$Groff{'soelim'}++ if $level;
}
} elsif (/^\.G1$Sp/) {
$_ = <FILE>;
- if (!/^\./) {
+ if (!/^\./ || /^\.so/) {
$Groff{'grap'}++;
$Groff{'soelim'}++ if $level;
}
@@ -160,7 +160,7 @@ sub process {
# &process($1, $level);
# } else {
# $_ = <FILE>;
-# if (!/^\./ || /^\.ps/) {
+# if (!/^\./ || /^\.ps/ || /^\.so/) {
# $Groff{'pic'}++;
# $Groff{'soelim'}++ if $level;
# }
@@ -243,6 +243,22 @@ sub process {
s/^.so *//;
s/\\\".*//;
s/ .*$//;
+ # The next if-clause catches e.g.
+ #
+ # .EQ
+ # .so foo
+ # .EN
+ #
+ # However, the code is not fully correct since it is too generous.
+ # Theoretically, we should check for .so only within preprocessor
+ # blocks like .EQ/.EN or .TS/.TE; but it doesn't harm if we call
+ # soelim even if we don't need to.
+ if ( $Groff{'pic'} || $Groff{'tbl'} || $Groff{'eqn'} ||
+ $Groff{'grn'} || $Groff{'grap'} || $Groff{'refer'} ||
+ $Groff{'refer_open'} || $Groff{'refer_close'} ||
+ $Groff{'chem'} ) {
+ $Groff{'soelim'}++;
+ }
&process($_, $level + 1) unless /\\/ || $_ eq "";
}
}