summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man_validate.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Strangely, ignoring the roff(7) .na request was implemented in the man(7)schwarze2015-01-241-2/+1
| | | | | parser. Simplify the code by moving it into the roff(7) parser, also making it work for mdoc(7).
* mdoc(7) already uses the mandoc(1) -Ios argument in the footer lineschwarze2014-12-281-1/+3
| | | | | | 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>.
* Simplify by making many functions in the man(7) parser void,schwarze2014-11-281-65/+50
| | | | and some cleanup; no functional change, minus 70 lines.
* Bring the handling of defective prologues even closer to groff,schwarze2014-08-081-9/+12
| | | | | | | | | | | | in particular relaxing the distinction between prologue and body and further improving messages. * The last .Dd wins and the last .Os wins, even in the body. * The last .Dt before the first body macro wins. * Missing title in .Dt defaults to UNTITLED. Warn about it. * Missing section in .Dt does not default to 1. But warn about it. * Do not warn multiple times about the same mdoc(7) prologue macro. * Warn about missing .Os. * Incomplete .TH defaults to empty strings. Warn about it.
* Simplify man(7) validation:schwarze2014-08-081-121/+70
| | | | | | | | | 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.
* demacrify: get rid of man_nmsg(), man_pmsg(), mdoc_nmsg(), mdoc_pmsg()schwarze2014-08-081-3/+5
|
* mention requests and macros in more messagesschwarze2014-08-081-6/+10
|
* Improve handling of next-line scope broken by end of file.schwarze2014-08-081-22/+4
| | | | | | 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.
* Clean up ERROR messages related to document structure and macros:schwarze2014-07-071-5/+4
| | | | Hierarchical naming and mention macro names in messages.
* Clean up messages related to plain text and to escape sequences.schwarze2014-07-061-2/+3
| | | | | * Mention invalid escape sequences and string names, and fallbacks. * Hierarchical naming.
* Cleanup with respect to bad macro arguments.schwarze2014-07-051-3/+3
| | | | | | | | * Fix .Sm with invalid arg: move arg out and toggle mode. * Promote "unknown standard" from WARNING to ERROR, it loses information. * Delete MANDOCERR_BADWIDTH, it would only indicate a mandoc(1) bug. * Do not report MANDOCERR_BL_LATETYPE when there is no type at all. * Mention macro names, arguments and fallbacks.
* Clean up messages regarding excess arguments:schwarze2014-07-041-2/+6
| | | | | | | * Downgrade ".Bf -emphasis Em" from FATAL to WARNING. * Mention the macros, the arguments, and the fallbacks. * Hierarchical naming. Also fix the handling of excess .It head arguments in -Tman.
* Clean up warnings related to macros and nesting.schwarze2014-07-021-3/+3
| | | | | | | * Hierarchical naming of enum mandocerr items. * Improve the wording to make it comprehensible. * Mention the offending macro. * Garbage collect one chunk of ancient, long unreachable code.
* Improve "skipping paragraph macro" messages,schwarze2014-07-021-4/+10
| | | | showing which macro was skipped and before or after what.
* Clean up the warnings related to document structure.schwarze2014-07-011-2/+5
| | | | | | | | | * Hierarchical naming of the related enum mandocerr items. * Mention the offending macro, section title, or string. While here, improve some wordings: * Descriptive instead of imperative style. * Uniform style for "missing" and "skipping". * Where applicable, mention the fallback used.
* As suggested by jmc@, only include line and column numbers into messagesschwarze2014-06-201-5/+7
| | | | | | | | | | | | | | when they are meaningful, to avoid confusing stuff like this: $ mandoc /dev/null mandoc: /dev/null:0:1: FATAL: not a manual Instead, just say: mandoc: /dev/null: FATAL: not a manual Another example this applies to is documents having a prologue, but lacking a body. Do not throw a FATAL error for these; instead, issue a warning and show the empty document, in the man(7) case with the same amount of blank lines as groff does. Also downgrade mdoc(7) documents having content before the first .Sh from FATAL to WARNING.
* Start systematic improvements of error reporting.schwarze2014-06-201-4/+9
| | | | | | | | | | | So far, this covers all WARNINGs related to the prologue. 1) hierarchical naming of MANDOCERR_* constants 2) mention the macro name in messages where that adds clarity 3) add one missing MANDOCERR_DATE_MISSING msg 4) fix the wording of one message related to the man(7) prologue Started on the plane back from Ottawa.
* KNF: case (FOO): -> case FOO, remove /* LINTED */ and /* ARGSUSED */,schwarze2014-04-201-48/+42
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* Implement the roff(7) .ll (line length) request.schwarze2014-03-301-1/+2
| | | | | Found by naddy@ in the textproc/enchant(1) port. Of course, do not use this in new manuals.
* 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.
* Another 18% speedup for mandocdb(8) -Q, found by gprof(1).schwarze2014-01-061-6/+8
| | | | | | | In -Q mode, refrain form validating and normalizing the format of the date given in .Dd or .TH, as it won't be used anyway. For /usr/share/man, mandocdb -Q now takes 45% of the time of makewhatis(8).
* remove assignments that will be overwritten right afterwards,schwarze2013-12-311-6/+2
| | | | | and remove pointless local variables; found in a clang output from Ulrich Spoerlein <uqs at FreeBSD>
* Implement the .UR/.UE block (uniform resource identifier) introduced in theschwarze2013-10-171-2/+17
| | | | | | | | 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-81/+72
| | | | | | | | 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
* Implement .PD for -Tascii.schwarze2012-07-291-2/+3
| | | | | | Reminded about the missing feature by millert@. This reduces mandoc/groff differences in base by 25%. ok millert@
* Drop empty .IP such that is does not cause additional vertical spacing.schwarze2012-07-181-2/+22
| | | | Issue first reported by naddy@ in rsync(1).
* Drop .sp and .br right after .SH and .SS.schwarze2012-07-181-7/+20
| | | | | Fixes vertical spacing after "OPTIONS" in gcc(1). Issue first reported by naddy@ in rsync(1).
* Minimal implementation of .EX and .EE for GNU compatibility.schwarze2012-06-021-1/+3
| | | | | 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-3/+7
| | | | Do not use this GNU extension, we take it for compatibility only.
* In man(7), when no explicit volume name is given, use the defaultschwarze2011-12-021-1/+5
| | | | | | | | | | | | volume name for the respective manual section, just like in mdoc(7). This gives us nicer page headers for cvs(1), lynx(1), tic(1), mkhybrid(8), and many curses(3) manuals. ok kristaps@ To not break compatibility, i wrote a corresponding patch for GNU troff which Werner Lemberg accepted upstream at rev. 1.65 of: http://cvs.savannah.gnu.org/viewvc/groff/tmac/an-old.tmac?root=groff
* When the HEAD scope of .TP is broken by another block macro,schwarze2011-11-051-26/+11
| | | | | | | 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.
* When .TH sets no data, leave the date field in the page footer blank,schwarze2011-11-031-4/+6
| | | | | | do not use the current date. This removes a gratuitous output difference with respect to groff. ok kristaps@
* Remove a bunch of useless assignments,schwarze2011-10-161-7/+6
| | | | | | | and assert that print_bvspace cannot be called on NULL pointers. No change in behaviour, none of these were bugs, but the code becomes easier to understand. Based on a clang report posted by joerg@; ok kristaps@.
* sync to version 1.11.7 from kristaps@schwarze2011-09-181-47/+28
| | | | | | | | 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
* Fix a bogus "unknown macro" error reported in the pod2man(1) preamble:schwarze2011-07-071-5/+20
| | | | | | | | | - Actually let roff_parse() recognize ".\}" as a cond block end request. - Do not rewrite "\}" to the zero-width space "\&" because that prevents recognition of immediately preceding macros; use normal blanks instead. - To avoid a vertical spacing regression in pod2man(1) manuals, drop one vertical spacing request just before NAME. From kristaps@.
* Merge release 1.11.3, almost all code by kristaps@:schwarze2011-05-291-25/+31
| | | | | | | | | * Unicode output support (no Unicode input yet, though). * Refactoring: completely handle predefined strings in roff.c. - New function mandoc_escape() replaces a2roffdeco() and mandoc_special(). - Start using mandoc_getarg() in mdoc_argv.c. - Clean up parsing of delimiters in mdoc(7). * And many minor fixes and lots of cleanup.
* Merge version 1.11.1:schwarze2011-04-241-17/+20
| | | | | | | | | | | | | | 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-4/+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/+5
| | | | | | | | 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-22/+13
| | | | | | | | | | | | 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@
* Refrain from throwing fatal errors forschwarze2011-01-171-34/+24
| | | | | | | * .br .sp .nf .fi .na with arguments - just skip the arguments * .TH lacking arguments - use empty strings instead like groff * .TH with excessive arguments - skip those Reminded by Joerg Sonnenberger, ok kristaps@.
* Some improvements to error handling from kristaps@:schwarze2011-01-161-32/+21
| | | | | | | * Make out-of-context .fi invocations not cause an error, but just a warning. * Downgrade -man message about ignored empty paragraph to MANDOC_IGNPAR. * Avoid syntax tree corruption when removing empty block macros. Triggered by some reports from brad@.
* Merge kristaps@' cleaner tbl integration, removing mine;schwarze2011-01-041-23/+13
| | | | there are still a few bugs, but fixing these will be easier in tree.
* Remove `i' and `r' macro handlers. These macros, originally part of theschwarze2010-12-191-3/+1
| | | | | | | 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-57/+57
| | | | No more functional changes, just sync ordering, comments and white space.
* Do not report the same problems multiple times,schwarze2010-12-061-19/+21
| | | | | | and do not bother checking the return values of calls that always return 1. From kristaps@.
* Merge man_action.c into man_validate.c.schwarze2010-12-011-8/+206
| | | | | 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-4/+1
| | | | | it is time to remove the .Sp, .Vb, and .Ve kludge that was added to the man(7) library to build Perl manuals.
* Implement the roff .ft (change font) request for man(7).schwarze2010-11-291-1/+58
| | | | | | | | 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.
* The man(7) macros .HP .IP .RS .TP accept *optional* arguments,schwarze2010-10-271-4/+2
| | | | | | | so do not throw an ERROR when there are none. Formatting is already correct: With no arguments, use default widths and no tag. Problem reported by naddy@, thanks.