summaryrefslogtreecommitdiffstats
path: root/mdoc_man.c
Commit message (Collapse)AuthorAgeFilesLines
* Use normal line macro recognition, do not attempt to roll your own.Ingo Schwarze2013-09-151-3/+2
| | | | | 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 escapeIngo Schwarze2013-06-021-5/+5
| | | | | | | 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.Ingo Schwarze2013-05-291-1/+1
| | | | Found and fixed on the plane to the OpenBSD t2k13 hackathon in Toronto.
* Support .Bl -offset in -mdoc -Tman.Ingo Schwarze2013-05-191-3/+21
| | | | | 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()Ingo Schwarze2013-05-191-4/+4
| | | | | | | 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 wayIngo Schwarze2012-12-311-34/+48
| | | | | | | | | | | | 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 SYNOPSISIngo Schwarze2012-11-191-21/+33
| | | | | | | | | 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.
* Three portability improvements by millert@:Ingo Schwarze2012-11-191-8/+9
| | | | | | | | | | | * Use "\\ " not "\\~" as the non-breaking space as historic nroff doesn't support the latter. * The '-' before the flags needs to be quoted to prevent nroff from putting a line break between the '-' and the flag character. * Disable hyphenation and, for nroff, disable justification which is consistent with how mdoc behaves (and produces more readable manuals). (OpenBSD rev. 1.39, 1.40 and 1.41)
* Make the generated man(7) code more portable by using .PDIngo Schwarze2012-11-181-5/+19
| | | | | | | 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.Ingo Schwarze2012-11-181-6/+103
| | | | | | | 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:Ingo Schwarze2012-11-171-18/+19
| | | | | | | | 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
* For .El .sp, avoid the weird .sp -1v .PP .PP output sequence.Ingo Schwarze2012-07-161-2/+3
| | | | Synching to OpenBSD rev. 1.38.
* Several -mdoc parser improvements related to vertical spacing:Ingo Schwarze2012-07-161-1/+4
| | | | | | | | | | * So far, .Pp and .Lp were removed before paragraph type blocks. * Now also remove .br before paragraph type blocks. * Treat .Lp as a paragraph like .Pp, so remove .Pp, .Lp, .br before it. * Do not treat .sp as a paragraph, don't remove anything before it. * After .Sh, .Ss, .Pp, and .Lp, remove .Pp, .Lp, .sp, .br, and blank lines. * After .sp and .br, remove .br. OpenBSD rev. mdoc.c 1.89 and mdoc_validate.c 1.106
* In -Tman .Bl -compact, skip the blank line only before the first itemIngo Schwarze2012-07-141-1/+2
| | | | | of the first list in a section, not before every item of the first list. OpenBSD rev. 1.37
* Adjust -Tman SYNOPSIS .Nm indentation using .HP; requested by millert@.Ingo Schwarze2012-07-131-1/+10
| | | | | There are still lots of ugly line breaks, to be fixed later. OpenBSD rev. 1.36
* If the tag in .Bl -tag .It would leave exactly one blank before theIngo Schwarze2012-07-131-27/+54
| | | | | | | | | 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(). OpenBSD rev. 1.35
* In -man -Tascii, support .sp with negative argument.Ingo Schwarze2012-07-131-69/+82
| | | | | | In -mdoc -Tman, improve the framework to control vertical spacing. Use both to support .Bl -compact (surprisingly hard to get right). OpenBSD rev. 1.85 and 1.34, respectively.
* Do not crash in -Tman on:Ingo Schwarze2012-07-121-8/+15
| | | | | | | * .Fn with exactly one argument * .Bl -hang without a -width Now all 3776 OpenBSD base manuals build without crashing. OpenBSD rev. 1.33
* Polish -Tman .Rs support.Ingo Schwarze2012-07-111-27/+67
| | | | | All mdoc(7) macros are now supported by -Tman. OpenBSD rev. 1.32
* basic implementation of -Tman .Bl -column using tbl(7); OpenBSD rev. 1.31Ingo Schwarze2012-07-111-5/+41
|
* basic implementation of -Tman .Bl -tagIngo Schwarze2012-07-101-5/+5
| | | | | while here, do some minor outflags cleanup OpenBSD rev. 1.30
* multiple fixes to -Tascii .HP rendering:Ingo Schwarze2012-07-101-8/+22
| | | | | | | | | | | | | | | | | | * do not add an excessive blank line before the block * in literal mode, start a new line after the tag getting this to work requires some general (print_man_node) fixes: * in literal mode, break the output line at the end of each input line, not just after those input lines ending in text * but don't break it when there was no output on the line * and adjust the margins after the .HP tag these general fixes require an adjustment to -Tascii .TP rendering: * set up NOBREAK mode before the body, not after the head finally, based on all this, implement -Tman .Bl -hang in terms of .HP OpenBSD rev. 1.84 and 1.29, respectively
* * implement -Tman .Bl -item -inset -diag -ohang -dash -hyphen -enum .ItIngo Schwarze2012-07-101-8/+121
| | | | | | | | | | * fix -Tman .Bl -bullet .It * adjust the -Tascii .Bl -bullet -dash -hyphen .It default and minimum width to new groff standards, it changed from 4n (in groff 1.15) to 2n (in groff 1.21) * same for -Tascii -enum, it changed from 5n to 2n * use -hang formatting for -Tascii -enum -width 2n * for -Tascii -enum, the default is -width 3n
* fix -Tascii .Fd line breakingIngo Schwarze2012-07-091-3/+22
| | | | | and implement -Tman .Fd OpenBSD rev. 1.27 and 1.143, respectively
* implement -Tman .Eo and .Ec; OpenBSD rev. 1.26Ingo Schwarze2012-07-091-3/+12
|
* Implement -Tman .Bf.Ingo Schwarze2012-07-091-5/+41
| | | | | | | | To get the spacing right, * avoid man(7) code line breaks at places where no spacing is allowed * allow spacing right after .Sm on * allow spacing after empty .Fl at the end of an input line OpenBSD rev. 1.25
* fix -Tman font handling for:Ingo Schwarze2012-07-091-66/+146
| | | | | | .Ad .Ar .Cd .Cm .Dv .Em .Er .Ev .Fa .Fl .Fn .Fo .Ft .Ic .In .Lk .Li .Ms .Mt .Nm .Pa .Sx .Sy .Tn .Va .Vt OpenBSD rev. 1.24
* implement -Tman .No and .Mt; OpenBSD rev. 1.23Ingo Schwarze2012-07-091-14/+26
|
* fix .Lk for -Tascii and implement it for -TmanIngo Schwarze2012-07-081-1/+30
| | | | OpenBSD rev. 1.22 and 1.142, respectively
* fix vertical spacing for -Tman SYNOPSIS .Fn .Fo .Ft .In .Nm .Va .VtIngo Schwarze2012-07-081-11/+64
| | | | OpenBSD rev. 1.21
* implement -Tman .AnIngo Schwarze2012-07-081-1/+29
| | | | | also reset -[no]split mode at .Sh AUTHORS in -Tascii OpenBSD rev. 1.20 and 1.141, respectively
* Add flags to insert a .sp or .br request before the next output,Ingo Schwarze2012-07-081-49/+29
| | | | | | shortening some frequent idioms and preparing for better vertical spacing in the SYNOPSIS; no functional change intended. OpenBSD rev. 1.19
* Instead of adding one integer variable for each global boolean output flagIngo Schwarze2012-07-081-180/+176
| | | | | | | and passing around a structure containing them into each and every function, just use a single static bitfield. In preparation for adding more output flags to support more features. OpenBSD rev. 1.18
* implement -Tman .VaIngo Schwarze2012-07-081-2/+2
| | | | | and fix -Tman .Vt for the non-SYNOPSIS case OpenBSD rev. 1.17
* implement -Tman .Vt; OpenBSD rev. 1.15 and 1.16Ingo Schwarze2012-07-081-1/+41
|
* Basic implementation of -Tman .Fo and .Fa;Ingo Schwarze2012-07-081-16/+81
| | | | | | | again, some blank lines still missing from the output. While here, remove the trailing semicolon from .Fn when outside .Sh SYNOPSIS. OpenBSD rev. 1.14
* rudimentary support for -Tman .Ft and .Fn;Ingo Schwarze2012-07-071-2/+48
| | | | | some blank lines are still missing from the output OpenBSD rev. 1.13
* basic support for -Tman .In; OpenBSD rev. 1.12Ingo Schwarze2012-07-071-1/+32
|
* after .Lb in library section, break the line in the final outputIngo Schwarze2012-07-071-1/+13
|
* implement -Tman .Bk; OpenBSD rev. 1.10Ingo Schwarze2012-07-071-4/+35
|
* implement -Tman .Sm; OpenBSD rev. 1.9Ingo Schwarze2012-07-071-3/+19
|
* implement -Tman .Bd -offset and -compact; OpenBSD rev. 1.8Ingo Schwarze2012-07-071-1/+35
|
* minor -mdoc -Tman fixesIngo Schwarze2012-07-071-2/+9
| | | | | | | | | * right after .Ns, avoid breaking the line in man code * after .Fl without arguments, do not insert a blank into man code * before each .Nm in .Sh SYNOPSIS, insert a .br into man code * skip .Pp arguments, don't copy them to man code OpenBSD rev. 1.7
* Implement missing enclosures (Ao Do Qo Qq So Bro Brq)Ingo Schwarze2011-10-241-23/+23
| | | | | | | and enclosure-like in-line macros (Ad Cd Dv Er Ev Li Ms Tn). The .No macro works without explicit implementation. ok kristaps@
* Implement the missing text production macros (Bsx Bx Dx Fx Nx Ox Ux Bt Ud).Ingo Schwarze2011-10-201-18/+53
| | | | | Some macros work without explicit implementation (At Db Os St). ok kristaps@
* Tweak Makefile and add config.h to -Tman to allow cross-compiling onKristaps Dzonsons2011-10-081-0/+4
| | | | Windows (via MingW).
* Implement a basic -Tman `Rv', like `Ex'.Kristaps Dzonsons2011-10-081-2/+5
|
* Tidy up -Tman output. This has NO functional change: (1) introduced aKristaps Dzonsons2011-10-081-107/+175
| | | | | | | state struct instead of using global statics; (2) documented throughout the file; (3) fixed a situation of reaching past the end of our buffer for zero-length strings; (4) alpha-ordered the functions. (1) and (3) ok schwarze@. (2) and (4) are purely style and documentation.
* If -Tman is specified and input is -man, echo the preprocessed (`so'Kristaps Dzonsons2011-10-061-0/+8
| | | | | | | | | | | | | | replaced by file) input. This replaces earlier behaviour of doing nothing, which I found unexpected (mandoc should always output). This requires a buffer in read.c that saves the input lines before being parsed, with a special hook if `so' is invoked. This buffer is just flushed to output if -mman is the input. While mucking around doing this, I also alpha-ordered the mandoc.h functions. Ok schwarze@, with no screaming when the polished patch was published.
* implement .Ap .Bd .Bo .Bq .D1 .Ic .Lp .Oo .Pf .Po .Ss .Sx .Sy .br .spIngo Schwarze2011-09-301-40/+133
| | | | | | | | implement .Bl -bullet add more information to the .TH line escape dots at the beginnings of lines add trailing newline character at the end of the file do not misinterpret the ROOT block as .Ap