[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [groff] Heirloom: text disappearing when output line trap + interrup
G. Branden Robinson
Re: [groff] Heirloom: text disappearing when output line trap + interrupted text
Wed, 24 Apr 2019 04:11:13 +1000
At 2019-04-22T06:20:05-0400, Mircea Hossu wrote:
> Before creating a bug report, I would like to verify that I am not
> misunderstanding something and that this is indeed a bug.
> It appears that a word starting with a period or apostrophe is
> interpreted as a request/macro call even if it does not start at the
> beginning of the line, under the following combination: fill mode,
> output line trap (\P) and text interruption (\c). This causes the word
> and remainder of the line to disappear from the generated output.
My understanding is that traditional *roff has somewhat complex rules
regarding where the start of a logical input line is.
As far as I know, if you lead an input line with _any_ escape sequence,
classical *roff does not regard that escape as starting the line. This
is a frequent source of trouble in man pages, where people want to write
Center the next
How well this works out depends on the implementation, and in groff,
whether "compatibility mode" is set.
Consider the following test case, which I just tried on groff 1.22.4:
##$ DOC=$(printf '.pl 1v\nUse\n\\fB.ce 1\\fP or\nsome macro to center the next
line.\n'); echo "$DOC" | groff -Tascii -; echo "$DOC" | groff -C -Tascii -
Use .ce 1 or some macro to center the next line.
some macro to center the next line.
I don't think CSTR #54 (the official Bell Labs primer on classical
*roff) addresses this fine point of input parsing, which may be why
James Clark (I assume) decided to implement a rule that was easier to
remember--only a '.' or "'" in the first "physical" column of the input
line is specially treated. However he wanted to preserve the ability to
render documents that had been written in expectation of the quirks of
the classical implementation, hence compatibility mode.
BTW, any man page writers out there--please don't use font escapes as
shown in the example above. Use the macro package's macros instead.
For man(7), we'd write the above as:
.BI ".ce " n
Center the next
...and nobody has to worry about compatibility mode, or the details of
which column of the input line is "really" the first for syntactical
reasons. The page groff_man(7) in groff 1.22.4 has been updated with
much advice and help for you.
Description: PGP signature