History log of /openbsd-current/usr.bin/mandoc/roff_validate.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.19 27-Feb-2020 schwarze

Introduce the concept of nodes that are semantically transparent:
they are skipped when looking for previous or following high-level
macros. Examples include roff(7) .ft, .ll, and .ta, mdoc(7) .Sm
and .Tg, and man(7) .DT and .PD. Use this concept for a variety
of improved decisions in various validators and formatters.

While here,
* remove a few const qualifiers on struct arguments that caused trouble;
* get rid of some more Yoda notation in the vicinity;
* and apply some other stylistic improvements in the vicinity.

I found this class of issues while considering .Tg patches from kn@.


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.18 31-Dec-2018 schwarze

oops, one change ROFF_NOFILL -> NODE_NOFILL was forgotten in rev. 1.17


# 1.17 31-Dec-2018 schwarze

Use the new flag NODE_NOFILL in the validators, which is sometimes
simpler and always more robust. In particular, move the nesting
warnings for .EX and .EE from man_state(), where they were misplaced,
to the man(7) validator.


# 1.16 31-Dec-2018 schwarze

Move parsing of the .nf and .fi (fill mode) requests from the man(7)
parser to the roff(7) parser. As a side effect, .nf and .fi are
now also parsed in mdoc(7) input, though the mdoc(7) formatters
still ignore most of their effect.


# 1.15 15-Dec-2018 schwarze

Yet another round of improvements to manual font selection.

Unify handling of \f and .ft.
Support \f4 (bold+italic).
Support ".ft BI" and ".ft CW" for terminal output.
Support the .ft request in HTML output.
Reject the bogus fonts \f(C1, \f(C2, \f(C3, and \f(CP.


# 1.14 14-Dec-2018 schwarze

Almost mechanical diff to remove the "struct mparse *" argument
from mandoc_msg(), where it is no longer used.
While here, rename mandoc_vmsg() to mandoc_msg() and retire the
old version: There is really no point in having another function
merely to save "%s" in a few places.
Minus 140 lines of code.


# 1.13 14-Dec-2018 schwarze

Major cleanup; may imply minor changes in edge cases of error reporting.

Finally, drop support for the run-time configurable mandocmsg()
callback. It was over-engineered from the start, never used for
anything in a decade, and repeatedly caused maintenance headaches.

Consolidate reporting infrastructure into two files, mandoc.h and
mandoc_msg.c, mopping up the bits and pieces that were scattered
around main.c, read.c, mandoc_parse.h, libmandoc.h, the prototypes
of four parsing-related functions, and both parser structs.


# 1.12 04-Dec-2018 schwarze

During validation, drop .br before a text line starting with a
blank, rather than teaching each formatter individually to ignore
the .br in such situations. That's simpler and also results in
better diagnostics.

Mark Harris <mark dot hsj at gmail dot com> reported
that -T html got confused in particular.


# 1.11 04-Dec-2018 schwarze

Clean up the validation of .Pp, .PP, .sp, and .br. Make sure all
combinations are handled, and are handled in a systematic manner.
This resolves some erratic duplicate handling, handles a number of
missing cases, and improves diagnostics in various respects.

Move validation of .br and .sp to the roff validation module
rather than doing that twice in the mdoc and man validation modules.
Move the node relinking function to the roff library where it belongs.

In validation functions, only look at the node itself, at previous
nodes, and at descendants, not at following nodes or ancestors,
such that only nodes are inspected which are already validated.


Revision tags: OPENBSD_6_4_BASE
# 1.10 10-Aug-2018 schwarze

The groff man-ext macros define fonts CB, CI, and CR,
and some groff manual pages actually use them in .ft requests.
It's easy enough to handle these .ft requests in mandoc, too.


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.9 14-Jun-2017 schwarze

Naive implementation of the roff(7) .po (page offset) request.

This clearly works when .po is called on the top level, but might
not be sophisticated enough if people call .po inside indentation-changing
contexts, but i haven't seen that in manual pages (yet :).


# 1.8 14-Jun-2017 schwarze

implement roff(7) .rj (right justify) request


# 1.7 06-Jun-2017 schwarze

Minimal implementation of the roff(7) .ce request (center a number
of input lines without filling).
Contrary to groff, high-level macros abort .ce mode for now.


# 1.6 04-Jun-2017 schwarze

Implement the roff(7) .mc (right margin character) request.
The Tcl/Tk manual pages use this extensively.
Delete the TERM_MAXMARGIN hack, it breaks .mc inside .nf;
instead, implement a proper TERMP_BRNEVER flag.


# 1.5 08-May-2017 schwarze

Basic implementation of the roff(7) .ti (temporary indent) request.
Needed by about four dozen ports (thanks to naddy@ for the research).


# 1.4 07-May-2017 schwarze

Basic implementation of the roff(7) .ta (define tab stops) request.
This is the first feature made possible by the parser reorganization.
Improves the formatting of the SYNOPSIS in many Xenocara GL manuals.
Also important for ports, as reported by many, including naddy@.


# 1.3 05-May-2017 schwarze

Move .sp to the roff modules. Enough infrastructure is in place
now that this actually saves code: -70 LOC.


# 1.2 05-May-2017 schwarze

move .ll to the roff modules


# 1.1 05-May-2017 schwarze

Move handling of the roff(7) .ft request from the man(7)
modules to the new roff(7) modules. As a side effect,
mdoc(7) now handles .ft, too. Of course, do not use that.


# 1.18 31-Dec-2018 schwarze

oops, one change ROFF_NOFILL -> NODE_NOFILL was forgotten in rev. 1.17


# 1.17 31-Dec-2018 schwarze

Use the new flag NODE_NOFILL in the validators, which is sometimes
simpler and always more robust. In particular, move the nesting
warnings for .EX and .EE from man_state(), where they were misplaced,
to the man(7) validator.


# 1.16 31-Dec-2018 schwarze

Move parsing of the .nf and .fi (fill mode) requests from the man(7)
parser to the roff(7) parser. As a side effect, .nf and .fi are
now also parsed in mdoc(7) input, though the mdoc(7) formatters
still ignore most of their effect.


# 1.15 15-Dec-2018 schwarze

Yet another round of improvements to manual font selection.

Unify handling of \f and .ft.
Support \f4 (bold+italic).
Support ".ft BI" and ".ft CW" for terminal output.
Support the .ft request in HTML output.
Reject the bogus fonts \f(C1, \f(C2, \f(C3, and \f(CP.


# 1.14 14-Dec-2018 schwarze

Almost mechanical diff to remove the "struct mparse *" argument
from mandoc_msg(), where it is no longer used.
While here, rename mandoc_vmsg() to mandoc_msg() and retire the
old version: There is really no point in having another function
merely to save "%s" in a few places.
Minus 140 lines of code.


# 1.13 14-Dec-2018 schwarze

Major cleanup; may imply minor changes in edge cases of error reporting.

Finally, drop support for the run-time configurable mandocmsg()
callback. It was over-engineered from the start, never used for
anything in a decade, and repeatedly caused maintenance headaches.

Consolidate reporting infrastructure into two files, mandoc.h and
mandoc_msg.c, mopping up the bits and pieces that were scattered
around main.c, read.c, mandoc_parse.h, libmandoc.h, the prototypes
of four parsing-related functions, and both parser structs.


# 1.12 04-Dec-2018 schwarze

During validation, drop .br before a text line starting with a
blank, rather than teaching each formatter individually to ignore
the .br in such situations. That's simpler and also results in
better diagnostics.

Mark Harris <mark dot hsj at gmail dot com> reported
that -T html got confused in particular.


# 1.11 04-Dec-2018 schwarze

Clean up the validation of .Pp, .PP, .sp, and .br. Make sure all
combinations are handled, and are handled in a systematic manner.
This resolves some erratic duplicate handling, handles a number of
missing cases, and improves diagnostics in various respects.

Move validation of .br and .sp to the roff validation module
rather than doing that twice in the mdoc and man validation modules.
Move the node relinking function to the roff library where it belongs.

In validation functions, only look at the node itself, at previous
nodes, and at descendants, not at following nodes or ancestors,
such that only nodes are inspected which are already validated.


Revision tags: OPENBSD_6_4_BASE
# 1.10 10-Aug-2018 schwarze

The groff man-ext macros define fonts CB, CI, and CR,
and some groff manual pages actually use them in .ft requests.
It's easy enough to handle these .ft requests in mandoc, too.


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.9 14-Jun-2017 schwarze

Naive implementation of the roff(7) .po (page offset) request.

This clearly works when .po is called on the top level, but might
not be sophisticated enough if people call .po inside indentation-changing
contexts, but i haven't seen that in manual pages (yet :).


# 1.8 14-Jun-2017 schwarze

implement roff(7) .rj (right justify) request


# 1.7 06-Jun-2017 schwarze

Minimal implementation of the roff(7) .ce request (center a number
of input lines without filling).
Contrary to groff, high-level macros abort .ce mode for now.


# 1.6 04-Jun-2017 schwarze

Implement the roff(7) .mc (right margin character) request.
The Tcl/Tk manual pages use this extensively.
Delete the TERM_MAXMARGIN hack, it breaks .mc inside .nf;
instead, implement a proper TERMP_BRNEVER flag.


# 1.5 08-May-2017 schwarze

Basic implementation of the roff(7) .ti (temporary indent) request.
Needed by about four dozen ports (thanks to naddy@ for the research).


# 1.4 07-May-2017 schwarze

Basic implementation of the roff(7) .ta (define tab stops) request.
This is the first feature made possible by the parser reorganization.
Improves the formatting of the SYNOPSIS in many Xenocara GL manuals.
Also important for ports, as reported by many, including naddy@.


# 1.3 05-May-2017 schwarze

Move .sp to the roff modules. Enough infrastructure is in place
now that this actually saves code: -70 LOC.


# 1.2 05-May-2017 schwarze

move .ll to the roff modules


# 1.1 05-May-2017 schwarze

Move handling of the roff(7) .ft request from the man(7)
modules to the new roff(7) modules. As a side effect,
mdoc(7) now handles .ft, too. Of course, do not use that.


# 1.15 15-Dec-2018 schwarze

Yet another round of improvements to manual font selection.

Unify handling of \f and .ft.
Support \f4 (bold+italic).
Support ".ft BI" and ".ft CW" for terminal output.
Support the .ft request in HTML output.
Reject the bogus fonts \f(C1, \f(C2, \f(C3, and \f(CP.


# 1.14 14-Dec-2018 schwarze

Almost mechanical diff to remove the "struct mparse *" argument
from mandoc_msg(), where it is no longer used.
While here, rename mandoc_vmsg() to mandoc_msg() and retire the
old version: There is really no point in having another function
merely to save "%s" in a few places.
Minus 140 lines of code.


# 1.13 14-Dec-2018 schwarze

Major cleanup; may imply minor changes in edge cases of error reporting.

Finally, drop support for the run-time configurable mandocmsg()
callback. It was over-engineered from the start, never used for
anything in a decade, and repeatedly caused maintenance headaches.

Consolidate reporting infrastructure into two files, mandoc.h and
mandoc_msg.c, mopping up the bits and pieces that were scattered
around main.c, read.c, mandoc_parse.h, libmandoc.h, the prototypes
of four parsing-related functions, and both parser structs.


# 1.12 04-Dec-2018 schwarze

During validation, drop .br before a text line starting with a
blank, rather than teaching each formatter individually to ignore
the .br in such situations. That's simpler and also results in
better diagnostics.

Mark Harris <mark dot hsj at gmail dot com> reported
that -T html got confused in particular.


# 1.11 04-Dec-2018 schwarze

Clean up the validation of .Pp, .PP, .sp, and .br. Make sure all
combinations are handled, and are handled in a systematic manner.
This resolves some erratic duplicate handling, handles a number of
missing cases, and improves diagnostics in various respects.

Move validation of .br and .sp to the roff validation module
rather than doing that twice in the mdoc and man validation modules.
Move the node relinking function to the roff library where it belongs.

In validation functions, only look at the node itself, at previous
nodes, and at descendants, not at following nodes or ancestors,
such that only nodes are inspected which are already validated.


Revision tags: OPENBSD_6_4_BASE
# 1.10 10-Aug-2018 schwarze

The groff man-ext macros define fonts CB, CI, and CR,
and some groff manual pages actually use them in .ft requests.
It's easy enough to handle these .ft requests in mandoc, too.


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.9 14-Jun-2017 schwarze

Naive implementation of the roff(7) .po (page offset) request.

This clearly works when .po is called on the top level, but might
not be sophisticated enough if people call .po inside indentation-changing
contexts, but i haven't seen that in manual pages (yet :).


# 1.8 14-Jun-2017 schwarze

implement roff(7) .rj (right justify) request


# 1.7 06-Jun-2017 schwarze

Minimal implementation of the roff(7) .ce request (center a number
of input lines without filling).
Contrary to groff, high-level macros abort .ce mode for now.


# 1.6 04-Jun-2017 schwarze

Implement the roff(7) .mc (right margin character) request.
The Tcl/Tk manual pages use this extensively.
Delete the TERM_MAXMARGIN hack, it breaks .mc inside .nf;
instead, implement a proper TERMP_BRNEVER flag.


# 1.5 08-May-2017 schwarze

Basic implementation of the roff(7) .ti (temporary indent) request.
Needed by about four dozen ports (thanks to naddy@ for the research).


# 1.4 07-May-2017 schwarze

Basic implementation of the roff(7) .ta (define tab stops) request.
This is the first feature made possible by the parser reorganization.
Improves the formatting of the SYNOPSIS in many Xenocara GL manuals.
Also important for ports, as reported by many, including naddy@.


# 1.3 05-May-2017 schwarze

Move .sp to the roff modules. Enough infrastructure is in place
now that this actually saves code: -70 LOC.


# 1.2 05-May-2017 schwarze

move .ll to the roff modules


# 1.1 05-May-2017 schwarze

Move handling of the roff(7) .ft request from the man(7)
modules to the new roff(7) modules. As a side effect,
mdoc(7) now handles .ft, too. Of course, do not use that.


# 1.10 10-Aug-2018 schwarze

The groff man-ext macros define fonts CB, CI, and CR,
and some groff manual pages actually use them in .ft requests.
It's easy enough to handle these .ft requests in mandoc, too.


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.9 14-Jun-2017 schwarze

Naive implementation of the roff(7) .po (page offset) request.

This clearly works when .po is called on the top level, but might
not be sophisticated enough if people call .po inside indentation-changing
contexts, but i haven't seen that in manual pages (yet :).


# 1.8 14-Jun-2017 schwarze

implement roff(7) .rj (right justify) request


# 1.7 06-Jun-2017 schwarze

Minimal implementation of the roff(7) .ce request (center a number
of input lines without filling).
Contrary to groff, high-level macros abort .ce mode for now.


# 1.6 04-Jun-2017 schwarze

Implement the roff(7) .mc (right margin character) request.
The Tcl/Tk manual pages use this extensively.
Delete the TERM_MAXMARGIN hack, it breaks .mc inside .nf;
instead, implement a proper TERMP_BRNEVER flag.


# 1.5 08-May-2017 schwarze

Basic implementation of the roff(7) .ti (temporary indent) request.
Needed by about four dozen ports (thanks to naddy@ for the research).


# 1.4 07-May-2017 schwarze

Basic implementation of the roff(7) .ta (define tab stops) request.
This is the first feature made possible by the parser reorganization.
Improves the formatting of the SYNOPSIS in many Xenocara GL manuals.
Also important for ports, as reported by many, including naddy@.


# 1.3 05-May-2017 schwarze

Move .sp to the roff modules. Enough infrastructure is in place
now that this actually saves code: -70 LOC.


# 1.2 05-May-2017 schwarze

move .ll to the roff modules


# 1.1 05-May-2017 schwarze

Move handling of the roff(7) .ft request from the man(7)
modules to the new roff(7) modules. As a side effect,
mdoc(7) now handles .ft, too. Of course, do not use that.


Revision tags: OPENBSD_6_2_BASE
# 1.9 14-Jun-2017 schwarze

Naive implementation of the roff(7) .po (page offset) request.

This clearly works when .po is called on the top level, but might
not be sophisticated enough if people call .po inside indentation-changing
contexts, but i haven't seen that in manual pages (yet :).


# 1.8 14-Jun-2017 schwarze

implement roff(7) .rj (right justify) request


# 1.7 06-Jun-2017 schwarze

Minimal implementation of the roff(7) .ce request (center a number
of input lines without filling).
Contrary to groff, high-level macros abort .ce mode for now.


# 1.6 04-Jun-2017 schwarze

Implement the roff(7) .mc (right margin character) request.
The Tcl/Tk manual pages use this extensively.
Delete the TERM_MAXMARGIN hack, it breaks .mc inside .nf;
instead, implement a proper TERMP_BRNEVER flag.


# 1.5 08-May-2017 schwarze

Basic implementation of the roff(7) .ti (temporary indent) request.
Needed by about four dozen ports (thanks to naddy@ for the research).


# 1.4 07-May-2017 schwarze

Basic implementation of the roff(7) .ta (define tab stops) request.
This is the first feature made possible by the parser reorganization.
Improves the formatting of the SYNOPSIS in many Xenocara GL manuals.
Also important for ports, as reported by many, including naddy@.


# 1.3 05-May-2017 schwarze

Move .sp to the roff modules. Enough infrastructure is in place
now that this actually saves code: -70 LOC.


# 1.2 05-May-2017 schwarze

move .ll to the roff modules


# 1.1 05-May-2017 schwarze

Move handling of the roff(7) .ft request from the man(7)
modules to the new roff(7) modules. As a side effect,
mdoc(7) now handles .ft, too. Of course, do not use that.