aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
Commit message (Collapse)AuthorAgeFilesLines
* improve rounding rules for scaling unitsIngo Schwarze2017-06-141-4/+4
| | | | in horizontal orientation in the terminal formatter
* make the internal a2roffsu() interface more powerful by returningIngo Schwarze2017-06-081-2/+4
| | | | | 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,Ingo Schwarze2017-06-071-74/+76
| | | | | | 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.Ingo Schwarze2017-06-041-23/+9
| | | | | | 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:Ingo Schwarze2017-06-041-41/+12
| | | | | | Eliminate the "overstep" state variable. The information is already contained in "viscol". Minus 60 lines of code, no functional change intended.
* Minimal implementation of the \h (horizontal motion) escape sequence.Ingo Schwarze2017-06-011-2/+3
| | | | Good enough to cope with the average DocBook insanity.
* fix formatting of intermediate punctuation in .LkIngo Schwarze2017-05-301-7/+15
|
* Trailing \c suppresses the output line break even ifIngo Schwarze2017-05-091-2/+3
| | | | | the next line is a text line starting with whitespace. Quirk found in the sysutils/rancid port.
* Basic implementation of the roff(7) .ta (define tab stops) request.Ingo Schwarze2017-05-071-11/+29
| | | | | | 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 placeIngo Schwarze2017-05-051-37/+9
| | | | now that this actually saves code: -70 LOC.
* move .ll to the roff modulesIngo Schwarze2017-05-051-20/+5
|
* Move handling of the roff(7) .ft request from the man(7)Ingo Schwarze2017-05-051-1/+2
| | | | | 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,Ingo Schwarze2017-05-041-8/+2
| | | | | | | 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:Ingo Schwarze2017-05-041-5/+17
| | | | | Generate the first node on the roff level: .br Fix some column numbers in diagnostic messages while here.
* Continue parser unification:Ingo Schwarze2017-04-241-5/+7
| | | | | | | | * 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 handling of trailing punctuation in .Lk.Ingo Schwarze2017-04-171-6/+12
| | | | | | | | | This macro is unusual in so far as trailing punction needs to remain inside the scope because it must be inside, not after the display of long URIs in terminal output mode. Improves formatting of fw_update(1), help(1), less(1), sendbug(1), acx(4), inet6(4), ipsec(4), oce(4), isakmpd.conf(5), afterboot(8), release(8), traceroute(8).
* Show long .Lk URIs in like an indented display, similar to groff.Ingo Schwarze2017-04-141-1/+11
| | | | Suggested by bentley@.
* Do not make the colon after the .Lk link text italic.Ingo Schwarze2017-04-141-2/+2
| | | | I just pushed the same change to GNU troff.
* Use typographic quotes rather than '"' for .Rs %T (no change for -TasciiIngo Schwarze2017-02-171-3/+5
| | | | | output, of course). Patch from bentley@ in November 2014. This can be committed now because groff merged Anthony's patch yesterday.
* Surprisingly, groff does not support scaling units in .Bl -columnIngo Schwarze2017-02-161-5/+11
| | | | | | column width specifiers, so stop supporting them, too. As a side effect, this fixes an assertion failure that tb@ found with afl(1), triggered by: .Bl -column -4n
* Remove the ENDBODY_NOSPACE flag, simplifying the code.Ingo Schwarze2017-02-161-9/+1
| | | | | | | | Comparing to groff output, it appears that all cases where it was used and made a difference actually require the opposite, ENDBODY_SPACE. I have no idea why i added it back in 2010; maybe to compensate for some other bug that has long been fixed.
* The .Nm macro does not only use the default name when it has noIngo Schwarze2017-02-061-4/+2
| | | | | | | | | | argument, but also when the first argument is a child macro. Arcane issue found in the FreeBSD cxgbetool(8) manual that Baptiste Daroussin <bapt at FreeBSD> sent me long ago for a different reason. While solving this, switch to the new technique of doing text production in the validator, reducing code duplication in the formatters, which also makes -Ttree output clearer.
* Do not fix the default indent for all subsequent files; some may useIngo Schwarze2017-02-041-1/+4
| | | | | a different macro language and hence require a different indent. You can see the effect with "man -a 1 host hostname".
* Do text production for .Bt, .Ex, .Rv, .Ud at the validation stageIngo Schwarze2017-01-111-107/+5
| | | | | | | | | rather than in the formatters. Use NODE_NOSRC flag for .Lb and NODE_NOSRC and NODE_NOPRT for .St. Results in a more rigorous syntax tree and in 135 lines less code. This work was triggered by a question from Abhinav Upadhyay <er dot abhinav dot upadhyay at gmail dot com> (NetBSD) on discuss@.
* Use new NODE_NOSRC and NODE_NOPRT flags for .Bx and .At.Ingo Schwarze2017-01-101-26/+2
| | | | More rigorous AST and 40 lines less code.
* For the .Ux/.Ox family of macros, do text production at the validationIngo Schwarze2017-01-101-42/+18
| | | | | stage rather than in each and every individual formatter, using the new NODE_NOSRC flag. More rigorous and also ten lines less code.
* unify names of AST node flags; no change of cpp outputIngo Schwarze2017-01-101-24/+24
|
* Introduce flags NODE_NOSRC and NODE_NOPRT for AST nodes.Ingo Schwarze2017-01-101-2/+13
| | | | | | | | | Use them to mark generated nodes and nodes that shall not produce output. Let -Ttree output mode display these new flags. Use NODE_NOSRC for .Ar, .Mt, and .Pa default arguments. Use NODE_NOPRT for .Dd, .Dt, and .Os. These will help to make handling of text production macros more rigorous.
* use .Fn in custom sections for tagging, in addition to in DESCRIPTION;Ingo Schwarze2016-11-081-2/+2
| | | | written on the TGV Paris-Strassbourg
* tag leading .Dv, .Li, and .No in .It;Ingo Schwarze2016-11-081-1/+2
| | | | written on the TGV Paris-Strassbourg
* implement tag priority 0, which will tag only keys that appear asIngo Schwarze2016-11-081-3/+25
| | | | | tag candidates exactly once, and use it for .Em and .Sy; written on the TGV Toulouse-Paris
* generate two tag entries from list entries of the formIngo Schwarze2016-11-081-2/+4
| | | | | .It Macro tag1 ... | Macro tag2 ... written on the TGV Toulouse-Paris
* Delete complicated code dealing with .Bl -tag without -width,Ingo Schwarze2016-10-091-2/+2
| | | | | | | | | | | | and just let it default to -width 6n, which agrees with the traditional -width Ds that is still in widespread use. I just pushed a patch upstream to GNU roff that does the same for groff_mdoc(7). Before, groff contained code that was even more complicated than mandoc, but both resulted in quite different user-visible output. Now, both agree, and output is nicer for both. Useless complication noticed by Carsten Kunze (Heirloom roff).
* Delete the redundant "nchild" member of struct roff_node, replacingIngo Schwarze2016-01-081-25/+26
| | | | | | | | 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.
* Use "-" rather than "\(hy" for the heads of .Bl -dash and -hyphen lists.Ingo Schwarze2015-10-121-2/+2
| | | | | | | In UTF-8 output, that renders as ASCII HYPHEN-MINUS (U+002D) rather than HYPHEN (U+2010), which looks better and matches groff. In ASCII output, it makes no difference. Suggested by naddy@.
* To make the code more readable, delete 283 /* FALLTHROUGH */ commentsIngo Schwarze2015-10-121-55/+4
| | | | | | 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 functionIngo Schwarze2015-10-061-79/+79
|
* /* NOTREACHED */ after abort() is silly, delete itIngo Schwarze2015-09-261-5/+1
|
* Trailing whitespace is significant when determining the width of a tagIngo Schwarze2015-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@.
* The .Dv macro actually forces normal font.Ingo Schwarze2015-09-141-2/+2
|
* Simplify and make tag_put() more efficient by integrating tag_get()Ingo Schwarze2015-07-251-11/+7
| | | | | into it and by only handling NUL-terminated strings. Minus 25 lines of code, no functional change.
* implement tagging for .ErIngo Schwarze2015-07-251-2/+16
|
* basic tag support for function names; written at YYCIngo Schwarze2015-07-251-3/+18
|
* basic support for tag priorities; written at YYCIngo Schwarze2015-07-251-3/+3
|
* Initial, still somewhat experimental implementation to leverageIngo Schwarze2015-07-171-2/+22
| | | | | | | | | | | | | | | less(1) -T and :t ctags(1)-like functionality to jump to the definitions of various terms inside manual pages. To be polished in the tree, so bear with me and report issues. Technically, if less(1) is used as a pager, information is collected by the mdoc(7) terminal formatter, first stored using the ohash library, then ultimately written to a temporary file which is passed to less via -T. No change intended for other output formatters or when running without a pager. Based on an idea from Kristaps using feedback from many, in particular phessler@ nicm@ millert@ halex@ doug@ kspillner@ deraadt@.
* Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),Ingo Schwarze2015-04-181-9/+7
| | | | | | 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.Ingo Schwarze2015-04-181-2/+2
| | | | | Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
* Rounding rules for horizontal scaling widths are more complicated.Ingo Schwarze2015-04-041-2/+2
| | | | | | | | | | | | | There is a first rounding to basic units on the input side. After that, rounding rules differ between requests and macros. Requests round to the nearest possible character position. Macros round to the next character position to the left. Implement that by changing the return value of term_hspan() to basic units and leaving the second scaling and rounding stage to the formatters instead of doing it in the terminal handler. Improves for example argtable2(3).
* Third step towards parser unification:Ingo Schwarze2015-04-021-13/+7
| | | | | Replace struct mdoc_meta and struct man_meta by a unified struct roff_meta. Written of the train from London to Exeter on the way to p2k15.
* Second step towards parser unification:Ingo Schwarze2015-04-021-14/+14
| | | | | | | | | Replace struct mdoc_node and struct man_node by a unified struct roff_node. To be able to use the tok member for both mdoc(7) and man(7) without defining all the macros in roff.h, sacrifice a tiny bit of type safety and make tok an int rather than an enum. Almost mechanical, no functional change. Written on the Eurostar from Bruxelles to London on the way to p2k15.