From eaf84848c463416967ecacc10a55630fcf7f115c Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 10 Aug 2021 12:55:03 +0000 Subject: Support two-character font names (BI, CW, CR, CB, CI) in the tbl(7) layout font modifier. Get rid of the TBL_CELL_BOLD and TBL_CELL_ITALIC flags and use the usual ESCAPE_FONT* enum mandoc_esc members from mandoc.h instead, which simplifies and unifies some code. While here, also support CB and CI in roff(7) \f escape sequences and in roff(7) .ft requests for all output modes. Using those is certainly not recommended because portability is limited even with groff, but supporting them makes some existing third-party manual pages look better, in particular in HTML output mode. Bug-compatible with groff as far as i'm aware, except that i consider font names starting with the '\n' (ASCII 0x0a line feed) character so insane that i decided to not support them. Missing feature reported by nabijaczleweli dot xyz in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=992002. I used none of the code from the initial patch submitted by nabijaczleweli, but some of their ideas. Final patch tested by them, too. --- regress/roff/esc/f.out_html | 2 +- regress/roff/ft/badargs.out_html | 7 ++++--- regress/tbl/mod/Makefile | 11 ++++++----- regress/tbl/mod/badfont.in | 12 +++++++----- regress/tbl/mod/badfont.out_ascii | 13 +++++++------ regress/tbl/mod/badfont.out_lint | 5 +++-- regress/tbl/mod/font-eol.in | 13 +++++++++++++ regress/tbl/mod/font-eol.out_ascii | 13 +++++++++++++ regress/tbl/mod/font-eol.out_lint | 1 + regress/tbl/mod/font.out_lint | 1 - 10 files changed, 55 insertions(+), 23 deletions(-) create mode 100644 regress/tbl/mod/font-eol.in create mode 100644 regress/tbl/mod/font-eol.out_ascii create mode 100644 regress/tbl/mod/font-eol.out_lint (limited to 'regress') diff --git a/regress/roff/esc/f.out_html b/regress/roff/esc/f.out_html index 887175f6..30f5c7e1 100644 --- a/regress/roff/esc/f.out_html +++ b/regress/roff/esc/f.out_html @@ -1,4 +1,4 @@ numbers: bolditalicbolditalicroman letters: bolditalicbackbolditalicroman multiletter: boldemptyitalicbackbolditalicroman -typewriter: romanboldromanitalicroman +typewriter: romanboldromanitalicroman diff --git a/regress/roff/ft/badargs.out_html b/regress/roff/ft/badargs.out_html index a332e3a2..686ca476 100644 --- a/regress/roff/ft/badargs.out_html +++ b/regress/roff/ft/badargs.out_html @@ -1,6 +1,7 @@
default font italic bold italic - typeqriter roman bold - italic bold still bold italic back to - bold back to italic + typeqriter roman + bold italic + bold still bold italic back to bold back to + italic
diff --git a/regress/tbl/mod/Makefile b/regress/tbl/mod/Makefile index 96547d64..7bbf30e5 100644 --- a/regress/tbl/mod/Makefile +++ b/regress/tbl/mod/Makefile @@ -1,15 +1,16 @@ -# $OpenBSD: Makefile,v 1.2 2015/02/10 11:02:19 schwarze Exp $ +# $OpenBSD: Makefile,v 1.6 2021/08/10 12:36:42 schwarze Exp $ -REGRESS_TARGETS = badfont expand expand-toowide font misalign spacing width -LINT_TARGETS = badfont font +REGRESS_TARGETS = badfont expand expand-toowide font font-eol +REGRESS_TARGETS += misalign spacing width +LINT_TARGETS = badfont font font-eol -# groff-1.22.3 defects: +# groff-1.22.4 defects: # - The "f" font modifier swallows a following newline character. # - When space is insufficient (on either side) for properly aligning # a number, GNU tbl(1) moves the number too much to the right, # overflowing the column, even if space would be sufficient without # left padding. -SKIP_GROFF = badfont misalign +SKIP_GROFF = font-eol misalign .include diff --git a/regress/tbl/mod/badfont.in b/regress/tbl/mod/badfont.in index 2a4f0d0a..12303149 100644 --- a/regress/tbl/mod/badfont.in +++ b/regress/tbl/mod/badfont.in @@ -1,15 +1,17 @@ -.\" $OpenBSD: badfont.in,v 1.2 2017/07/04 14:53:27 schwarze Exp $ -.TH TBL-MOD-BADFONT 1 "February 10, 2015" +.\" $OpenBSD: badfont.in,v 1.3 2021/08/10 12:36:42 schwarze Exp $ +.TH TBL-MOD-BADFONT 1 "August 9, 2021" .SH NAME tbl-mod-badfont \- invalid font modifiers in table layouts .SH DESCRIPTION normal text .TS box tab(:); -lfB lf +lfI lfX +lfB lfIB lfI lf. lfB lfI. -bold:none -italic:none +italic:one char +bold:two chars +italic:dot bold:italic .TE diff --git a/regress/tbl/mod/badfont.out_ascii b/regress/tbl/mod/badfont.out_ascii index 43683330..4cd3bd3f 100644 --- a/regress/tbl/mod/badfont.out_ascii +++ b/regress/tbl/mod/badfont.out_ascii @@ -6,9 +6,10 @@ NNAAMMEE DDEESSCCRRIIPPTTIIOONN normal text - +----------------+ - |bboolldd none | - |_i_t_a_l_i_c none | - |bboolldd _i_t_a_l_i_c | - +----------------+ -OpenBSD February 10, 2015 TBL-MOD-BADFONT(1) + +-------------------+ + |_i_t_a_l_i_c one char | + |bboolldd two chars | + |_i_t_a_l_i_c dot | + |bboolldd _i_t_a_l_i_c | + +-------------------+ +OpenBSD August 9, 2021 TBL-MOD-BADFONT(1) diff --git a/regress/tbl/mod/badfont.out_lint b/regress/tbl/mod/badfont.out_lint index c19bae82..7884ec88 100644 --- a/regress/tbl/mod/badfont.out_lint +++ b/regress/tbl/mod/badfont.out_lint @@ -1,2 +1,3 @@ -mandoc: badfont.in:9:7: WARNING: unknown font, skipping request: TS f -mandoc: badfont.in:10:7: WARNING: unknown font, skipping request: TS f. +mandoc: badfont.in:9:7: WARNING: unknown font, skipping request: TS fX +mandoc: badfont.in:10:7: WARNING: unknown font, skipping request: TS fIB +mandoc: badfont.in:11:7: WARNING: unknown font, skipping request: TS f. diff --git a/regress/tbl/mod/font-eol.in b/regress/tbl/mod/font-eol.in new file mode 100644 index 00000000..fadf66ec --- /dev/null +++ b/regress/tbl/mod/font-eol.in @@ -0,0 +1,13 @@ +.\" $OpenBSD: font-eol.in,v 1.1 2021/08/10 12:36:42 schwarze Exp $ +.TH TBL-MOD-FONT-EOL 1 "August 9, 2021" +.SH NAME +tbl-mod-font-eol \- font modifier at eol in table layout +.SH DESCRIPTION +normal text +.TS +box tab(:); +lfB lf +lfB lfI. +bold:none +bold:italic +.TE diff --git a/regress/tbl/mod/font-eol.out_ascii b/regress/tbl/mod/font-eol.out_ascii new file mode 100644 index 00000000..c87d5aba --- /dev/null +++ b/regress/tbl/mod/font-eol.out_ascii @@ -0,0 +1,13 @@ +TBL-MOD-FONT-EOL(1) General Commands Manual TBL-MOD-FONT-EOL(1) + +NNAAMMEE + tbl-mod-font-eol - font modifier at eol in table layout + +DDEESSCCRRIIPPTTIIOONN + normal text + + +--------------+ + |bboolldd none | + |bboolldd _i_t_a_l_i_c | + +--------------+ +OpenBSD August 9, 2021 TBL-MOD-FONT-EOL(1) diff --git a/regress/tbl/mod/font-eol.out_lint b/regress/tbl/mod/font-eol.out_lint new file mode 100644 index 00000000..c7f83f34 --- /dev/null +++ b/regress/tbl/mod/font-eol.out_lint @@ -0,0 +1 @@ +mandoc: font-eol.in:9:7: WARNING: unknown font, skipping request: TS f diff --git a/regress/tbl/mod/font.out_lint b/regress/tbl/mod/font.out_lint index 06046a43..7ddd6280 100644 --- a/regress/tbl/mod/font.out_lint +++ b/regress/tbl/mod/font.out_lint @@ -1,4 +1,3 @@ -mandoc: font.in:9:6: WARNING: unknown font, skipping request: TS fCW|ci mandoc: font.in:19:2: WARNING: tab in filled text mandoc: font.in:19:4: WARNING: tab in filled text mandoc: font.in:19:6: WARNING: tab in filled text -- cgit