Consolidated list processing to a single loop in mdoc_validate.c. This
relieves having to repeat running over the argument list in
mdoc_action.c and mdoc_validate.c.
Default to LIST_item for type-less lists (groff technically doesn't do
this: it just ignores the `It' lines altogether).
Fixed condition of `\}' closing a conditional at the start of the line.
Fixed flushed-out condition of \} causing subsequent arguments to be
truncated, when in fact the whole line should be passed through (if the
conditional succeeds) to the front-end and the \} ignored there.
Cleanup post_bl_head() to use enum mdoc_list (avoid traversing that
list).
Reverted MANDOC_COLUMNS to be a bad-bad syntax error: we don't, and
apparently never have, allowed mixing of -column syntaxes. This would
have segfaulted if encountered.
Clean up the validation code for `It' macros: use enum mdoc_list
instead of iterating over arguments and only scan with `-column', which
needs the count of arguments.
Macro lines now infer an `It' if they immediately follow a `Bl -column'
or a closed-out `It' block within a `Bl -column' (which only happens
when a macro or free-form text is encountered prior to an `It').
Add ability to interpret initial free-form lines as part of a `Bl
-column' up until the first `It'. This is UGLY and should have all
sorts of warnings, and will. On the one hand, it fits with groff's
notion of tabs and tab-spaces. On the other hand, it's not really
"free-form" text any more. Note that this does not yet accomodate for
macros coming on these lines.
Add `Ta' macro, which is basically a NULL case everywhere but in
mdoc_macro.c, where it closes out an existing `It' body scope and opens
a new one, then continues parsing as in phrase() (TODO: merge these
two?).
Fix where scope-breaking was silently just dying instead of printing an
error.
Fix where trailing `Ta' or tab weren't creating a new MDOC_BODY context.
We now support arbitrarily complex `It' contents for `Bl -column'.
Tweak regression so it doesn't puke on the groff behaviour (allowing
open scopes to migrate across tabs) that we probably won't support and
is well-known.
Migrate `Bl -column' phrases to be MDOC_BODY instead of MDOC_HEAD. This
will make it easy for re-entrant parsing of `Ta' macros to fit in with
standard closure rules.
Added some more regressions for `Bl -column'. Note that one should
fail, as documented in the TODO file.
Final word on lac/ac. Document flow as it relates to phrasing, as I'll
be changing this around and want a record in CVS of what was happening
beforehand.
First in several iterative patches in getting complex -column lists
supported (which works but is tricky enough that it should be broken
down into digestable parts). This simply moves around the propogation
of ARGS_PEND into one recognised by phrase().
Give libroff an extremely simple table-lookup instead of iterating over
each and every macro. The table keys on the first character then walks
a chain. Good enough for now.
Adding `Ar' regression for empty-prior-closing-punctuation checkin.
NOTE: this will not work on old groff, which forgets to print `file ...'
when encountering an empty Ar node.
Commit of patch floated on discuss@ a few days ago: if an in_line scope
has not been opened and closing punctuation is encountered AND the macro
is marked as accepting no-content (or `Li'), then open an empty scope.
Added regression tests for `Fl' and `Li' testing this behaviour.
Also, squeeze hyph0.in tests into the last characters of each line so
that groff doesn't hyphenate and break the test.
Smarten BADCHAR check to allow ASCII_HYPH.
Fix index.sgml not to puke (the relevant section will be re-written for the release anyway, but I hate seeing errors).
Modified version of Ingo Schwarze's patch for hyphen-breaking.
Breakable hyphens are cued in the back-ends (with ASCII_HYPH) and acted
upon in term.c or ignored in html.c.
Also cleaned up XML decl printing (no need for extra vars).
Ingo Schwarze [Mon, 24 May 2010 22:25:58 +0000 (22:25 +0000)]
provide stubs to ignore .ds, .rm and .tr,
which occur in the standard pod2man preamble;
from OpenBSD;
"sounds good" joerg@, "can be checked in" kristaps@
Ingo Schwarze [Mon, 24 May 2010 21:51:20 +0000 (21:51 +0000)]
sync to OpenBSD:
save the visual cursor position in term_flushln()
and use that to avoid multiple blank lines in nested lists while
still putting subsequent empty list tags each on their own line;
"go ahead" kristaps@
Ingo Schwarze [Mon, 24 May 2010 21:34:16 +0000 (21:34 +0000)]
Handle literal tab characters both in literal context (.Bd -literal)
and outside. In literal context, tab stops are at each eigth column;
outside, they are at each fifth column.
from OpenBSD mdoc_term.c rev. 1.75;
"commit" kristaps@
Ingo Schwarze [Mon, 24 May 2010 13:39:47 +0000 (13:39 +0000)]
rewrite the main mdoc text parser, mdoc_ptext(),
making it easier to understand and fixing various bugs:
* correctly strip whitespace from the end of text lines
* issue consistent warnings regarding trailing spaces and tabs
* escaped backslashes no longer escape the following character
ok kristaps@
Increase performance by stashing the list type in struct mdoc_node.
This will eventually be used so that mdoc_macro can known whether to
dump list line arguments into the body (`Bl -column' overflowing).
Remove a2list() and arg_listtype() because of this.
Ingo Schwarze [Mon, 17 May 2010 02:03:49 +0000 (02:03 +0000)]
The function term_flushln() had effectively forked in OpenBSD.
This is the bsd.lv part of the main step to bring it back in sync.
At the same time, this prevents trailing whitespace in the output:
We delay writing blanks until we are sure printable characters follow.
This is achieved by
* remembering the end of the word instead of its length
* and not using vbl any longer for the control of line breaking
* such that vbl can sum up all kinds of white space
* before writing a word, printing all the blanks collected in vbl
* within the word, adding NBSP chars to vbl, then continuing with the word
* after the word, adding blanks to vbl, then starting the next word
Full support for ie/el. This completes the initial roff support.
Added test files for ie/el.
Using `if 0' as a baseline for "false" roff instructions instead of `if t'.
libroff now is aware of which sub-nodes should be interpreted even in a
conditional-negative context so as to preserve structural integrity.
Initial "rules" (deny/allow) are now inherited for future work in
evaluating conditionals.
Support for the general case of `if', which will boil out into other
constructs: single-level and multi-level blocks; nested, varied-level
blocks; recalculating buffer (begin) boundaries pushed correctly into
the back-ends, and so on. This will allow, once conditions are turned
on, for things like `.ie n .TH FOO 1' then `.el .Dd Mdocdate'. Read
it and weep.
Allow roff_parseln() to be re-run.
Allow roff_parseln() to manipulate the line buffer offset. This is used
in situations like `.ie n .TH FOO 1' or `.ie n .ie n', where the line
buffer offset is recalculated then the roff parser re-run.
Fix mdoc_parseln() and man_parseln() to accept the initial line offset.
WARNING: backed-out ALL roff macros whilst accomodating for how roff
handles multi-line conditionals (in short, re-running the parser).