CVS log for mandoc/tbl.h

[BACK] Up to [cvsweb.bsd.lv] / mandoc

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.4 / (download) - annotate - [select for diffs], Wed Jul 16 14:33:08 2025 UTC (4 weeks, 5 days ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +8 -8 lines
Diff to previous 1.3 (colored)

In 2009, kristaps@ decided that using EN as the basic unit for
horizontal widths on terminal output devices was the simplest option.
It made sense because one EN is the smallest possible horizontal
cursor movement on a terminal.  In 2014, kristaps@ implemented the 'u'
unit (BU, "basic unit") for scaled width input as 1/24 EN, but all
internal variables continued to store widths in units of EN.

This causes compatibility problems with groff, which internally
represents widths in units of BU rather than EN.  Various high-level
macros internally calculate sums of user-controlled widths with a
sub-EN precision.  In mandoc, the coarse internal representation
causes rounding errors, in some cases resulting in wrong indentations.

Fix this by changing many internal variables in the terminal formatter
to store widths in units of BU instead of EN, improving compatibility.

An example of a manual page where mandoc output becomes more
compatible with groff output is clang(1) - a page generated by the
atrocious rst2man(1) tool, which insists, among other insanity, on
indenting by non-integer multiples of EN.

This patch includes the following related changes:
* The termp.advance and endline functions now update termp.viscol.
* Rename termp.width to termp.getwidth to help grep(1).
* Delete term_hen() which becomes the same as term_hspan().
* Delete the unused struct termp_tbl.
* Delete the unused tbl_sulen functions.

In the tbl_term formatter, pass an additional coloff argument to
all the data and fill functions, to deal with mismatches between
the desired and the actual cursor position: the desired position
is now maintained with BU precision, but the actual position is of
course still an integer multiple of EN.

Also simplify tbl_literal() by leaving TERMP_CENTER and TERMP_RIGHT
adjustment to term_flushln(), which already contains code for that
very purpose.

We are really lucky to have the regress/ test suite.  Without it,
tricky and pervasive low-level refactoring of this kind would be
impossible because it would unavoidably cause lots of regressions.

Revision 1.3 / (download) - annotate - [select for diffs], Sun Jan 5 18:14:39 2025 UTC (7 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.2: +1 -2 lines
Diff to previous 1.2 (colored)

In the tbl(7) layout parser, use the roff(7) numerical expression parser
to support arithmetic operations in column width modifiers.

Documentation authors ought to focus on semantic markup and avoid trying
to manipulate presentational details.  Consequently, using tbl(7) is
discouraged in the first place, using column width modifiers even more
so, and complicating them by performing arithmetics yet more so.

However, the madhouse called DocBook relies on this feature.
For example, DocBook XSL version 1.79.2 generates man(7)+tbl(7) code
that abuses arithmetics in column width modifiers to format things
as simple and mundane as numbered lists, resulting in atrocious layout
that is very hard to read.  Last year, tb@ reported git-reset(1)
as an example of an affected manual page.

Properly parsing the width in the tbl(7) parser allows removal of some
incomplete ad-hoc parsing from the tbl(7) formatter, where it didn't
really belong.

Revision 1.2 / (download) - annotate - [select for diffs], Tue Aug 10 12:55:04 2021 UTC (4 years ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_6
Changes since 1.1: +3 -4 lines
Diff to previous 1.1 (colored)

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.

Revision 1.1 / (download) - annotate - [select for diffs], Wed Dec 12 21:54:35 2018 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_5

Cleanup, no functional change:
No need to expose the tbl(7) syntax tree data structures everywhere.
Move them to their own include file, "tbl.h", and improve comments.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb