summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
AgeCommit message (Collapse)Author
2010-08-26sys/param.h is for kernel interface programs.Theo de Raadt
sys/types.h is the file you want to include.
2010-08-21Backout previous.Ingo Schwarze
As Kristaps found out, i was wrong: .Bl -column phrases do not ignore spacing rules for trailing punctuation in general. In particular, - the rightmost column of a column list is unaffected - columns terminated by the .Ta macro instead of a tab are unaffected - columns ending in a blank are unaffected Spacing rules for trailing punctuation are only ignored when the tab follows the punctuation immediately, without a blank in between, because then the combination of punctuation and tab is treated by roff as a word, and the punctuation is not recognized as isolated. The reason this doesn't work in mandoc is that in the special case of .Bl -column (not in general!), mandoc treats tabs as word delimiters. We either need to solve this differently, or call it a bug in roff.
2010-08-20Centralize handling of literal tabs in term_flushln() in one place,Ingo Schwarze
making the code simpler and easier to understand. No functional change.
2010-08-20When a column contains trailing spaces, calculate the paddingIngo Schwarze
to the start of the next column correctly. Fixing a problem found by jmc@ in sysctl(3), reminded by kettenis@.
2010-08-20.Bl -column phrases ignore spacing rules for trailing punctuationIngo Schwarze
and render it just like normal text. Minimal fix of a formatting bug in operator(7) reported by ray@.
2010-08-20fix previous: when bailing out due to -Wstop,Ingo Schwarze
skip output functions, but not *_endparse; problem reported by kristaps@
2010-08-20Implement a simple, consistent user interface for error handling.Ingo Schwarze
We now have sufficient practical experience to know what we want, so this is intended to be final: - provide -Wlevel (warning, error or fatal) to select what you care about - provide -Wstop to stop after parsing a file with warnings you care about - provide consistent exit status codes for those warnings you care about - fully document what warnings, errors and fatal errors mean - remove all other cruft from the user interface, less is more: - remove all -f knobs along with the whole -f option - remove the old -Werror because calling warnings "fatal" is silly - always finish parsing each file, unless fatal errors prevent that This commit also includes a couple of related simplifications behind the scenes regarding error handling. Feedback and OK kristaps@; Joerg Sonnenberger (NetBSD) and Sascha Wildner (DragonFly BSD) agree with the general direction.
2010-08-18Remove the standard pod2man \*(C+ pre-predefined string ("C++").Ingo Schwarze
It is always defined in the preamble using .ds when used in manuals. Since we now support .ds, it is no longer necessary to provide it. Triggered by a bug report from Thomas Jeunet, patch by kristaps@.
2010-08-18Ignore \h (local horizontal motion) and \v (local vertical motion) escapesIngo Schwarze
just in the same way as \s (font size) escapes, and handle \s escapes not having an explicit plus or minus sign. This fixes the very ugly rendering of "C++" in gcc(1). Reported by Thomas Jeunet, fixed by kristaps@.
2010-08-18Correctly print .Lk arguments in -Tascii.Ingo Schwarze
Issue reported by Aldis Berzoja, fix by kristaps@.
2010-08-18Remove mandoc(1) compatibility notes that are no longer relevant;Ingo Schwarze
from kristaps@.
2010-08-18Turn the non-trivial PS_GROWBUF macro into a function.Ingo Schwarze
Don't use MAX, it doesn't exist in the default namespace on Solaris. From Joerg Sonnenberger, with a critical fix by kristaps@.
2010-08-18Simplify and sync the code and comments for copying the macro nameIngo Schwarze
in man_pmacro() and mdoc_pmacro(). In particular, no need to use isgraph(3) here, that has already been done in main.c. Joint work by Kristaps and myself, ok kristaps@.
2010-08-18Use isascii(3) to make sure we really throw away non-ASCII characters,Ingo Schwarze
because isgraph(3) returns true for some eight-bit characters. ok kristaps@
2010-08-07Groff allows the initial macro on a line to be delimited by a spaceIngo Schwarze
of by a tab; so allow the tab in mandoc, too. Bug found by me, fix by kristaps@, "sure" deraadt@.
2010-08-07In -Thtml output, preserve blank lines at the end of .Bd -literal.Ingo Schwarze
Patch from kristaps@, analoguous to mdoc_term.c rev. 1.100. With permission from deraadt@ to still fix bugs in mandoc.
2010-08-04In .Bd -literal, break the output line after the last element of eachIngo Schwarze
input line, not after the first element. Since free-form text lines only have a single element in literal mode, this is only relevant for macro lines inside literal displays, and only for those containing more than one macro. Fixes e.g. awk(1) and boot_config(8). Note this fix differs from what kristaps@ committed to bsd.lv because those changes introduce regressions with respect to blank lines in literal mode. With permission from deraadt@ to still fix bugs in mandoc.
2010-08-01Move the new mdoc(7) manual written by kristaps@, replacing the old oneIngo Schwarze
which had much less information, such that the new one gets installed. No change to the build system required, no text change in this commit. Doing the big move early even though a few more improvements will follow. The duplicate information in mdoc.samples(7) will be cleaned up post-release. ok jmc@, and kristaps@ agreed with the plan, too
2010-08-01Sync to bsd.lv:Ingo Schwarze
State that we parse and ignore \s and \m font size and colour control sequences, and remove the detailed, irrelevant documentation.
2010-07-31Correct Copyright lines in the rarely touched files:Ingo Schwarze
* add missing years (only where substantial changes were committed) * update Kristaps' email address in the remaining places No code changes.
2010-07-31Major cleanup (but there is still more to come):Ingo Schwarze
* rewrite .An, .Bd, .Bk, .Bl, .Ex descriptions * correct "parsable" to "parsed" * and various formatting and wording tweaks This commit includes a patch from kristaps@ explaining empty .Dd. Feedback and OK jmc@ and kristaps@.
2010-07-31Merge bsd.lv version 1.10.5: last larger batch of bug fixes before release.Ingo Schwarze
NOT including Kristaps' .Bd -literal changes which cause regressions. Features: * -Tpdf now fully working Bugfixes: * proper handling of quoted strings by .ds in roff(7) * allow empty .Dd * make .Sm start no-spacing after the first output word * underline .Ad * minor fixes in -Thtml and some optimisations in terminal output.
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