summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_man.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* do not access a NULL pointer if an .Eo block lacks a tail;schwarze2015-02-111-4/+3
| | | | found by jsg@ with afl, test case #16
* better handle .Fo and .Fd without argumentschwarze2015-02-061-3/+6
| | | | better handle .Fo with more than one argument
* fix .Eo/.Ec spacingschwarze2015-02-011-3/+25
|
* * Polish tbl(7) error reporting.schwarze2015-01-281-6/+9
| | | | | | * Do not print out macro names in tbl(7) data blocks. * Like with GNU tbl, let empty tables cause a blank line. * Avoid producing empty tables in -Tman.
* Let .Aq/.Ao/.Ac print "<>" instead of the normal "\(la\(ra"schwarze2015-01-231-6/+6
| | | | | | when the only child is .Mt, not when the preceding node is .An, to improve robustness. Triggered by a question from Svyatoslav Mishyn <juef at openmailbox dot org> (Crux Linux).
* Support negative indentations for mdoc(7) displays and lists.schwarze2014-12-241-29/+28
| | | | | | Not exactly recommended for use, rather for groff compatibility. While here, introduce similar SHRT_MAX limits as in man(7), fixing a few cases of infinite output found by jsg@ with afl.
* support negative horizontal widths in man(7);schwarze2014-12-231-1/+5
| | | | minus twenty lines of code in spite of enhanced functionality
* fix typo in previousschwarze2014-12-231-3/+3
|
* some scaling unit fixes:schwarze2014-12-231-3/+3
| | | | | - .sp with an invalid argument is .sp 1v, not .sp 0v - in man(1), trailing garbage doesn't make scaling units invalid
* Multiple fixes with respect to .Pf:schwarze2014-11-301-2/+3
| | | | | | | * The first argument of .Pf is not parsed. * Normal delimiter handling does not apply to the first argument of .Pf. * Warn if nothing follows a prefix (inspired by groff_mdoc(7)). * In that case, do not suppress spacing.
* Multiple fixes with respect to .Eo:schwarze2014-11-271-5/+14
| | | | | | | | 1. Correctly parse stray .Ec without preceding .Eo, avoiding an assertion violation found by jsg@ with afl. 2. Correctly parse .Ec arguments when breaking another block. 3. Correct spacing around closing delimiter when breaking another block. 4. Sync some related formatting control from -Tascii to -Thtml.
* Fix the obsolete .Db (toggle debug mode) macro to ignore its argumentsschwarze2014-11-271-11/+11
| | | | | and not trigger an assertion when there is more than one argument; the latter found by jsg@ with afl.
* Let .Ao and .Aq render as "<>" after .An and as "\(la\(ra" elsewhere,schwarze2014-11-191-3/+24
| | | | just like groff; minibug noticed by bentley@.
* Multiple fixes with respect to in-line macros:schwarze2014-11-171-1/+5
| | | | | | | | | | * .No selects the default font; relevant e.g. in .Bf blocks * no need to force empty .Li elements * closing delimiters as leading macro arguments do not suppress space * opening delimiters at the end of a macro line do not suppress space * correctly handle delimiter spacing in -Tman As a side effect, these fixes let mandoc warn about empty .No macros as requested by bentley@.
* Let -Tascii \(bu (bullet) output agree with groff;schwarze2014-11-061-2/+2
| | | | this is now possible because -Tps now handles backspace overstriking.
* Major bugsquashing with respect to -offset and -width:schwarze2014-10-301-9/+11
| | | | | | | | | 1. Support specifying the .Bd and .Bl -offset as a macro default width; while here, simplify the code handling the same for .Bl -width. 2. Correct handling of .Bl -offset arguments: unlike .Bd -offset, the arguments "left", "indent", and "indent-two" have no special meaning. 3. Fix the scaling of string length -offset and -width arguments in -Thtml. Triggered by an incomplete documentation patch from bentley@.
* Right after .Fl, a middle delimiter triggers an empty scope,schwarze2014-08-211-4/+7
| | | | | | | | | | | | just like a closing delimiter. This didn't work in groff-1.15, but it now works in groff-1.22. After being closed by delimiters, .Nm scopes do not reopen. Do not suppress white space after .Fl if the next node is a text node on the same input line; that can happen for middle delimiters. Fixing an issue reported by jmc@.
* Bring the handling of defective prologues even closer to groff,schwarze2014-08-081-3/+4
| | | | | | | | | | | | in particular relaxing the distinction between prologue and body and further improving messages. * The last .Dd wins and the last .Os wins, even in the body. * The last .Dt before the first body macro wins. * Missing title in .Dt defaults to UNTITLED. Warn about it. * Missing section in .Dt does not default to 1. But warn about it. * Do not warn multiple times about the same mdoc(7) prologue macro. * Warn about missing .Os. * Incomplete .TH defaults to empty strings. Warn about it.
* Various improvements related to .Ex and .Rv:schwarze2014-08-081-10/+95
| | | | | | | | | | * let .Nm fall back to the empty string, not to UNKNOWN * never let .Rv copy an argument from .Nm * avoid spurious \fR after empty .Nm in -Tman * correct handling of .Ex and .Rv in -Tman * correct the wording of the output for .Rv without arguments * use non-breaking spaces in .Ex and .Rv output where required * split MANDOCERR_NONAME into a warning for .Ex and an error for .Nm
* Clean up messages regarding excess arguments:schwarze2014-07-041-5/+7
| | | | | | | * Downgrade ".Bf -emphasis Em" from FATAL to WARNING. * Mention the macros, the arguments, and the fallbacks. * Hierarchical naming. Also fix the handling of excess .It head arguments in -Tman.
* When .Sm is called without an argument, groff toggles the spacing mode,schwarze2014-07-021-4/+9
| | | | | so let us do the same for compatibility. Using this feature is of course not recommended except in manual page obfuscation contests.
* Implement the obsolete macros .En .Es .Fr .Ot for backward compatibility,schwarze2014-07-021-5/+42
| | | | | since this is hardly more complicated than explicitly ignoring them as we did in the past. Of course, do not use them!
* make sure static buffers for snprintf(3) are large enoughschwarze2014-04-201-6/+7
| | | | and cast snprintf return value to (void) where they are
* KNF: case (FOO): -> case FOO, remove /* LINTED */ and /* ARGSUSED */,schwarze2014-04-201-70/+71
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* Implement the roff(7) .ll (line length) request.schwarze2014-03-301-1/+11
| | | | | Found by naddy@ in the textproc/enchant(1) port. Of course, do not use this in new manuals.
* The files mandoc.c and mandoc.h contained both specialised low-levelschwarze2014-03-211-3/+4
| | | | | | | functions used for multiple languages (mdoc, man, roff), for example mandoc_escape(), mandoc_getarg(), mandoc_eos(), and generic auxiliary functions. Split the auxiliaries out into their own file and header. While here, do some #include cleanup.
* Improve formatting of broken blocks in -Tman,schwarze2014-01-241-3/+12
| | | | somewhat similar to what mdoc_term.c already does for -Tascii.
* Implement the \: (optional line break) escape sequence,schwarze2014-01-221-2/+5
| | | | | | | documented in the Ossanna-Kernighan-Ritter troff manual and also supported by groff. Missing feature reported by Steffen Nurpmeso <sdaoden at gmail dot com>.
* Implement .Fo/.Fa/.Fc indentation and break handling for -Tman.schwarze2013-12-251-4/+9
|
* Do not break output lines in .Fn function arguments in SYNOPSIS mode.schwarze2013-12-251-1/+11
| | | | | Following an idea from Franco Fichtner, but implemented more cleanly. This reduces groff-mandoc-differences in base by a fantastic 7.5%.
* Implement SYNOPSIS .Fn indentation for -Tman.schwarze2013-12-241-2/+5
|
* It turns out SYNOPSIS mode does not imply .Bk in general,schwarze2013-12-241-19/+18
| | | | | | | but only within .Nm blocks. Simplify the code accordingly. This reduces groff-mandoc differences in base by about 2%. Triggered by research done by Franco Fichtner.
* Printf size_t vars with %zu, not %ld;schwarze2013-10-071-5/+5
| | | | | from Antonio Huete Jimenez <tuxillo at quantumachine dot net> via Franco Fichtner (both DragonFly).
* Use normal line macro recognition, do not attempt to roll your own.schwarze2013-09-151-4/+3
| | | | | This fixes horizontal spacing when an Ns macro follows a block-closing macro and the corresponding block-opening macro is not on the same line.
* Let .Do .Dq .Ql .So .Sq generate the correct roff(7) character escapeschwarze2013-06-021-6/+6
| | | | | | | sequences such that output modes like -Tutf8 have a chance to select nice glyphs. This doesn't change anything for -Tascii, and, for now, it doesn't affect -Tps and -Tpdf either. OK matthew@ bentley@; like the idea tedu@; no opinion jmc@.
* In SYNOPSIS mode, .Ek doesn't end a keep.schwarze2013-05-291-2/+2
| | | | Found and fixed on the plane to the OpenBSD t2k13 hackathon in Toronto.
* Support .Bl -offset in -mdoc -Tman.schwarze2013-05-191-4/+22
| | | | | Issue found when Thomas Klausner <wiz at NetBSD dot org> made me look at the manuals of his http://www.nih.at/libzip library.
* Move printing of the .RS macro into print_offs() such that print_offs()schwarze2013-05-191-5/+5
| | | | | | | takes care of printing the whole line. This reduces code duplication - in particular after the upcoming commit to repair .Bl -offset - and makes print_offs() more similar to what print_width() does. No functional change.
* Rewrite indentation handling for nested lists in a more systematic wayschwarze2012-12-311-35/+49
| | | | | | | | | | | | to fix multiple issues reported by Todd Miller; thanks! Specifically, - avoid double indentation after .Bd inside .Bl - set up correct indentation after .Bl inside .Bl - set up correct indentation after .Dl and .D1 inside .Bl While here, also - set up correct indentation *inside* .Dl and .D1 inside .Bl.
* In -Tman mode, support automatic word keeps in the SYNOPSISschwarze2012-11-191-22/+34
| | | | | | | | | just like in -Tascii mode; requested by millert@. While here, do not escape the blank characters terminating man(7) macros; this is becoming more important as we use more keeps now. Note that -Tman still does not support .nr nS.
* Make the generated man(7) code more portable by using .PDschwarze2012-11-181-6/+20
| | | | | | | instead of .sp -1v, which for example Solaris nroff handles poorly. Problem report and patch by millert@, with the print_word chunk tweaked by me.
* Correct indentation for lists and displays inside lists.schwarze2012-11-181-7/+104
| | | | | | | Inspired by a diff from millert@, but implemented rather differently and with slightly better functionality. In particular, this one respects -offset and -width arguments found in the input file.
* Cleanup naming of local variables to make the code easier on the eye:schwarze2012-11-171-19/+20
| | | | | | | | Settle for "struct man *man", "struct mdoc *mdoc", "struct meta *meta" and avoid the confusing "*m" which was sometimes this, sometimes that. No functional change. ok kristaps@ some time ago
* Disable hyphenation and, for nroff, disable justification which ismillert2012-07-291-2/+5
| | | | | consistent with how mdoc behaves (and produces more readable manuals). OK schwarze@
* The '-' before the flags needs to be quoted to prevent nroffmillert2012-07-291-2/+2
| | | | | from putting a line break between the '-' and the flag character. OK schwarze@
* Use "\\ " not "\\~" as the non-breaking space as historic nroffmillert2012-07-291-7/+5
| | | | doesn't support the latter. OK schwarze@
* Two fixes regarding -Tman .sp:schwarze2012-07-161-2/+6
| | | | | * Keep height argument on the same line (it got printed to the output). * For .El .sp, avoid the weird .sp -1v .PP .sp output sequence.
* In -Tman .Bl -compact, skip the blank line only before the first itemschwarze2012-07-141-2/+3
| | | | of the first list in a section, not before every item of the first list.
* Adjust -Tman SYNOPSIS .Nm indentation using .HP; requested by millert@.schwarze2012-07-131-2/+11
| | | | There are still lots of ugly line breaks, to be fixed later.
* If the tag in .Bl -tag .It would leave exactly one blank before theschwarze2012-07-131-28/+55
| | | | | | | | body of the item, mdoc(7) breaks the line, whereas the .TP used to translate this to man(7) does not. Thus, insert an explicit roff(7) line break in this place. To be able to correctly count the characters, do not pass font escapes an the like through print_word().