summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
AgeCommit message (Collapse)Author
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
2010-05-20Support nested roff instructions:Ingo Schwarze
* allow roff_parseln() to be re-run * allow roff_parseln() to manipulate the line buffer offset * support the offset in the man and mdoc libraries * adapt .if, .ie, .el, .ig, .am* and .de* support * interpret some instructions even in conditional-negative context Coded by kristaps during the last day of the mandoc hackathon. To avoid regressions in the OpenBSD tree, commit this together with some small local additions: * detect roff block end "\}" even on macro lines * actually implement the ".if n" conditional * ignore .ds, .rm and .tr in libroff Also back my old .if/.ie/.el-handling out of libman, reverting: man.h 1.15 man.c 1.25 man_macro.c 1.15 man_validate.c 1.19 man_action.c 1.15 man_term.c 1.28 man_html.c 1.9.
2010-05-17The function term_flushln() had effectively forked wrt to bsd.lv.Ingo Schwarze
This is the OpenBSD 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 * 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
2010-05-16Rewrite the main mdoc text parser, mdoc_ptext()Ingo Schwarze
to make it easier to understand and to fix various bugs: * strip white space from the end MDOC_TEXT elements in literal mode * in literal mode, a line may be blank even when containing tabs * escaped backslashes do not escape following characters ok kristaps@
2010-05-16sync to bsd.lv: enable .Bl documentationIngo Schwarze
2010-05-16add forgotten header file, duh...Ingo Schwarze
this is needed by Makefile rev. 1.37
2010-05-16allow the single quote as a control character in place of the dotIngo Schwarze
at all relevant places; from kristaps@
2010-05-16In theory, Kristaps never intended to write a roff parser,Ingo Schwarze
but in practice, most real legacy man(7)uals are using so much low level roff that we can't really get away without at least partially handling some roff instructions. As doing this in man(7) only has become messy and as even some mdoc(7) pages need it, start a minimal partial roff preprocessor. As a first step, move handling of .am[i], .de[i] and .ig there. Do not use the roff preprocessor for new manuals! Now that we have three main parser libraries - roff, man and mdoc - each one having its own error handling is becoming messy, too. Thus, start unifying message handling in one central place, introducing a new generic function mmsg(). coded by kristaps@
2010-05-15mdoc_isdelim now returns enum mdelim, not int any more;Ingo Schwarze
noticed by kristaps@ using lint
2010-05-15For .IP, a single space after the head is sufficient;Ingo Schwarze
by Joerg Sonnenberger.
2010-05-15add libelf and libterminfo;Ingo Schwarze
by Joerg Sonnenberger
2010-05-15Joerg Sonnenberger rewrote the comment stripping and line mergingIngo Schwarze
to be easier to follow and slightly faster.
2010-05-15More systematic output width handling by Joerg Sonnenberger:Ingo Schwarze
* save and restore the output width when switching to MANT_LITERAL * add an argument to ascii_alloc to specify the output width * set the default output width to 80 minus 2 characters * OpenBSD local: set the output width to 65 characters for -man
2010-05-15allow non-numeric manual sections in -mdoc;Ingo Schwarze
while here, allow LIBRARY in section 9; by kristaps@
2010-05-15removed restriction on integer manual sections in -man;Ingo Schwarze
by kristaps@
2010-05-15Bugfxing and cleanup by Joerg Sonnenberger, edited by kristaps@:Ingo Schwarze
* Flag errors and warnings in global variables. * Exit with error code if either is not null on exit. * Push down the buffers to the functions using them. * Handle the stdin/file argument in one function. * Use mmap when possible or else read the whole file into a single buffer. * Push buffer resizing into its own function.
2010-05-15various improvements regarding errors and warnings Joerg Sonnenberger:Ingo Schwarze
* If the last -column .Bl isn't specified, it is auto-sized. * An invalid .St argument should be a warning, not an error. Just put the argument into the output. * An invalid .At argument should be a warning, not an error. Just print the argument, like new groff does. * Remove warnings concerning manual section (like 1, 6, 8). It was only used for .Ex and not really useful. * Remove warnings concerning page section (like SYNOPSIS). These were only used for .Fd and .Lb and not really useful.
2010-05-15merge bsd.lv 1.63:Ingo Schwarze
fix stripping of whitespace before trailing comments; by Joerg Sonnenberger
2010-05-15merge bsd.lv rev. 1.63:Ingo Schwarze
remove "1 == ppos" conditions that remained after rev. 1.60
2010-05-15more end-of-sentence (EOS) handling:Ingo Schwarze
* recognize the end of quoted sentences, and of those in parantheses * detect EOS in append_delims, so it works after all macros by kristaps@
2010-05-15proper handling of quoted tab-separated column listsIngo Schwarze
by kristaps@
2010-05-15Distinguish OPEN, MIDDLE and CLOSE delimiters (using an enum).Ingo Schwarze
Only OPEN are drawn before the beginning of a macro; this is new, before this, MIDDLE ('|') were drawn in front, too. Only CLOSE are pushed after the end of a macro (as before). ok kristaps@ This allows us to finally enable handling of leading punctuation without regressions.
2010-05-15block-implicit macros now up-propogate end-of-sentence spacing;Ingo Schwarze
from bsd.lv mandoc.c 1.13 and mdoc_macro.c 1.64
2010-05-14Integrate kristaps@' end-of-sentence (EOS) frameworkIngo Schwarze
which is simpler and more powerful than mine, and remove mine. * man(7) now has EOS handling, too * put EOS detection into its own function in libmandoc * use node and termp flags to communicate the EOS condition * no more EOS pseudo-macro * no more non-printable EOS marker character on the formatter level This slightly breaks EOS detection after trailing punctuation in mdoc(7) macros, but that will be restored soon.
2010-05-14Merge 1.9.25, keeping local patches;Ingo Schwarze
this does not merge kristaps' end-of-sentences handling yet, i will check that separately. This one includes: * handle \*(Ba as a delimiter * introduce ARGS_PEND for .Bl -column .It end-of-line special casing * section ordering: expect EXIT STATUS at the right place * line break fixes in SYNOPSIS * allow literal contexts to have arbitrary line lengths * the input file column number can not be used to identify the beginning of a line because white space is allowed after the initial '.' * proper leading spaces in -man -Tascii mode * do not let Lb break lines in -mdoc -Thtml LIBRARY
2010-05-14merge 1.9.24, keeping local patches; some changes:Ingo Schwarze
* preserve multiple consecutive space characters in input * do not restrict .Cd and .Rv to certain sections (requested by Joerg) * do not run lookup() on quoted words * enum return types for mdoc_args and mdoc_argv * fix auto-closing of LINK tag in -Txhtml (from Daniel Friesel) * various lint and manual fixes
2010-05-13Remove the command line option -fno-ign-chars.Ingo Schwarze
This option was not useful, you never want mandoc to die just because there is an invalid character in the input file, neither in production nor when linting: a warning is sufficient. This was particularly annoying because it was part of -fstrict and could not be switched off. "less is more" kristaps@
2010-05-10Switch to using COMPILER_VERSION instead of USE_GCC3, allows for more flexibleDale Rahn
complier picking, eg supporting gcc2, gcc3, and gcc4. based on diff by Marco, with fixes from espie@. ok espie@ general mumbling of approval of others.
2010-05-08sync to bsd.lv mdoc_term.c 1.117, mdoc_html.c 1.61:Ingo Schwarze
fixed %T: it now correctly underlines, instead of quoting; noted by jmc@, fixed by kristaps@
2010-05-08merge bsd.lv rev 1.123:Ingo Schwarze
sync mdoc.c's static function names with man.c
2010-05-08handle text lines beginning with \." as comments, like groff does,Ingo Schwarze
even though this is not correct comment syntax (so warn, too) reported by Claus Assmann on misc@, fix by kristaps@
2010-05-08sync to bsd.lv rev 1.12:Ingo Schwarze
add some standards found in NetBSD's manuals
2010-05-04end-of-sentence markers at the end of .Fn argument listsIngo Schwarze
ruin indentation of the next line in the SYNOPSIS section; bug found by jacekm@ in err(3)
2010-04-27Fix a subtle bug noticed by naddy@ in pftop(8), thanks!Ingo Schwarze
When converting blank lines to .Pp outside literal context, it could happen that the following node ended up as a child of the .Pp element, but it must always be a sibling.
2010-04-25Implement roff conditional instructions .if .ie .el, in man(7) only for now;Ingo Schwarze
fixing OpenBSD::PackageName(3p) and friends for espie@.
2010-04-23Handle literal tab characters both in literal context (.Bd -literal)Ingo Schwarze
and outside. In literal context, tab stops are at each eigth column; outside, they are at each fifth column. Use tabwidth = 5 as the default and temporarily switch to 8 in termp_bd_pre(). This requires to move the term_flushln() of the final line of a display from termp_bd_post() to termp_bd_pre(); the former still needs term_newln() to handle the final lines of non-literal displays. Handling inside term_flushln() is tricky because a tab collapses with inter-word spacing, but not with another tab. Missing feature reported independently by jmc@ and deraadt@.
2010-04-22Fix a segfault reported by nicm@, introduced in rev. 1.38.Ingo Schwarze
When finding a blank line, trying to parse it is a bad idea. Instead, after adding .Pp to the AST, just return from parsetext().
2010-04-13Fix rendering of multiple successive .It macros without intervening text;Ingo Schwarze
another problem reported by jmc@. The physical output line may contain output from more than one buffer. Thus, to decide whether a line break is needed, it's insufficient to only look at the number of bytes in the current output buffer. Keep track of the number of characters already written, too.
2010-04-13zap all the (rather useless) dot lines; ok kristapsJason McIntyre
2010-04-13- sort everythingJason McIntyre
- prefer Cm to Ar for stuff like -Tascii - fix wonky ellipsis - standard $ prompt - update usage() kristaps has these diffs rolled in already ok schwarze kristaps
2010-04-12Partial revert of term.c rev. 1.23Ingo Schwarze
because jmc@ noticed that it broke blank lines in literal displays. The original idea was to suppress stray blank lines. But we don't want to suppress *all* blank lines, instead just those caused by nested lists. So do the check whether there was any output on this line, i.e. whether or not to break the line, at the right place, which is after processing the .It body.
2010-04-08first pass at cleaning this page up:Jason McIntyre
- add openbsd rcsid - new sentence, new line - > -> \*(Gt ok schwarze diff sent to kristaps; this commit includes a tweak from kristaps to keep the page up to date
2010-04-07Merge the good parts of 1.9.23,Ingo Schwarze
avoid the bad parts of 1.9.23, and keep local patches. Input in general: * Basic handling of roff-style font escapes \f, \F. * Quoted punctuation does not count as punctuation. mdoc(7) parser: * Make .Pf callable; noted by Claus Assmann. * Let .Bd and .Bl ignore unknown arguments; noted by deraadt@. * Do not warn when .Er is used outside certain sections. * Replace mdoc_node_free[list] by mdoc_node_delete. * Replace #define by enum for rew*() return values. man(7) parser: * When .TH is missing, use default section and date. Output in general: * Curly braces do not count as punctuation. * No space after .Fl w/o args when a macro follows on the same line. HTML output: * Unify PAIR_*_INIT macros, introduce new PAIR_ID_INIT(). * Print whitespace after, not before .Vt .Fn .Ft .Fo. Checked that all manuals in base still build.