tbl: make unrecognized column mods less lethal #739
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
src/cmd/tbl: add
warn()functionUp to this point, tbl has had no nonfatal diagnostics. A forthcoming
change requires one.
src/cmd/tbl/t4.c: be robust to extensions
DWB 3.3 tbl and GNU tbl support an 'x' column modifier. (Heirloom
Doctools tbl and mandoc(1) also support it.) Plan 9 tbl aborts
processing of the entire input document if it encounters this characater
in a table description.
That's overkill; it's safe to ignore that modifier if it really is a
modifier, and the column descriptor has a classifier already, like 'L'
or 'N'. The
sawcharlocal variable, of Boolean sense, inreadspec()appears to indicate that fact.
Many man pages in the wild, such as those of ncurses, use the 'x'
modifier; while this change doesn't make Plan 9 tbl implement the
extension, it does help Plan 9 render such pages on a best-effort basis.
Extending this toleration also permits man page authors to wangle a
portable hack into their pages by specifying an explicit width followed
by the 'x' modifier that implementations supporting it will honor
(example: 'Lw(22n)x').
The GNU tbl(1) man page says:
Heirloom Doctools and mandoc(1) behave compatibly with the foregoing
description.
Before:
After:
I confess to using my own terminology rather than Mike Lesk's. See
https://man7.org/linux/man-pages/man1/tbl.1.html.