bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #60526] buggy HTML output using -me macros with gremlin preprocesso


From: Dave
Subject: [bug #60526] buggy HTML output using -me macros with gremlin preprocessor
Date: Wed, 5 May 2021 02:34:08 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Firefox/45.0

URL:
  <https://savannah.gnu.org/bugs/?60526>

                 Summary: buggy HTML output using -me macros with gremlin
preprocessor
                 Project: GNU troff
            Submitted by: barx
            Submitted on: Wed 05 May 2021 01:34:06 AM CDT
                Category: Macro - me
                Severity: 2 - Minor
              Item Group: Incorrect behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

(This bug is almost certainly irrelevant, as the number of users in the 21st
century asking for HTML output from the -me macro package in combination with
the gremlin preprocessor is probably indistinguishable from 0.)

A simple inspection of tmac/e.tmac-u
<http://git.savannah.gnu.org/cgit/groff.git/tree/tmac/e.tmac-u#n1359> code
reveals a couple of issues in the .GS and .GF macros.

== GS ==

The definition of GS includes this code:


.       ie "\\$1"L" .do HTML-IMAGE-LEFT
.       el .ie "\\$1"R" .do HTML-IMAGE-RIGHT
.       el .do HTML-IMAGE


But this is not always valid roff logic (see
http://lists.gnu.org/archive/html/groff/2020-09/msg00001.html): if the .ie
following the first .el is not executed, the second .el becomes mismatched. 
This is fairly trivial to demonstrate:


$ echo .GS L | groff -Thtml -ww -me > /dev/null
troff: stdin:1: warning: number register 'g1' not defined
troff: stdin:1: warning: number register 'g2' not defined
troff: stdin:1: warning: unbalanced .el request


The first two warnings are no doubt something not being initialized correctly
for gremlin, but the third exposes the logic error in the GS macro.

Enclosing the second .ie/.el pair in braces seems to resolve this.

== GF ==

For -Thtml, the .GS macro invokes one of HTML-IMAGE-LEFT, HTML-IMAGE-RIGHT, or
HTML-IMAGE.  The .GE macro invokes HTML-IMAGE-END.  But the .GF macro invokes
no HTML macros.  So a gremlin picture delimited by .GS and .GF will begin the
HTML image but never end it.  I don't use gremlin or HTML output, so don't
know enough to craft a test case demonstrating this probable problem.

Based on code inspection only, and following the logic of .GS, my guess of the
correct way to implement .GE and .GF is:


.de GE                  \" *** end gremlin picture
.GF
.if !'\*(.T'html' .sp .6
..
.
.de GF                  \" *** finish gremlin picture; stay at top
.ie '\*(.T'html' .do HTML-IMAGE-END
.el \
\{\
.       ls
.       in
.       if \\n(g7 .fi
.\}
..


That is, move the logic that is currently exclusive to .GE into .GF, which is
invoked in both cases.




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60526>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]