After .Sm on, spacing ought to restart right away, before the next token,
and not with a delay, after the next token. But be careful not to cause
leading white space at the beginning of a line or column.
In OpenBSD, improves chmod(1), ksh(1), tar(1), ps(1) and probably many more.
ok kristaps@ and tested by jmc@ and sobrado@
Re-constitution of `ds' symbol processing. First, push the
roff_getstr() family of functions into roff.c with the "first_string"
directly in struct roff. Second, pre-process each line for reserved
words in libroff, splicing and re-running a line if it has one (this
allows defined symbols to be macros). Remove term.c's invocation of the
roff_getstrn() function. Removed function documentation in roff.3 and
added roff.7 `ds' documentation.
Proper `Bk -words' support: only suppress breaks within a line, but
allow end-of-line to break. This fixes the bad behaviour found when
macros within `Bk' never break.
Renamed mandoc.c to libmandoc.c. This is in the efforts of getting a
cleaner namespace for functions across the entire system (mandoc.h:
getting parsed-string values, or declarations necessary for the AST
data), and compiler functions (libmandoc.h: back-end functions and
declarations).
Assert my copyright, making it explicit that i'm granting the same license
on those parts of the code and text that i have written as Kristaps is.
"fine with me" kristaps@
gv(1) doesn't remember the last set font when displaying new pages, so
print it out for each new page. This also prevents superfluous
printings of the font before the %%Page: comment has been displayed.
Rudimentary implementation of user-defined strings;
no time for more refinement right now.
In particular, fixes terminfo(3) and mdoc.samples(7).
ok kristaps@, who will add the HTML frontend bits
Not only for -tag lists, but for -hang, -ohang, -inset, -diag,
and -item list as well, empty bodies are OK, they do not even
warrant a warning, much less the error they were throwing.
According to kristaps, joerg@ also brought this up some time ago.
ok kristaps@ jmc@
Make struct_bl and struct_bd into pointers. This removes the need to do
copying on internals after modification. Even more importantly, if an
ENDBODY token is provided, it would have been impossible for post-change
copying of the data to take place in the BLOCK. This allows it to
happen by dint of pointers.
Also did some bikeshedding in mdoc_term.c: checking against enum type
and explicitly casting to the "post" function to void. This is for my
own readability.
In the mdoc(7) parser, inspect roff registers early such that all parts
of the parser can use the resulting cues. In particular, this allows
to use .nr nS to force SYNOPSIS-style .Nm indentation outside the
SYNOPSIS as needed by ifconfig(8).
To actually make this useable, .Pp must rewind .Nm, or the rest of the
section would end up indented. Implement a quick hack for now,
a generic solution can be designed later.
Correct handling of trailing punctuation in MDOC_DELIM blk_full HEADs.
The bug was uncovered by SYNOPSIS .Nm as this happened to be the first
block with this particular combination of properties.
Found the hard way by kristaps@ in NetBSD gcc-contrib(1),
fix by me.
Improve .Nm indentation in the SYNOPSIS;
kristaps@ will do the missing HTML part soon.
"looks nicer" jmc@
"seems perfect to me" sobrado@
"slap it in" kristaps@
First, I'm defaulting to 11-point font, which renders much nicer (the
"Internet" vaguely suggests using 11- or 9-Point for serifed fonts).
This verified on GNU/Linux, Mac OSX, Windows, and OpenBSD. Noted in
mandoc.1.
Then added a3, a4, a5, letter, legal, and custom page dimensions. These
seem to be the main players. Noted in mandoc.1.
Ingo Schwarze [Wed, 30 Jun 2010 20:32:15 +0000 (20:32 +0000)]
improve error reporting:
* avoid error exit code after mere warnings
* add ERROR: and FATAL: to messages when appropriate
* sort the code in mmsg() to make it easier on the eye
* make the mandocerrs[] list easier to maintain
* update a few comments in mandoc.h
ok kristaps@
Ingo Schwarze [Wed, 30 Jun 2010 04:05:02 +0000 (04:05 +0000)]
Closing of full blocks (Bd Bf Bk Bl It Fo Nd Rs Sh Ss) may never be
delayed: It must either succeed right away or fail outright.
As noticed by Kristaps, neglecting to fail properly when required
could make invalid input screw up the syntax tree and ultimately
trigger assertions in other, unrelated parts of the program.
This fix tested by and OK by kristaps@.
While here, comment the rather tricky function rew_dohalt().
This function will probably need more tweaks later on.
Ingo Schwarze [Tue, 29 Jun 2010 19:24:14 +0000 (19:24 +0000)]
Considerably simplify block rewind rules; no functional change intended.
* Let rew_alt() always succeed, obsoleting tons of case statements.
* Merge rew_dobreak() into rew_dohalt().
* Encode all rewinding cases uniformly in terms of "enum rew".
Required because i'm too dumb to get SYNOPSIS .Nm rewinding right
without cleaning this up first.
Ingo Schwarze [Tue, 29 Jun 2010 19:20:38 +0000 (19:20 +0000)]
Support for badly nested blocks, written around the time of
the Rostock mandoc hackathon and tested and polished since,
supporting constructs like:
.Ao Bo Ac Bc (exp breaking exp)
.Aq Bo eol Bc (imp breaking exp)
.Ao Bq Ac eol (exp breaking imp)
.Ao Bo So Bc Ac Sc (double break, inner before outer)
.Ao Bo So Ac Bc Sc (double break, outer before inner)
.Ao Bo Ac So Bc Sc (broken breaker)
.Ao Bo So Bc Do Ac Sc Dc (broken double breaker)
There are still two known issues which are tricky:
1) Breaking two identical explicit blocks (Ao Bo Bo Ac or Aq Bo Bo eol)
fails outright, triggering a bogus syntax error.
2) Breaking a block by two identical explicit blocks (Ao Ao Bo Ac Ac Bc
or Ao Ao Bq Ac Ac eol) still has a minor rendering error left:
"<ao1 <ao2 [bo ac2> ac1> bc]>" should not have the final ">".
We can fix these later in the tree, let's not grow this diff too large.
Remove some incorrect data from mandoc.1 (that of non-macro lines and
spacing, which is for mdoc.7/man.7 anyway). Also document -Opage=xxx
and push the per-output options into the output subsections. Makes the
manual shorter and more readable.
Add in -Opaper=xxx support for -Tps postscript. This doesn't have any
functional changes beyond the getsubopt() parse in term_ps.c. If you
want to test this (it only does -Opaper=a4 and -Opaper=letter; adding
more is trivial), make sure you specify (e.g.) -sPAPERSIZE=a4 to gs(1).
Give -Tps better PostScript hinting. Note that we're using Adobe-3.0
constructs. Push the stupid CPP defines for page boundaries and margins
into proper variables. Give enum termfont a proper TERMFONT__MAX.
Clean-up of variable-width glyph support. Adds no new code; only
restructured to make a bit more readable. Also removed an unused entry
in the PS engine structure.
This enables variable glyph-width output. The checkin will be followed
by a [functionless] clean-up in term_ps.c, but this makes the
appropriate changes to "enable" initial proportional-width functionality
in term.c and fixes some areas of term_ps.c that were causing errors.
Tiny commit clarifying flushln() documentation as to what refers to
visual screen output and what's an array index (getting closer to
variable-width fonting).
Ingo Schwarze [Sun, 27 Jun 2010 17:53:27 +0000 (17:53 +0000)]
minor .Bk fixes:
* do not print invalid arguments verbatim (no groffs prints them, either)
* do not trigger TERMP_PREKEEP twice
* do not die from invlid arguments (groff won't die, either)
* continue to ignore even valid arguments (just like groff)
ok kristaps@ on the previous version, before removing my last bug ;)
First step of adding register support. This is inspired by a significant
patch by schwarze@. This commit adds support to libroff parsing `nr'
into register set defined in regs.h. This will propogate into libmdoc
and libman in later commits.
Remove "pt" from struct roffsu, as CSS (the only reason it was there) is
unclear about which units accept floats/integers, which leads me to
assume that it handles either and rounds as appropriate.
Initial chunks for variable-width fonts. Pushes all width calculations
in mdoc_term.c and man_term.c down into term.c. This is still not
implemented in term.c, although stubs for width calculations are in
place. From now on, offset, rmargin, and other layout variables are
abstract screen widths. They will resolve to the the familiar values
for -Tascii but -Tps will eventually use points instead of chars.
Allow -width for lists to be cached in mdoc_bl. This requires some
trickery because widths may be on-the-fly recalculated. I don't like
how these are split between mdoc_action.c and mdoc_validate.c, but for
the time being, it'll do.
Cached `Bl -offset' into mdoc_bl. Removed erroneous "-offset defaults
to 6n if no value is specified" and added regression tests for `Bl'
testing against the empty -offset argument.
Reverted to mdoc_term.c 1.149 (`It' does not inherit `Bl's cache,
obviously, which was causing fallout) and again remove the loop code.
Tested more thoroughly.
Removed stipulation that an empty `Bd -offset' will default to 6n. Not
sure where this came about. Added regression tests to convince myself
that this is so. Also consolidated COMPATIBILITY notes regarding `Bd'.
Added COMPATIBILITY note to the effect that old groff pukes on `Bd
-compact -ragged' (regression test will fail on old groff).
Cache all of `Bd's resolved arguments into mdoc_bd, which is stashed in
the "data" union in mdoc_node. Allows me to remove some ugly loops in
the front-end and duplicate tests in mdoc_action.c. Add a regression
test to make sure we're not doing anything bad (more to come).