summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* mention requests and macros in more messagesschwarze2014-08-081-3/+3
|
* Simplify: replace one global flag by one local variableschwarze2014-08-081-55/+13
| | | | and remove three unused global flags. No functional change.
* Clean up ERROR messages related to document structure and macros:schwarze2014-07-071-3/+3
| | | | Hierarchical naming and mention macro names in messages.
* Simplify man_unscope(), removing 18 lines of code, that is,schwarze2014-07-071-4/+4
| | | | | | removing one function argument, one function definition, three function invocations and two pointless assert()s. No functional change.
* Clean up messages related to plain text and to escape sequences.schwarze2014-07-061-4/+7
| | | | | * Mention invalid escape sequences and string names, and fallbacks. * Hierarchical naming.
* Do not segfault in makewhatis -Q if the next .SH after .SH NAMEschwarze2014-05-071-4/+7
| | | | does not have any arguments. Crash found by nigel@ in kermit(1).
* KNF: case (FOO): -> case FOO, remove /* LINTED */ and /* ARGSUSED */,schwarze2014-04-201-46/+30
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* Implement the roff(7) .ll (line length) request.schwarze2014-03-301-2/+2
| | | | | Found by naddy@ in the textproc/enchant(1) port. Of course, do not use this in new manuals.
* Skip leading escape sequences in man_deroff(). Helps indexing ofschwarze2014-03-231-4/+11
| | | | some manuals containing overzealous escaping in their NAME section.
* If a man(7) NAME section contains macros, avoid truncated or emptyschwarze2014-03-221-1/+41
| | | | | | 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.
* The files mandoc.c and mandoc.h contained both specialised low-levelschwarze2014-03-211-1/+2
| | | | | | | 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.
* Joerg Sonnenberger contributed copyrightable amounts of text toschwarze2014-01-061-1/+2
| | | | | | 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.
* Add an option -Q (quick) to mandocdb(8)schwarze2014-01-051-2/+10
| | | | | | | | | | | | | | | 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.
* Simplify: Remove an unused argument from the mandoc_eos() function.schwarze2013-12-301-2/+2
| | | | No functional change.
* Ignore blank lines right after .SH and .SS.schwarze2013-11-101-6/+12
| | | | Improves the rendering of gpg(1); issue reported by jca on ports.
* Implement the .UR/.UE block (uniform resource identifier) introduced in theschwarze2013-10-171-2/+3
| | | | | | | | 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.
* Cleanup naming of local variables to make the code easier on the eye:schwarze2012-11-171-126/+126
| | | | | | | | 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
* Translate blank input lines to .sp just like in mdoc(7),schwarze2012-07-141-3/+4
| | | | | and ignore .sp after .PP. This fixes vertical spacing for blank lines after .PP and for .sp after .PP.
* Support the .cc request; code by kristaps@, tests by me.schwarze2012-07-071-2/+2
| | | | Needed for sqlite3(1) as reported by espie@.
* Minimal implementation of .EX and .EE for GNU compatibility.schwarze2012-06-021-2/+2
| | | | | Do not use this, it is not portable and only defined in esr's man-ext. For example, sox(1) wants these macros.
* Support .OP, one of the extended man macros; from kristaps@.schwarze2012-02-261-2/+2
| | | | Do not use this GNU extension, we take it for compatibility only.
* When a .TP block is broken but already contains a head element,schwarze2011-11-161-3/+8
| | | | | do not abort(), but delete the head together with the block itself. Problem found and patch provided by joerg@, thanks!
* When the HEAD scope of .TP is broken by another block macro,schwarze2011-11-051-2/+29
| | | | | | | 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.
* Sync to version 1.12.0; all code by kristaps@:schwarze2011-10-091-1/+9
| | | | | | | | 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.
* sync to version 1.11.7 from kristaps@schwarze2011-09-181-9/+2
| | | | | | | | 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
* sync to version 1.11.5:schwarze2011-09-181-5/+5
| | | | | | | | 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.
* Merge version 1.11.1:schwarze2011-04-241-68/+47
| | | | | | | | | | | | | | 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.
* Merge version 1.10.10:schwarze2011-04-211-3/+3
| | | | | | | | | | 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
* Import the foundation for eqn(7) support.schwarze2011-03-201-1/+17
| | | | | | | | 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.
* Clean up date handling,schwarze2011-03-071-3/+3
| | | | | | | | | | | | 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@
* Tbl code maintenance by kristaps@.schwarze2011-02-101-21/+10
| | | | | | - 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.
* If the first character of a free-form text input line is whitespace,schwarze2011-01-161-9/+16
| | | | | then it will start a new output line; from kristaps@.
* Make sure coding errors cannot make us miss fatal parsing errorsschwarze2011-01-091-10/+10
| | | | | by assert(3)ing valid parser state in the main parsing functions; from kristaps@.
* Merge kristaps@' cleaner tbl integration, removing mine;schwarze2011-01-041-43/+60
| | | | there are still a few bugs, but fixing these will be easier in tree.
* Clean up {mdoc,man}_{p,v}msg invocations:schwarze2011-01-011-7/+7
| | | | | Ignore the return values, they are constant anyway. From kristaps@.
* Remove `i' and `r' macro handlers. These macros, originally part of theschwarze2010-12-191-6/+5
| | | | | | | 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@.
* Complete the merge of bsd.lv version 1.10.7:schwarze2010-12-071-3/+4
| | | | No more functional changes, just sync ordering, comments and white space.
* Merge man_action.c into man_validate.c.schwarze2010-12-011-3/+1
| | | | | Same as for mdoc_action.c, but much simpler. Work by kristaps@, re-applying OpenBSD changes on top.
* Now that we have proper .de support in the roff(7) library,schwarze2010-11-291-2/+2
| | | | | it is time to remove the .Sp, .Vb, and .Ve kludge that was added to the man(7) library to build Perl manuals.
* Downgrade the easier of the two cases of MANDOCERR_SYNTLINESCOPEschwarze2010-11-291-23/+8
| | | | | | | | | | | | 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.
* Implement the roff .ft (change font) request for man(7).schwarze2010-11-291-2/+2
| | | | | | | | 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.
* To avoid FATAL errors, we have been parsing and ignoring the roffschwarze2010-11-281-4/+2
| | | | | | | | | | | | | | | 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.
* Do not abort() on tbl errors, reduce the risk that tbl stuff kills a build,schwarze2010-10-161-3/+5
| | | | and provide more useful tbl error messages in a non-intrusive way.
* Move tbl output from plain stdio to mandoc terminal output routines.schwarze2010-10-151-1/+3
| | | | | | This fixes (1) all escape sequences and (2) some aspects of indentation. Table column widths are still way off, though. "move forward" deraadt@
* Minimal glue to integrate tbl into the mandoc man(7) parser and formatter.schwarze2010-10-151-2/+16
| | | | | | The output dosn't look nice yet, escape handling is still missing, but will follow soon. "move forward aggressively :-)" deraadt@
* Implement a simple, consistent user interface for error handling.schwarze2010-08-201-27/+7
| | | | | | | | | | | | | | | | | We now have sufficient practical experience to know what we want, so this is intended to be final: - provide -Wlevel (warning, error or fatal) to select what you care about - provide -Wstop to stop after parsing a file with warnings you care about - provide consistent exit status codes for those warnings you care about - fully document what warnings, errors and fatal errors mean - remove all other cruft from the user interface, less is more: - remove all -f knobs along with the whole -f option - remove the old -Werror because calling warnings "fatal" is silly - always finish parsing each file, unless fatal errors prevent that This commit also includes a couple of related simplifications behind the scenes regarding error handling. Feedback and OK kristaps@; Joerg Sonnenberger (NetBSD) and Sascha Wildner (DragonFly BSD) agree with the general direction.
* Simplify and sync the code and comments for copying the macro nameschwarze2010-08-181-18/+8
| | | | | | in man_pmacro() and mdoc_pmacro(). In particular, no need to use isgraph(3) here, that has already been done in main.c. Joint work by Kristaps and myself, ok kristaps@.
* Sync to bsd.lv; in particular, pull in lots of bug fixes.schwarze2010-07-251-1/+2
| | | | | | | | | | | | | | | | | | | | | new features: * support the .in macro in man(7) * support minimal PDF output * support .Sm in mdoc(7) HTML output * support .Vb and .nf in man(7) HTML output * complete the mdoc(7) manual bug fixes: * do not let mdoc(7) .Pp produce a newline before/after .Sh; reported by jmc@ * avoid double blank lines related to man(7) .sp and .br * let man(7) .nf and .fi flush the line; reported by jsg@ and naddy@ * let "\ " produce a non-breaking space; reported by deraadt@ * discard \m colour escape sequences; reported by J.C. Roberts * map undefined 1-character-escapes to the literal character itself maintenance: * express mdoc(7) arguments in terms of an enum for additional type-safety * simplify mandoc_special() and a2roffdeco() * use strcspn in term_word() in place of a manual loop * minor optimisations in the -Tps and -Thtml formatting frontends
* Text ending in a full stop, exclamation mark or question markschwarze2010-07-161-2/+2
| | | | | | | | | | | | | | | | | | should not flag the end of a sentence if: 1) The punctuation is followed by closing delimiters and not preceded by alphanumeric characters, like in "There is no full stop (.) in this sentence" or 2) The punctuation is a child of a macro and not preceded by alphanumeric characters, like in "There is no full stop .Pq \&. in this sentence" jmc@ and sobrado@ like this
* Merge release 1.10.4 (all code by kristaps@), providing four new features:schwarze2010-07-131-3/+2
| | | | | | | | | | 1) Proper .Bk support: allow output line breaks at input line breaks, but keep input lines together in the output, finally fixing synopses like aucat(1), mail(1) and tmux(1). 2) Mostly finished -Tps (PostScript) output. 3) Implement -Thtml output for .Nm blocks and .Bk -words. 4) Allow iterative interpolation of user-defined roff(7) strings. Also contains some minor bugfixes and some performance improvements.