gbranden pushed a commit to branch master
in repository groff.

commit 6fa8faab78f5a802e87483aae2fdc2834e4130af
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Jul 20 14:26:02 2024 -0500

    [grog]: Fix Savannah #66006 (TS/TH/TE -> "-man").
    
    * src/utils/grog/grog.pl (interpret_line): Fix logic error; set Boolean
      scalar `have_seen_first_macro_call` _after_ testing it, not before,
      avoiding its tautological truth.  (infer_man_or_ms_package): Drop `TH`
      from list of "unique" man(7) macro names.  It isn't; most full-service
      macro packages use it to manage tbl(1) headings, and we already have
      special logic for handling it as the first call in a page anyway
      (where it is overwhelmingly idiomatic of a man(7) document).
    
    Fixes <https://savannah.gnu.org/bugs/?66006>.  Thanks to Morten Bo
    Johansen for the report.
---
 ChangeLog              | 14 ++++++++++++++
 src/utils/grog/grog.pl |  9 ++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2d41dea84..69cb577ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-07-20  G. Branden Robinson <[email protected]>
+
+       * src/utils/grog/grog.pl (interpret_line): Fix logic error; set
+       Boolean scalar `have_seen_first_macro_call` _after_ testing it,
+       not before, avoiding its tautological truth.
+       (infer_man_or_ms_package): Drop `TH` from list of "unique"
+       man(7) macro names.  It isn't; most full-service macro packages
+       use it to manage tbl(1) headings, and we already have special
+       logic for handling it as the first call in a page anyway (where
+       it is overwhelmingly idiomatic of a man(7) document).
+
+       Fixes <https://savannah.gnu.org/bugs/?66006>.  Thanks to Morten
+       Bo Johansen for the report.
+
 2024-07-20  G. Branden Robinson <[email protected]>
 
        Regression-test Savannah #66006.
diff --git a/src/utils/grog/grog.pl b/src/utils/grog/grog.pl
index 417c1389f..9a102883e 100644
--- a/src/utils/grog/grog.pl
+++ b/src/utils/grog/grog.pl
@@ -3,7 +3,7 @@
 # Inspired by doctype script in Kernighan & Pike, Unix Programming
 # Environment, pp 306-8.
 
-# Copyright (C) 1993-2021 Free Software Foundation, Inc.
+# Copyright (C) 1993-2024 Free Software Foundation, Inc.
 # Written by James Clark.
 # Rewritten in Perl by Bernd Warken <[email protected]>.
 # Hacked up by G. Branden Robinson, 2021.
@@ -346,7 +346,6 @@ sub interpret_line {
   # What remains must be a macro name.
   my $macro = $command;
 
-  $have_seen_first_macro_call = 1;
   $score{$macro}++;
 
 
@@ -363,6 +362,9 @@ sub interpret_line {
     $man_score += 100;
   }
 
+  # Set this here because we start returning early from here on.
+  $have_seen_first_macro_call = 1;
+
   ##########
   # mdoc
   if ($macro =~ /^Dd$/) {
@@ -506,13 +508,14 @@ sub infer_man_or_ms_package {
                  'XS', 'XE', 'XA', 'TC', 'PX',
                  'IX', 'SG');
 
-  my @macro_man = ('BR', 'IB', 'IR', 'RB', 'RI', 'P', 'TH', 'TP', 'SS',
+  my @macro_man = ('BR', 'IB', 'IR', 'RB', 'RI', 'P', 'TP', 'SS',
                   'HP', 'PD',
                   'AT', 'UC',
                   'SB',
                   'EE', 'EX',
                   'OP',
                   'ME', 'SY', 'YS', 'TQ', 'UR', 'UE', 'MR');
+  # TH can be used by ms, mm, me, mdoc, and mom.
   # MT is also used by mm.
 
   my @macro_man_or_ms = ('B', 'I', 'BI',

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to