summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
AgeCommit message (Collapse)Author
2010-07-25Sync to bsd.lv; in particular, pull in lots of bug fixes.Ingo Schwarze
new features: * support the .in macro in man(7) * support minimal PDF output * support .Sm in mdoc(7) HTML output * support .Vb and .nf in man(7) HTML output * complete the mdoc(7) manual bug fixes: * do not let mdoc(7) .Pp produce a newline before/after .Sh; reported by jmc@ * avoid double blank lines related to man(7) .sp and .br * let man(7) .nf and .fi flush the line; reported by jsg@ and naddy@ * let "\ " produce a non-breaking space; reported by deraadt@ * discard \m colour escape sequences; reported by J.C. Roberts * map undefined 1-character-escapes to the literal character itself maintenance: * express mdoc(7) arguments in terms of an enum for additional type-safety * simplify mandoc_special() and a2roffdeco() * use strcspn in term_word() in place of a manual loop * minor optimisations in the -Tps and -Thtml formatting frontends
2010-07-21In the SYNOPSIS, .Nm at the beginning of an input line startsIngo Schwarze
an .Nm block, and gets special handling (new line, indentation). But .Nm in the middle of a line is just a normal in-line element, so make sure it does NOT get the special handling. Partly fixes the test(1) SYNOPSIS; indentation after "[" is still excessive, which is an unrelated and more difficult issue. Reminded of the problem by jmc@; OK kristaps@.
2010-07-19J. C. Roberts noted that Kristaps' man.7 is already better than theIngo Schwarze
old groff_man.7 we currently install. As a first step, move the new manual where it belongs, not changing any content except the OpenBSD marker. The plan is, after some polishing, to install man.7 and not install groff_man.7 any longer. jmc@, sobrado@ and kristaps@ agree
2010-07-16Text ending in a full stop, exclamation mark or question markIngo Schwarze
should not flag the end of a sentence if: 1) The punctuation is followed by closing delimiters and not preceded by alphanumeric characters, like in "There is no full stop (.) in this sentence" or 2) The punctuation is a child of a macro and not preceded by alphanumeric characters, like in "There is no full stop .Pq \&. in this sentence" jmc@ and sobrado@ like this
2010-07-16After .Sm on, spacing ought to restart right away, before the next token,Ingo Schwarze
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. Improves chmod(1), ksh(1), tar(1), ps(1) and probably many more. ok kristaps@ jmc@ sobrado@
2010-07-15document .Sm; prodded by kristaps@Ingo Schwarze
2010-07-13Merge release 1.10.4 (all code by kristaps@), providing four new features:Ingo Schwarze
1) Proper .Bk support: allow output line breaks at input line breaks, but keep input lines together in the output, finally fixing synopses like aucat(1), mail(1) and tmux(1). 2) Mostly finished -Tps (PostScript) output. 3) Implement -Thtml output for .Nm blocks and .Bk -words. 4) Allow iterative interpolation of user-defined roff(7) strings. Also contains some minor bugfixes and some performance improvements.
2010-07-03Rudimentary implementation of user-defined strings;Ingo Schwarze
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
2010-07-02Not only for -tag lists, but for -hang, -ohang, -inset, -diag,Ingo Schwarze
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@
2010-07-01In the mdoc(7) parser, inspect roff registers early such that all partsIngo Schwarze
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. ok kristaps@ sobrado@
2010-07-01Correct handling of trailing punctuation in MDOC_DELIM blk_full HEADs.Ingo Schwarze
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.
2010-07-01Improve .Nm indentation in the SYNOPSIS;Ingo Schwarze
kristaps@ will do the missing HTML part soon. "looks nicer" jmc@ "seems perfect to me" sobrado@ "slap it in" kristaps@
2010-06-30improve error reporting:Ingo Schwarze
* 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@
2010-06-30Closing of full blocks (Bd Bf Bk Bl It Fo Nd Rs Sh Ss) may never beIngo Schwarze
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.
2010-06-29fix a typo in the function declaration;Ingo Schwarze
seems like gcc3 didn't catch it :-( thanks to thib@ and kristaps@ for reporting
2010-06-29Considerably simplify block rewind rules; no functional change intended.Ingo Schwarze
* 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. "get it in" kristaps@
2010-06-29Support for badly nested blocks, written around the time ofIngo Schwarze
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. "get it in" kristaps@
2010-06-29sync to bsd.lv version 1.10.3:Ingo Schwarze
* support -Tps -Opaper=a4 and -Opaper=letter * lots of mandoc.1 manual improvements
2010-06-29framework for glyph width encoding; from kristaps@Ingo Schwarze
2010-06-27This header was missing from the previous commit; sorry.Ingo Schwarze
Cluestick applied by deraadt.
2010-06-27Full .nr nS support, unbreaking the kernel manuals.Ingo Schwarze
Kristaps coded this from scratch after reading my .nr patch; it is simpler and more powerful. Registers live in struct regset in regs.h, struct man and struct mdoc contain pointers to it. The nS register is cleared when parsing .Sh. Frontends respect the MDOC_SYNPRETTY flag set in mdoc node_alloc.
2010-06-27Remove "pt" from struct roffsu, as CSS (the only reason it was there) isIngo Schwarze
unclear about which units accept floats/integers, which leads me to assume that it handles either and rounds as appropriate. from kristaps@
2010-06-27minor .Bk fixes:Ingo Schwarze
* 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 ;)
2010-06-27Document .Bk/.Ek; reminded by kristaps@.Ingo Schwarze
2010-06-27Basic implementation of .Bk/.Ek.Ingo Schwarze
OK and one stylistic tweak by kristaps@.
2010-06-26As a first step towards variable-width font support,Ingo Schwarze
move all width calculations in term_*.c, *_width(). From kristaps.
2010-06-26merge release 1.10.2Ingo Schwarze
* bug fixes: - interaction of ASCII_HYPH with special chars (found by Ulrich Spoerlein) - handling of roff conditionals (found by Ulrich Spoerlein) - .Bd -offset will no more default to 6n * maintenance: - more caching of .Bd and .Bl arguments for efficiency - deconstify man(7) validation routines - add FreeBSD library names (provided by Ulrich Spoerlein) * start PostScript font-switching
2010-06-10minimal initial -Tps support, from kristaps@ GSOCIngo Schwarze
so far, monospace without font decoration, but it already has page headers and footers
2010-06-08Merge more bits that will be going into 1.10.1:Ingo Schwarze
Clean up vertical spacing in the SYNOPSIS, making the code much more systematic; this doesn't solve all SYNOPSIS problems yet, in particular not those related to keeps, indentation and the low-level .nr roff instruction, but it's a nice step forward and i couldn't find relevant regressions. (from kristaps) Besides, * make the output width configurable (default: -Owidth=80) (kristaps) * use mmap with MAP_SHARED (from Joerg Sonnenberger)
2010-06-06Merge bsd.lv version 1.10.1 (to be released soon).Ingo Schwarze
The main step forward is that this now has *much* better .Bl -column support, now supporting many manuals that previously errored out without producing any output. Other fixes include: * do not die from multiple list types, use the first and warn * in .Bl without a type, default to -item * various tweaks to .Dt * fix .In, .Fd, .Ft, .Fn and .Fo formatting * some documentation fixes and additions * and fix a couple of bugs reported by Ulrich Spoerlein: * better support for roff block-end "\}" without a preceding dot * .In must not break the line outside SYNOPSIS * spelling in some error messages While merging, fix one regression in .In spacing that needs to go to bsd.lv, too.
2010-06-06Merge bsd.lv release 1.10.0,Ingo Schwarze
which is mostly the post-hackathon release, bringing in the OpenBSD changes to bsd.lv, but which also has a few additional minor fixes: * .Lb is an in-line macro, not in_line_eoln * .Bt, .Ud now warn when discarding arguments * allow bad -man dates to flow verbatim into the front-ends - so far all reported by Ulrich Spoerlein * .Ar, .Fl and .Li starting with closing punctuation emit an empty element * empty .Li macros print nothing, but may cause spacing * proper EOS handling for .Bt, .Ex, .Rv, and .Ud. * cleanup: collapse posts_xr into posts_wtext (which is the same) * efficiency: very simple table lookup for roff.c
2010-06-05Increase the -man -Tascii text width from 65 to 78 charactersIngo Schwarze
in both our old in-tree groff and in mandoc, because 1) It looks and reads better. 2) It agrees with both bsd.lv mandoc and with modern groff. The tmac.an part was done by millert@, with a minor fix by me. While touching our old groff, switch off hyphenation, suggested a long time ago by millert@. It helps searching and comparisons. While touching mandoc terminal_man(), explicitely initialize the tabwidth - not strictly required, but easier to understand and more robust, also suggested by millert@. General mumbling of agreement by many, including millert@ deraadt@ jmc@ sobrado@ ... Remaining problem: Setting the title length (.lt) has no effect for me, but we can fix this in tree in case anybody figures it out.
2010-05-26sync manualsIngo Schwarze
2010-05-26When a word does not fully fit onto the output line, but it containsIngo Schwarze
at least one hyphen, we already had support for breaking the line a the last fitting hyphen. This patch improves this functionality by only breaking at hyphens in free-form text, and by not breaking at hyphens * at the beginning or end of a word or * immediately preceded or followed by another hyphen or * escaped by a preceding backslash. Before this patch, differences in break-at-hyphen support were one of the major sources of noise in automatic comparisons to mdoc(7) groff output. Now, the remaining differences are hard to find among the noise coming from other sources. Where there are still differences, what we do seems to be better than what groff does, see e.g. the chio(1) exchange and position commands for one of the now rare examples. idea and coding by kristaps@ Besides, this was the last substantial code difference left between bsd.lv and openbsd.org. We are now in full sync.
2010-05-25document that ".if n" is true; requested by kristaps@Ingo Schwarze
2010-05-24document ignorance of .ds, .rm and .tr;Ingo Schwarze
requested by kristaps@
2010-05-24plug second meta.source leak in .UT handling; from kristaps@Ingo Schwarze
2010-05-24lift 64-byte max width for Sh (now BUFSIZ); from kristaps@Ingo Schwarze
2010-05-24fix memory leak for .AT; from kristaps@Ingo Schwarze
2010-05-24Fix segfault in mixing old enum types for -Thtml -mdoc; from kristaps@.Ingo Schwarze
2010-05-24sync to bsd.lv: remove needless #include <time.h>Ingo Schwarze
2010-05-24remove the now unused #define MAN_EL_USE,Ingo Schwarze
forgotten when backing my .if/.ie/.el out of libman
2010-05-24The inputIngo Schwarze
.Bl -tag .Sm off .It ... triggered an assertion, which it shouldn't; the warning that .Bl -tag "requires the width argument" is enough. From Joerg Sonnenberger.
2010-05-24sync to bsd.lv:Ingo Schwarze
modern groff produces three blank lines before the man(7) footer; from Joerg Sonnenberger.
2010-05-24Fix the code to add a line break before .Nm in the SYNOPSIS;Ingo Schwarze
patch from Joerg Sonnenberger; this finally fixes the test(1) SYNOPSIS.
2010-05-24Increase performance by saving the list type in struct mdoc_node.Ingo Schwarze
This will eventually be used so that mdoc_macro can know whether to dump list line arguments into the body (`Bl -column' overflowing). Remove a2list() and arg_listtype() because of this. From kristaps@. While merging, fix a regression in mdoc_term.c, print_bvspace(): The bsd.lv version of this broke vertical spacing in .Bl -column.
2010-05-23fix the build (oops, sorry!):Ingo Schwarze
sigvec(3) triggers MANDOCERR_BODYLOST, which must not be fatal
2010-05-23Unified error and warning message system for all of mandoc,Ingo Schwarze
featuring three message levels, as agreed during the mandoc hackathon: * FATAL parser failure, cannot produce any output from this input file: eventually, we hope to convert most of these to ERRORs. * ERROR, meaning mandoc cannot cope fully with the input syntax and will probably lose information or produce structurally garbled output; it will try to produce output anyway but exit non-zero at the end, which is eventually intended to make the ports infrastructure happy. * WARNING, meaning you should clean up the input file, but output is probably mostly OK, so this will not cause error-exit at the end. This commit is mostly just converting the old system to the new one; before the classification will become really reliable, we must check all messages. In particular, * set up a new central message string table in main.c * drop the old message string tables from man.c and mdoc.c * get rid of the piece-meal merr enums in libman and libmdoc * reduce number of error/warning functions from 16 to 6 (still a lot...) While here, handle a few problems more gracefully: * allow .Rv and .Ex to work without a prior .Nm * allow .An to ignore extra arguments * allow undeclared columns in .Bl -column Written by kristaps@.
2010-05-23implement .AT and .UC; from Joerg SonnenbergerIngo Schwarze
2010-05-23Small fix for `D1' and `Bd' in -Thtml; from kristaps@.Ingo Schwarze