summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/man.c
AgeCommit message (Collapse)Author
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.
2011-11-16When a .TP block is broken but already contains a head element,Ingo Schwarze
do not abort(), but delete the head together with the block itself. Problem found and patch provided by joerg@, thanks!
2011-11-05When the HEAD scope of .TP is broken by another block macro,Ingo Schwarze
do not abort with a FATAL error, but report a regular ERROR, remove the broken .TP from the syntax tree, and prod on. Reported repeatedly by ports people, at least by brad@ and jeremy@. Also fixes rendition(4) in Xenocara.
2011-10-09Sync to version 1.12.0; all code by kristaps@:Ingo Schwarze
Implement .Rv in -Tman. Let -man -Tman work a bit like cat(1). Add the -Ofragment option to -T[x]html. Minor fixes in -T[x]html. Lots of apropos(1) and -Tman code cleanup.
2011-09-18sync to version 1.11.7 from kristaps@Ingo Schwarze
main new feature: support the roff(7) .tr request plus various bugfixes and some refactoring regressions are so minor that it's better to get this in and fix them in the tree
2011-09-18sync to version 1.11.5:Ingo Schwarze
adding an implementation of the eqn(7) language by kristaps@ So far, only .EQ/.EN blocks are handled, in-line equations are not, and rendering is not yet very pretty, but the parser is fairly complete.
2011-04-24Merge version 1.11.1:Ingo Schwarze
Again lots of cleanup and maintenance work by kristaps@. - simplify error reporting: less function pointers, more mandoc_[v]msg - main: split document parsing out of main.c into read.c - roff, mdoc, man: improved recognition of control characters - roff: better handling of if/else stack overflows - roff: add some predefined strings for backward compatibility - mdoc, man: empty sections are not errors - mdoc: move delimiter handling to libmdoc - some header restructuring and some minor features and fixes This merge causes two minor regressions that i will fix in separate commits right afterwards.
2011-04-21Merge version 1.10.10:Ingo Schwarze
lots of cleanup and maintenance work by kristaps@. - move some main.c globals into struct curparse - move mandoc_*alloc to mandoc.h such that all code can use them - make mandoc_isdelim available to formatting frontends - dissolve mdoc_strings.c, move the code where it is used - make all error reporting functions void, their return values were useless - and various minor cleanups and fixes
2011-03-20Import the foundation for eqn(7) support.Ingo Schwarze
Written by kristaps@. For now, i'm adding one line to each of the four frontends to just pass the input text through to the output, not yet interpreting any of then eqn keywords.
2011-03-07Clean up date handling,Ingo Schwarze
as a first step to get rid of the frequent petty warnings in this area: - always store dates as strings, not as seconds since the Epoch - for input, try the three most common formats everywhere - for unrecognized format, just pass the date though verbatim - when there is no date at all, still use the current date Originally triggered by a one-line patch from Tim van der Molen, <tbvdm at xs4all dot nl>, which is included here. Feedback and OK on manual parts from jmc@. "please check this in" kristaps@
2011-02-10Tbl code maintenance by kristaps@.Ingo Schwarze
- Remember the line-number of a tbl_span, and use it in messages. - Put *_span_alloc() functions right into the *_addspan() ones, since these are the only places they are called from.
2011-01-16If the first character of a free-form text input line is whitespace,Ingo Schwarze
then it will start a new output line; from kristaps@.
2011-01-09Make sure coding errors cannot make us miss fatal parsing errorsIngo Schwarze
by assert(3)ing valid parser state in the main parsing functions; from kristaps@.
2011-01-04Merge kristaps@' cleaner tbl integration, removing mine;Ingo Schwarze
there are still a few bugs, but fixing these will be easier in tree.
2011-01-01Clean up {mdoc,man}_{p,v}msg invocations:Ingo Schwarze
Ignore the return values, they are constant anyway. From kristaps@.
2010-12-19Remove `i' and `r' macro handlers. These macros, originally part of theIngo Schwarze
me package, aren't recognised by "groff -mandoc" so we don't need to do so either. Besides, they are not used in base or Xenocara, and only at two or three places in one single port, which are probably typos. From kristaps@.
2010-12-07Complete the merge of bsd.lv version 1.10.7:Ingo Schwarze
No more functional changes, just sync ordering, comments and white space.
2010-12-01Merge man_action.c into man_validate.c.Ingo Schwarze
Same as for mdoc_action.c, but much simpler. Work by kristaps@, re-applying OpenBSD changes on top.
2010-11-29Now that we have proper .de support in the roff(7) library,Ingo Schwarze
it is time to remove the .Sp, .Vb, and .Ve kludge that was added to the man(7) library to build Perl manuals.
2010-11-29Downgrade the easier of the two cases of MANDOCERR_SYNTLINESCOPEIngo Schwarze
to MANDOCERR_LINESCOPE, i.e. from FATAL to ERROR. That is, when an element next line scope is empty except for one or more NSCOPED macros (like in .B .br .br .B), throw away the empty element including its NSCOPED children such that the parser can prod on. While here, improve the error message and tell the user which element has been thrown away.
2010-11-29Implement the roff .ft (change font) request for man(7).Ingo Schwarze
Of course, we don't want to encourage low-level physical markup, but pod2man(1) writes such requests, so Perl manuals contain them, and some Xenocara and lots and lots of ports manuals use them as well. In base and Xenocara, this will reduce mandoc -Tlint ERROR noise; in ports, it will improve rendering of many manuals.
2010-11-28To avoid FATAL errors, we have been parsing and ignoring the roffIngo Schwarze
requests .am, .ami, .am1, .dei, and .rm for a long time. Since ignoring them can (rarely) cause information loss and serious misformatting, throw an ERROR: NOT IMPLEMENTED when finding them. Implementing them would not be too difficult, but they are so rare in practice that i can find better use for my time right now. In this context, - Put the string "NOT IMPLEMENTED" into two other error messages as well, to distinguish them from those caused by broken input. - Print the string "unknown macro" once, not twice in the error message associated with MANDOCERR_MACRO, and begin printing the buffer at the point where the unknown macro really is, not at the start of line.