groff
[Top][All Lists]
Advanced

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

[Groff] mdoc: correct .Fl font restore


From: Ingo Schwarze
Subject: [Groff] mdoc: correct .Fl font restore
Date: Mon, 9 Jul 2012 17:22:25 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

while working on the automatic test suite for mandoc(1)
comparing its output against groff(1), i noticed that
the .Fl macro in the groff_mdoc(7) suite doesn't correctly
restore the font if its arguments have switched the font.
Admittedly, switching the font in .Fl arguments is rather
bad mdoc(7) style, but i think the macros should behave
correctly even for mildly weird input, in particular for
issues that are easy to fix.

Here is a test case:

.Dd July 9, 2012
.Dt FL-FONT 1
.Os
.Sh NAME
.Nm Fl-font
.Nd changing fonts inside the flag macro
.Sh DESCRIPTION
normal text
.Fl bold\\fIemphasis\\fPback
trailing text

Currently, the "trailing text" will be emphasized
because .Fl does \f[] on exit instead of restoring the font.
With the patch below, the "trailing text" will be rendered
as normal text, as it should.

There are some more cases of "\f[]\s[0]" in the definition
of the .Fl macro, but as far as i understand, those do not
need to be changed because they cannot be reached after
processing text provided by the user.

Greetings from the OpenBSD general hackathon in Budapest,
  Ingo

P.S.
Regarding the VCS, i think in a project having basically
one or two active committers and not using branches at
all, anything more complicated than CVS is overkill.
I certainly wouldn't like to install bazaar just to be
able to send my occasional groff patches.


Index: tmac/doc.tmac
===================================================================
RCS file: /sources/groff/groff/tmac/doc.tmac,v
retrieving revision 1.43
diff -u -p -r1.43 doc.tmac
--- tmac/doc.tmac       8 Oct 2011 09:11:22 -0000       1.43
+++ tmac/doc.tmac       9 Jul 2012 15:04:35 -0000
@@ -438,7 +438,7 @@
 .      \" last argument
 .      if (\n[doc-reg-dfr1] == 4) \
 .        nop \|\-\c
-.      nop \f[]\s[0]\c
+.      nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
 .      doc-print-and-reset
 .    \}
 .    el \{\



reply via email to

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