summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man_term.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* In groff, when the .SY block macro occurs in no-fill mode,schwarze2019-01-051-2/+4
| | | | the output line gets broken after the head. Do the same.
* minor cleanup, no functional change:schwarze2019-01-051-82/+65
| | | | | | | | | | | * in node type switches, explicitly handle all types, sort them, and abort() on those that cannot occur * avoid testing pointers as truth values, use "!= NULL" * avoid testing "constant == variable", use "variable == constant" * prefer sizeof(var) over sizeof(type) * delete one duplicate function * sort some declarations * delete some useless blank lines
* Some high-level block macros have an effect similar to temporarilyschwarze2019-01-051-3/+6
| | | | | | | | | | | | suspending no-fill mode during their head. Model this with an additional roff parser state flag ROFF_NONOFILL. That is much simpler than it would be to save and restore the ROFF_NOFILL flag itself, in particular since the latter can be switched (with lasting effect) by the .nf and .fi requests even while its effect is temporarily suspended. This commit does not change formatting yet, but prepares for future formatting simplifications and improvements.
* Cleanup, minus 25 LOC, no functional change:schwarze2018-12-311-48/+7
| | | | | Delete the complicated mechanism keeping fill mode state locally in the man(7) HTML formatter. Instead, use the state stored in the nodes.
* Move parsing of the .nf and .fi (fill mode) requests from the man(7)schwarze2018-12-311-4/+7
| | | | | | parser to the roff(7) parser. As a side effect, .nf and .fi are now also parsed in mdoc(7) input, though the mdoc(7) formatters still ignore most of their effect.
* Cleanup, no functional change:schwarze2018-12-301-6/+5
| | | | | | | | | | | | | | The struct roff_man used to be a bad mixture of internal parser state and public parsing results. Move the public results to the parsing result struct roff_meta, which is already public. Move the rest of struct roff_man to the parser-internal header roff_int.h. Since the validators need access to the parser state, call them from the top level parser during mparse_result() rather than from the main programs, also reducing code duplication. This keeps parser internal state out of thee main programs (five in mandoc portable) and out of eight formatters.
* Cleanup, no functional change:schwarze2018-12-131-2/+1
| | | | | | | | | | Split the top level parser interface out of the utility header mandoc.h, into a new header mandoc_parse.h, for use in the main program and in the main parser only. Move enum mandoc_os into roff.h because struct roff_man is the place where it is stored. This allows removal of mandoc.h from seven files in low-level parsers and in formatters.
* In the validators, translate obsolete macro aliases (Lp, Ot, LP, P)schwarze2018-12-031-3/+10
| | | | | | to the standard forms (Pp, Ft, PP) up front, such that later code does not need to look for the obsolete versions. This reduces the risk of incomplete handling.
* Support nesting of elements with next-line scope.schwarze2018-08-261-3/+3
| | | | For example, ksh93(1) needs this for .B\n.SM.
* .SY causes a one-column indentation even without any argumentschwarze2018-08-181-2/+2
|
* The .nf/.fi (fill mode) requests never have text childrenschwarze2018-08-181-3/+3
| | | | and in particular do not reset font mode.
* Two consecutive .SY blocks only get a blank line in betweenschwarze2018-08-181-2/+3
| | | | if the first one is explicitly closed with .YS.
* prevent line breaks in the middle of .OPschwarze2018-08-181-2/+3
|
* implement the GNU man-ext .SY/.YS (synopsis block) macro in man,schwarze2018-08-181-1/+61
| | | | used in most manual pages of the groff package
* Remove more pointer arithmetic passing via regions outside the arrayschwarze2018-08-171-14/+22
| | | | | that is undefined according to the C standard. Robert Elz <kre at munnari dot oz dot au> pointed out i wasn't quite done yet.
* implement the GNU man-ext .TQ macro in man(7),schwarze2018-08-161-2/+4
| | | | used for example by groff_diff(7)
* support tail arguments on the .ME and .UE macros,schwarze2018-08-141-1/+3
| | | | used for example in the ditroff(7) manual of the groff package
* When formatting man(7) documents that do not contain .SH macrosschwarze2018-06-101-1/+13
| | | | | with -Tps or -Tpdf, do not squeeze the whole text beyond the right margin. Bug reported by Will Backman during BSDCan.
* preserve comments before .Dd when converting mdoc(7) to man(7)schwarze2018-04-111-5/+8
| | | | with mandoc -Tman; suggested by Thomas Klausner <wiz at NetBSD>
* Fix an out of bounds read access to a constant array that causedschwarze2017-07-311-3/+3
| | | | | | | segfaults on certain hardened versions of glibc. Triggered by .sp or blank lines right before .SS or .SH, or before the first .Sh. Found the hard way by Dr. Markus Waldner on Debian and by Leah Neukirchen on Void Linux.
* Add support for the MT and ME mailto macros, used for example in wg(8).bentley2017-06-251-1/+3
| | | | feedback and ok schwarze@
* correct handling of blank lines after \cschwarze2017-06-171-2/+5
|
* properly set the default indentationschwarze2017-06-171-5/+5
| | | | such that even pages without any .SH macros get it
* improve rounding rules for scaling unitsschwarze2017-06-141-6/+6
| | | | in horizontal orientation in the terminal formatter
* make the internal a2roffsu() interface more powerful by returningschwarze2017-06-081-7/+7
| | | | | a pointer to the end of the parsed data, making it easier to parse subsequent bytes
* Prepare the terminal driver for filling multiple columns in parallel,schwarze2017-06-071-59/+61
| | | | | | first step: split column data out of the terminal state struct into a new column state struct and use an array of such column state structs. No functional change.
* Implement the roff(7) .mc (right margin character) request.schwarze2017-06-041-12/+7
| | | | | | The Tcl/Tk manual pages use this extensively. Delete the TERM_MAXMARGIN hack, it breaks .mc inside .nf; instead, implement a proper TERMP_BRNEVER flag.
* Make term_flushln() simpler and more robust:schwarze2017-06-041-2/+1
| | | | | | Eliminate the "overstep" state variable. The information is already contained in "viscol". Minus 60 lines of code, no functional change intended.
* Trailing \c suppresses the output line break even ifschwarze2017-05-091-3/+4
| | | | | the next line is a text line starting with whitespace. Quirk found in the sysutils/rancid port.
* implement .DT in terms of .ta; needed for print/ghostview, for exampleschwarze2017-05-071-2/+12
|
* Basic implementation of the roff(7) .ta (define tab stops) request.schwarze2017-05-071-2/+4
| | | | | | This is the first feature made possible by the parser reorganization. Improves the formatting of the SYNOPSIS in many Xenocara GL manuals. Also important for ports, as reported by many, including naddy@.
* Move .sp to the roff modules. Enough infrastructure is in placeschwarze2017-05-051-52/+1
| | | | now that this actually saves code: -70 LOC.
* move .ll to the roff modulesschwarze2017-05-051-11/+1
|
* Move handling of the roff(7) .ft request from the man(7)schwarze2017-05-051-38/+1
| | | | | modules to the new roff(7) modules. As a side effect, mdoc(7) now handles .ft, too. Of course, do not use that.
* Start roff formatter modules for HTML and termininal output,schwarze2017-05-041-11/+3
| | | | | | | used by both the mdoc and man formatters, with the ultimate goal of reducing code duplication between the two macro formatters. Made possible by the parser unification. Add the first formatting function (for the .br request).
* Parser reorg:schwarze2017-05-041-3/+14
| | | | | Generate the first node on the roff level: .br Fix some column numbers in diagnostic messages while here.
* Continue parser unification:schwarze2017-04-241-3/+4
| | | | | | | | * Make enum rofft an internal interface as enum roff_tok in "roff.h". * Represent mdoc and man macros in enum roff_tok. * Make TOKEN_NONE a proper enum value and use it throughout. * Put the prologue macros first in the macro tables. * Unify mdoc_macroname[] and man_macroname[] into roff_name[].
* Fix previous: I forgot that i had to change the convention howschwarze2017-02-151-2/+2
| | | | | a node is marked as "not a macro" when unifying the parsers. Confirmed to work by Sevan Janiyan.
* Do not read one element past the end of the static const termacts array.schwarze2017-02-111-2/+3
| | | | | | | Bug found by Sevan Janiyan <venture37 at geeklan dot co dot uk> who ran the OpenBSD mandoc test suite on Ubuntu on POWER8 (sic!) and reported that mdoc/Sh/before.in failed in -Tman mode. If that isn't power testing, i don't know...
* Do not fix the default indent for all subsequent files; some may useschwarze2017-02-041-2/+5
| | | | | a different macro language and hence require a different indent. You can see the effect with "man -a 1 host hostname".
* unify names of AST node flags; no change of cpp outputschwarze2017-01-101-9/+9
|
* Delete the redundant "nchild" member of struct roff_node, replacingschwarze2016-01-081-2/+2
| | | | | | | | most uses by one, a few by two pointer checks, and only one by a tiny loop - not only making data smaller, but code shorter as well. This gets rid of an implicit invariant that confused both static analysis tools and human auditors. No functional change.
* To make the code more readable, delete 283 /* FALLTHROUGH */ commentsschwarze2015-10-121-11/+1
| | | | | | that were right between two adjacent case statement. Keep only those 24 where the first case actually executes some code before falling through to the next case.
* modernize style: "return" is not a function; ok cmp(1)schwarze2015-10-061-33/+33
|
* Trailing whitespace is significant when determining the width of a tagschwarze2015-09-211-3/+3
| | | | | in mdoc(7) .Bl -tag and man(7) .TP, but not in man(7) .IP. Quirk reported by Jan Stary <hans at stare dot cz> on ports@.
* If an explicit line break request (.br or .sp) occurs within an .HP block,schwarze2015-04-191-1/+12
| | | | | | | the next line doesn't hang, but is simply indented. Issue found by Christian Neukirchen <chneukirchen at gmail dot com> in the dmsetup(8) manual on Linux. This patch also improves the indentation of XDGA(3) and XrmGetResource(3).
* Decouple the token code for "no request or macro" from the individualschwarze2015-04-191-2/+2
| | | | | | high-level parsers to allow further unification of functions that only need to recognize this code, but that don't care about different high-level macrosets beyond that.
* Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),schwarze2015-04-181-10/+6
| | | | | | man_node() from the mandoc(3) semi-public interface and the internal wrapper functions print_mdoc() and print_man() from the HTML formatters. Minus 60 lines of code, no functional change.
* Replace the structs mdoc and man by a unified struct roff_man.schwarze2015-04-181-2/+2
| | | | | Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
* Do not mistreat empty arguments to font alternating macrosschwarze2015-04-061-2/+5
| | | | as vertical spacing requests. Bug found with xmahjongg(6).