summaryrefslogtreecommitdiffstats
path: root/man_macro.c
Commit message (Collapse)AuthorAgeFilesLines
* Support nesting of elements with next-line scope.Ingo Schwarze2018-08-261-31/+36
| | | | For example, ksh93(1) needs this for .B\n.SM.
* paragraphs can contain .MT and .UR blocksIngo Schwarze2018-08-181-1/+2
|
* .RE causes a line break even if .RS is not openIngo Schwarze2018-08-181-0/+6
|
* end of sentence detection after .ME and .UE, useful for some GNU manualsIngo Schwarze2018-08-181-0/+2
|
* Two consecutive .SY blocks only get a blank line in betweenIngo Schwarze2018-08-181-1/+8
| | | | if the first one is explicitly closed with .YS.
* implement the GNU man-ext .SY/.YS (synopsis block) macro in man(7),Ingo Schwarze2018-08-181-0/+5
| | | | used in most manual pages of the groff package
* Remove more pointer arithmetic passing via regions outside the arrayIngo Schwarze2018-08-171-9/+15
| | | | | 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),Ingo Schwarze2018-08-161-1/+2
| | | | used for example by groff_diff(7)
* fix incomplete variable renaming in previous;Ingo Schwarze2018-08-151-1/+1
| | | | found by Thomas Klausner <wiz at NetBSD> via a compiler warning
* support tail arguments on the .ME and .UE macros,Ingo Schwarze2018-08-141-16/+23
| | | | used for example in the ditroff(7) manual of the groff package
* add support for the MT and ME mailto macros, used for example in wg(8);Ingo Schwarze2017-06-251-0/+5
| | | | patch from bentley@
* if .in is used inside the .TP head, it's always relativeIngo Schwarze2017-06-171-1/+1
|
* Partial support for the \n[an-margin] number register.Ingo Schwarze2017-06-131-1/+14
| | | | | | | | | | | | | | | Manuals autogenerated from reStructuredText are reckless enough to peek at this non-portable, implementation-dependent, highly groff-specific internal register - for no good reason, because the man(7) language natively provides in a much simpler way what they are trying to emulate here with much fragility. A full implementation would be very hard because it would require access to output-device-specific formatting data at the roff(7) preprocessor stage, which mandoc doesn't support at all. So hardcode a few magic numbers as reStructuredText expects them for terminal output. For other output modes (like HTML), code using this register is utterly broken anyway.
* Move .sp to the roff modules. Enough infrastructure is in placeIngo Schwarze2017-05-051-3/+1
| | | | now that this actually saves code: -70 LOC.
* move .ll to the roff modulesIngo Schwarze2017-05-051-1/+0
|
* Move handling of the roff(7) .ft request from the man(7)Ingo Schwarze2017-05-051-2/+1
| | | | | modules to the new roff(7) modules. As a side effect, mdoc(7) now handles .ft, too. Of course, do not use that.
* Parser reorg:Ingo Schwarze2017-05-041-3/+1
| | | | | 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-17/+14
| | | | | | | | * 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[].
* unify names of AST node flags; no change of cpp outputIngo Schwarze2017-01-101-5/+5
|
* Delete the redundant "nchild" member of struct roff_node, replacingIngo Schwarze2016-01-081-1/+1
| | | | | | | | 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.
* move man(7) validation into the dedicated validation phase, tooIngo Schwarze2015-10-221-18/+4
|
* modernize style: "return" is not a functionIngo Schwarze2015-10-061-2/+2
|
* /* NOTREACHED */ after abort() is silly, delete itIngo Schwarze2015-09-261-1/+0
|
* Fill mode changes don't break next-line scope in all cases,Ingo Schwarze2015-09-041-2/+2
| | | | | | in particular not for tagged paragraphs. Issue found by Christian Neukirchen <chneukirchen at gmail dot com> in the exiv2(1) manual page.
* Get rid of two empty wrapper functions. No functional change.Ingo Schwarze2015-04-231-2/+1
|
* Unify trickier node handling functions.Ingo Schwarze2015-04-191-4/+3
| | | | | | | * man_elem_alloc() -> roff_elem_alloc() * man_block_alloc() -> roff_block_alloc() The functions mdoc_elem_alloc() and mdoc_block_alloc() remain for now because they need to do mdoc(7)-specific argument processing.
* Unify some node handling functions that use TOKEN_NONE.Ingo Schwarze2015-04-191-4/+4
| | | | | | | | * mdoc_word_alloc(), man_word_alloc() -> roff_word_alloc() * mdoc_word_append(), man_word_append() -> roff_word_append() * mdoc_addspan(), man_addspan() -> roff_addtbl() * mdoc_addeqn(), man_addeqn() -> roff_addeqn() Minus 50 lines of code, no functional change.
* Unify node handling functions:Ingo Schwarze2015-04-191-6/+8
| | | | | | | | | | | * node_alloc() for mdoc and man_node_alloc() -> roff_node_alloc() * node_append() for mdoc and man_node_append() -> roff_node_append() * mdoc_head_alloc() and man_head_alloc() -> roff_head_alloc() * mdoc_body_alloc() and man_body_alloc() -> roff_body_alloc() * mdoc_node_unlink() and man_node_unlink() -> roff_node_unlink() * mdoc_node_free() and man_node_free() -> roff_node_free() * mdoc_node_delete() and man_node_delete() -> roff_node_delete() Minus 130 lines of code, no functional change.
* Replace the structs mdoc and man by a unified struct roff_man.Ingo Schwarze2015-04-181-8/+8
| | | | | Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
* Vastly simplify man(7) block unwinding, similar to mdoc_macro.c 1.171.Ingo Schwarze2015-04-031-118/+33
| | | | | Drop one enum type, two static functions, 70 lines of code. Also fixes the mpeg_encode(1) manual reported broken by naddy@.
* It turns out the man(7) parser suffers from unintelligible handlingIngo Schwarze2015-04-031-1/+1
| | | | | | | | of block rewinding, just like then mdoc(7) parser did. First step in getting rid of rew_scope(): Replace the only call where the target block is known. This commit is analogous to mdoc_macro.c rev. 1.167. One down, three to go.
* Second step towards parser unification:Ingo Schwarze2015-04-021-17/+16
| | | | | | | | | 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.
* First step towards parser unification:Ingo Schwarze2015-04-021-28/+29
| | | | | | Replace enum mdoc_type and enum man_type by a unified enum roff_type. Almost mechanical, no functional change. Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.
* The .PD macro can occur in next-line scope. Fixes zshmisc(1).Ingo Schwarze2015-03-201-1/+1
| | | | Issue reported by Christian Neukirchen <chneukirchen at gmail dot com>.
* Simplify by almost halving the number of macro flags:Ingo Schwarze2015-03-201-15/+17
| | | | | | | 1. MAN_EXPLICIT was used iff fp == blk_exp, so just test fp. 2. MAN_FSCOPED was used only for TP, so just test for TP. 3. MAN_NOCLOSE was completely unused. No functional change.
* better error reporting regarding .OP .RS .UR .TH argumentsIngo Schwarze2015-02-061-16/+10
|
* better diagnostics about excess arguments to .PD .ft .spIngo Schwarze2015-02-061-0/+7
|
* better error reporting for .br .fi .nf with argumentsIngo Schwarze2015-02-061-0/+7
|
* preserve .PP before .RE; effect found in audio/pms(1)Ingo Schwarze2015-01-241-1/+12
|
* Strangely, ignoring the roff(7) .na request was implemented in the man(7)Ingo Schwarze2015-01-241-1/+0
| | | | | parser. Simplify the code by moving it into the roff(7) parser, also making it work for mdoc(7).
* Support .RE with an argument; needed for audio/pms(1).Ingo Schwarze2015-01-241-2/+22
|
* Explicit block closure macros clobber next-line block head scope,Ingo Schwarze2014-12-161-2/+2
| | | | | just like explicit block macros themselves. Fixing an assertion failure jsg@ found with afl.
* Simplify by making many functions in the man(7) parser void,Ingo Schwarze2014-11-281-86/+53
| | | | and some cleanup; no functional change, minus 70 lines.
* Allow the five man(7) font macros to concatenate their line arguments,Ingo Schwarze2014-11-031-7/+10
| | | | | | | the same way the mdoc(7) macros marked MDOC_JOIN do it. In -Thtml, this removes bogus <br/> when the font macros are used in no-fill mode; issue found by jsg@ in the Xcursor(3) SYNOPSIS. As a bonus, this slightly reduces the size of the syntax tree.
* When the first child of the node being validated gets deleted duringIngo Schwarze2014-08-181-1/+12
| | | | | | | | | | | | | | | validation, man_node_unlink() switches to MAN_NEXT_CHILD. After that, we have to switch back to MAN_NEXT_SIBLING after completing validation, or subsequent parsing would add content into an already closed node, clobbering potentially existing children, causing information loss and a memory leak. Bug found by kristaps@ with valgrind in groff(7) on Mac OS X. Note that the switch back must be conditional, for if the node being validated itself gets deleted, we must *not* go to MAN_NEXT_SIBLING, which would not only yield wrong results in general but also crash in malformed manuals having an empty paragraph before the first .SH, for example OpenBSD c++filt(1).
* Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.Ingo Schwarze2014-08-101-2/+2
| | | | | | Include <sys/types.h> where needed, it does not belong in config.h. Remove <stdio.h> from config.h; if it is missing somewhere, it should be added, but i cannot find a *.c file where it is missing.
* Improve handling of next-line scope broken by end of file.Ingo Schwarze2014-07-301-7/+29
| | | | | | Detect the condition earlier, report in the error message which block is broken, and delete the broken block. Consequently, empty section headers can no longer happen.
* garbage collect three unused global flags; no functional changeIngo Schwarze2014-07-301-7/+0
|
* delete forgotten, obsolete rew_warn() prototypeIngo Schwarze2014-07-091-2/+0
|
* Clean up ERROR messages related to document structure and macros:Ingo Schwarze2014-07-071-2/+3
| | | | Hierarchical naming and mention macro names in messages.