bugGNU roff - Bugs: bug #60526, [me] buggy HTML output using...


bug #60526: [me] buggy HTML output using gremlin preprocessor

Submitter:  Dave <barx>
Submitted:  Wed 05 May 2021 06:34:06 AM UTC
Category:  Macro me Severity:  2 - Minor
Item Group:  Incorrect behaviour Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Wed 05 May 2021 06:34:06 AM UTC, original submission:  

(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 code reveals a couple of issues in the .GS and .GF macros.


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.


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
.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.

Dave <barx>
Group Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by barx (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-06-04 barx Summarybuggy HTML output using -me macros with gremlin preprocessor [me] buggy HTML output using gremlin preprocessor

    Back to the top

    Powered by Savane 3.12