Hi onf,

At 2024-11-03T02:53:14+0100, onf wrote:
> changing the escape character hasn't occured to me, that's clever!
> Unfortunately it doesn't work -- groff won't allow me to set the
> escape character to a control one,

It does, but it has to be a valid input character.

groff(7):
       On a machine using the ISO 646, 8859, or 10646 character
       encodings, invalid input characters are 0x00, 0x08, 0x0B,
       0x0D–0x1F, and 0x80–0x9F.  On an EBCDIC host, they are 0x00–0x01,
       0x08, 0x09, 0x0B, 0x0D–0x14, 0x17–0x1F, and 0x30–0x3F.  Some of
       these code points are used by troff internally, making it non‐
       trivial to extend the program to accept UTF‐8 or other encodings
       that use characters from these ranges.

Thus:

$ printf '.ec \002\n.nr onf 987\nonf=\002n[onf]\n' | nroff | cat -s
onf=987

> and I cannot use some obscure unicode glyph because it must be
> ASCII... I could disable escaping, but that seems to break embedding
> comments etc. from what I've tried.

Yes.  Since comments are a form of escape sequence, disabling the escape
character makes them inaccessible.

There are other forms of commenting, however.  A popular and traditional
one is the `ig` request.

groff(7):
       .ig       Ignore input (except for side effects of \R on auto‐
                 incrementing registers) until “..” occurs at the start
                 of a control line in the current conditional block.
       .ig end   Ignore input (except for side effects of \R on auto‐
                 incrementing registers) until .end is called at the
                 start of a control line in the current conditional
                 block.

Using `ig` is very much like defining a macro whose contents get thrown
away.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature

Reply via email to