summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/man.c
AgeCommit message (Collapse)Author
2015-10-22move man(7) validation into the dedicated validation phase, tooIngo Schwarze
2015-10-06modernize style: "return" is not a function; ok cmp(1)Ingo Schwarze
2015-09-04Fill mode changes don't break next-line scope in all cases,Ingo Schwarze
in particular not for tagged paragraphs. Issue found by Christian Neukirchen <chneukirchen at gmail dot com> in the exiv2(1) manual page.
2015-04-23Unify mdoc_deroff() and man_deroff() into a common function deroff().Ingo Schwarze
No functional change except that for mdoc(7), it now skips leading escape sequences just like it already did for man(7). Escape sequences rarely occur in mdoc(7) code and if they do, skipping them is an improvement in this context. Minus 30 lines of code.
2015-04-23Get rid of two empty wrapper functions. No functional change.Ingo Schwarze
2015-04-19Unify trickier node handling functions.Ingo Schwarze
* 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.
2015-04-19Unify some node handling functions that use TOKEN_NONE.Ingo Schwarze
* 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.
2015-04-19Decouple the token code for "no request or macro" from the individualIngo Schwarze
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.
2015-04-19Unify node handling functions:Ingo Schwarze
* 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.
2015-04-18Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),Ingo Schwarze
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.
2015-04-18Unify {mdoc,man}_{alloc,reset,free}() into roff_man_{alloc,reset,free}().Ingo Schwarze
Minus 80 lines of code, no functional change. Written on the train from Koeln to Wolfsburg returning from p2k15.
2015-04-18Move mdoc_hash_init() and man_hash_init() to libmandoc.hIngo Schwarze
and call them from mparse_alloc() and choose_parser(), preparing unified allocation of struct roff_man.
2015-04-18Profit from the unified struct roff_man and reduce the number ofIngo Schwarze
arguments of mparse_result() by one. No functional change. Written on the ICE Bruxelles-Koeln on the way back from p2k15.
2015-04-18Replace the structs mdoc and man by a unified struct roff_man.Ingo Schwarze
Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
2015-04-02Third step towards parser unification:Ingo Schwarze
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.
2015-04-02Second step towards parser unification:Ingo Schwarze
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.
2015-04-02First step towards parser unification:Ingo Schwarze
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.
2015-01-30starting a tbl(7) breaks man(7) next-line scope;Ingo Schwarze
triggered by a bug report from jsg@
2015-01-24Strangely, ignoring the roff(7) .na request was implemented in the man(7)Ingo Schwarze
parser. Simplify the code by moving it into the roff(7) parser, also making it work for mdoc(7).
2015-01-15Fatal errors no longer exist.Ingo Schwarze
If a file can be opened, mandoc will produce some output; at worst, the output may be almost empty. Simplifies error handling and frees a message type for future use.
2014-12-28mdoc(7) already uses the mandoc(1) -Ios argument in the footer lineIngo Schwarze
when .Os has no argument, so do the same for man(7) when .TH has less than four arguments; there is no reason to treat both differently. Issue found following a question from Thomas Klausner <wiz at NetBSD>.
2014-11-28Simplify by making the eqn and tbl steering functions void;Ingo Schwarze
no functional change, minus 15 lines of code.
2014-11-28Simplify by making many functions in the man(7) parser void,Ingo Schwarze
and some cleanup; no functional change, minus 70 lines.
2014-11-19Escape sequences terminate high-level macro names, and when doing so,Ingo Schwarze
they are ignored, just in the same way as for request names and for low-level macro names. This also cures a warning in the pod2man(1) preamble.
2014-11-03Allow the five man(7) font macros to concatenate their line arguments,Ingo Schwarze
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.
2014-10-20correct the spacing after in-line equationsIngo Schwarze
that start at the beginning of an input line but end before the end of an input line
2014-10-20correct spacing before inline equationsIngo Schwarze
2014-09-06Simplify by handling empty request lines at the one logical placeIngo Schwarze
in the roff parser instead of in three other places in other parsers. No functional change.
2014-08-08Simplify man(7) validation:Ingo Schwarze
Drop pre-handlers, they were almost unused. Drop the needless complexity of allowing more than one post-handler. This saves one internal interface function, one static function, one private struct definition, sixteen static arrays, and 45 lines of code. No functional change.
2014-08-08mention requests and macros in more messagesIngo Schwarze
2014-08-08Simplify: replace one global flag by one local variableIngo Schwarze
and remove three unused global flags. No functional change.
2014-07-07Clean up ERROR messages related to document structure and macros:Ingo Schwarze
Hierarchical naming and mention macro names in messages.
2014-07-07Simplify man_unscope(), removing 18 lines of code, that is,Ingo Schwarze
removing one function argument, one function definition, three function invocations and two pointless assert()s. No functional change.
2014-07-06Clean up messages related to plain text and to escape sequences.Ingo Schwarze
* Mention invalid escape sequences and string names, and fallbacks. * Hierarchical naming.
2014-05-07Do not segfault in makewhatis -Q if the next .SH after .SH NAMEIngo Schwarze
does not have any arguments. Crash found by nigel@ in kermit(1).
2014-04-20KNF: case (FOO): -> case FOO, remove /* LINTED */ and /* ARGSUSED */,Ingo Schwarze
remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
2014-03-30Implement the roff(7) .ll (line length) request.Ingo Schwarze
Found by naddy@ in the textproc/enchant(1) port. Of course, do not use this in new manuals.
2014-03-23Skip leading escape sequences in man_deroff(). Helps indexing ofIngo Schwarze
some manuals containing overzealous escaping in their NAME section.
2014-03-22If a man(7) NAME section contains macros, avoid truncated or emptyIngo Schwarze
entries for .Nd in mandocdb(8), instead use the macro content recursively. This improves indexing of more than 200 manuals in Xenocara, i.e. more than 15%, in particular GL and some Xkb.
2014-03-21The files mandoc.c and mandoc.h contained both specialised low-levelIngo Schwarze
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.
2014-01-06Joerg Sonnenberger contributed copyrightable amounts of text toIngo Schwarze
some files. To make it clear that he also put his contributions under the ISC license, with his explicit permission, add his Copyright notice to the relevant files. No code change.
2014-01-05Add an option -Q (quick) to mandocdb(8)Ingo Schwarze
for accelerated generation of reduced-size databases. Implement this by allowing the parsers to optionally abort the parse sequence after the NAME section. While here, garbage collect the unused void *arg attribute of struct mparse and mparse_alloc(). This reduces the processing time of mandocdb(8) on /usr/share/man by a factor of 2 and the database size by a factor of 4. However, it still takes 5 times the time and 6 times the space of makewhatis(8), so more work is clearly needed.
2013-12-30Simplify: Remove an unused argument from the mandoc_eos() function.Ingo Schwarze
No functional change.
2013-11-10Ignore blank lines right after .SH and .SS.Ingo Schwarze
Improves the rendering of gpg(1); issue reported by jca on ports.
2013-10-17Implement the .UR/.UE block (uniform resource identifier) introduced in theIngo Schwarze
man-ext macros by Eric S. Raymond, enabled by default in groff_man(7). Usual disclaimer: You don't write new man(7) code, so you are not going to use these, either. Improves e.g. the bzr(1) and etherape(1) manuals. Thanks to naddy@ for bringing these to my attention.
2012-11-17Cleanup naming of local variables to make the code easier on the eye:Ingo Schwarze
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
2012-07-14Translate blank input lines to .sp just like in mdoc(7),Ingo Schwarze
and ignore .sp after .PP. This fixes vertical spacing for blank lines after .PP and for .sp after .PP.
2012-07-07Support the .cc request; code by kristaps@, tests by me.Ingo Schwarze
Needed for sqlite3(1) as reported by espie@.
2012-06-02Minimal implementation of .EX and .EE for GNU compatibility.Ingo Schwarze
Do not use this, it is not portable and only defined in esr's man-ext. For example, sox(1) wants these macros.
2012-02-26Support .OP, one of the extended man macros; from kristaps@.Ingo Schwarze
Do not use this GNU extension, we take it for compatibility only.