[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #65902] [grog] does not recognize chem preprocessor
From: |
G. Branden Robinson |
Subject: |
[bug #65902] [grog] does not recognize chem preprocessor |
Date: |
Thu, 20 Jun 2024 15:23:58 -0400 (EDT) |
Update of bug #65902 (group groff):
Severity: 1 - Wish => 4 - Important
Item Group: Feature change => Incorrect behaviour
Status: Confirmed => In Progress
_______________________________________________________
Follow-up Comment #2:
Unfortunately this was something I broke when I pretty much rewrote _grog_(1)
for _groff_ 1.23.
I didn't think hard enough about the weirdness (in AT&T _troff_ input) of the
tokens used to mark _chem_(1) input.
Setting to important severity since it's a regression relative to a released
_groff_.
Here's a patch.
diff --git a/src/utils/grog/grog.pl b/src/utils/grog/grog.pl
index 4820c2b87..d7e623aac 100644
--- a/src/utils/grog/grog.pl
+++ b/src/utils/grog/grog.pl
@@ -38,6 +38,7 @@ my @inferred_main_package = (); # full-service
package(s) detected
my $main_package; # full-service package we go with
my $use_compatibility_mode = 0; # is -C being passed to groff?
+# See subroutine do_line below for chem(1) handling.
my %preprocessor_for_macro = (
'EQ', 'eqn',
'G1', 'grap',
@@ -46,10 +47,6 @@ my %preprocessor_for_macro = (
'[', 'refer',
#'so', 'soelim', # Can't be inferred this way; see grog man page.
'TS', 'tbl',
- 'cstart', 'chem',
- 'lilypond', 'glilypond',
- 'Perl', 'gperl',
- 'pinyin', 'gpinyin',
);
(undef, undef, my $program_name) = File::Spec->splitpath($0);
@@ -247,6 +244,15 @@ sub do_line {
}
}
+ # Handle "chem" as a special case, since its start/end tokens collide
+ # with AT&T troff request names in their first two characters.
+ if ($line =~ /^\.(cstart|cend)\b/) {
+ my $preproc = 'chem';
+ if (!grep(/$preproc/, @inferred_preprocessor)) {
+ push @inferred_preprocessor, $preproc;
+ }
+ }
+
# Normalize control lines; convert no-break control character to the
# regular one and remove unnecessary whitespace.
$line =~ s/^['.]\s*/./;
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?65902>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/