summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/mandoc.h
AgeCommit message (Collapse)Author
2014-10-30support UTF-8 and ISO-8859-1 input by integrating modified partsIngo Schwarze
of kristaps@' version of the preconv(1) utility into mandoc(1); positive feedback from bentley@ and no concern raised when shown on tech@
2014-10-29In terminal output, unify handling of Unicode and numbered characterIngo Schwarze
escape sequences just like it was earlier implemented for -Thtml. Do not let control characters other than ASCII 9 (horizontal tab) propagate to the output, even though groff allows them; but that really doesn't look like a great idea. Let mchars_num2char() return int such that we can distinguish invalid \N syntax from \N'0'. This also reduces the danger of signed char issues popping up.
2014-10-28Make the character table available to libroff so it can check theIngo Schwarze
validity of character escape names and warn about unknown ones. This requires mchars_spec2cp() to report unknown names again. Fortunately, that doesn't require changing the calling code because according to groff, invalid character escapes should not produce output anyway, and now that we warn about them, that's fine.
2014-10-26In -Tascii mode, provide approximations even for some Unicode escapeIngo Schwarze
sequences above codepoint 512 by doing a reverse lookup in the existing mandoc_char(7) character table. Again, groff isn't smart enough to do this and silently discards such escape sequences without printing anything.
2014-10-20protect the roff parser from dividing by zero;Ingo Schwarze
issue found and patch written by kristaps@
2014-10-14Rudimentary implementation of the e, x, and z table layout modifiersIngo Schwarze
to equalize, maximize, and ignore the width of columns. Does not yet take vertical rulers into account, and does not do line breaks within table cells. Considerably improves the lftp(1) manual; issue noticed by sthen@.
2014-10-12Improve error handling in the eqn(7) parser.Ingo Schwarze
Get rid of the first fatal error, MANDOCERR_EQNSYNT. In eqn(7), there is no need to be bug-compatible with groff, so there is no need to abondon the whole equation in case of a syntax error. In particular: * Skip "back", "delim", "down", "fwd", "gfont", "gsize", "left", "right", "size", and "up" without arguments. * Skip "gsize" and "size" with a non-numeric argument. * Skip closing delimiters that are not open. * Skip "above" outside piles. * For diacritic marks and binary operators without a left operand, default to an empty box. * Let piles and matrices take one argument rather than insisting on a braced list. Let HTML output handle that, too. * When rewinding, if the root box is guaranteed to match the termination condition, no error handling is needed.
2014-10-11warn about parentheses in function names after .Fn and .Fo;Ingo Schwarze
particularly useful when converting from other languages to mdoc(7); feature suggested by bentley@
2014-10-10Partial eqn(7) rewrite by kristaps@ in order to get operator precedence right.Ingo Schwarze
2014-10-09parse and render "from" and "to" clauses in eqn, and render matrices;Ingo Schwarze
written by kristaps@ during EuroBSDCon
2014-10-09parse simultaneous sub- and superscriptsIngo Schwarze
and make the eqn_box list doubly linked; written by kristaps@ during EuroBSDCon
2014-09-12warn about commas in function arguments; inspired by mdoclint(1)Ingo Schwarze
2014-09-11warn about botched .Xr ordering and punctuation below SEE ALSO;Ingo Schwarze
inspired by mdoclint(1)
2014-09-07warn about AUTHORS sections without .An macros, inspired by mdoclint(1)Ingo Schwarze
2014-09-03Add *.gz support to apropos(1) -a, manm(1), and even mandoc(1).Ingo Schwarze
Implemented by moving the zip code from makewhatis(8) to the parser lib.
2014-08-08Bring the handling of defective prologues even closer to groff,Ingo Schwarze
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.
2014-08-08mention requests and macros in more messagesIngo Schwarze
2014-08-08Dynamically allocate the stack of roff(7) .ie condition valuesIngo Schwarze
and thus get rid of the last useless fatal error.
2014-08-08Split MANDOCERR_IGNARGV into one message for .An and one for .BlIngo Schwarze
and report the macro name and argument.
2014-08-08In .Bl -column, if some of the column width declarations are givenIngo Schwarze
right after the -column argument and some at the very end of the argument list, after some other arguments like -compact, concatenate the column lists. This gets rid of one of the last useless FATAL errors and actually shortens the code by a few lines. This fixes an issue introduced more than five years ago, at first causing an assert() since bsd.lv mdoc_action.c rev. 1.14 (June 17, 2009), then later a FATAL error since mdoc_validate rev. 1.130 (Nov. 30, 2010), and marked as "TODO" ever since.
2014-08-08Remove the useless FATAL error "argument count wrong, violates syntax".Ingo Schwarze
The last remaining instance was .It in .Bl -column with more than one excessive .Ta. However, simply downgrading from FATAL to ERROR, it just works fine, almost the same way as in groff, without any other changes.
2014-08-08Get rid of the useless FATAL error "child violates parent syntax".Ingo Schwarze
When finding items outside lists, simply skip them and throw an ERROR. Handle subsections before the first section instead of bailing out.
2014-08-08Remove two useless FATAL errors.Ingo Schwarze
When a file contains neither text nor macros, treat it as an empty document. When the mdoc(7) document prologue is incomplete, use some default values.
2014-08-08better name and wording for the last two non-generic errorsIngo Schwarze
2014-08-08Various improvements related to .Ex and .Rv:Ingo Schwarze
* let .Nm fall back to the empty string, not to UNKNOWN * never let .Rv copy an argument from .Nm * avoid spurious \fR after empty .Nm in -Tman * correct handling of .Ex and .Rv in -Tman * correct the wording of the output for .Rv without arguments * use non-breaking spaces in .Ex and .Rv output where required * split MANDOCERR_NONAME into a warning for .Ex and an error for .Nm
2014-07-09mark defos as const; nobody needs to change it,Ingo Schwarze
and it is occasionally useful to be able to pass literal strings
2014-07-07Clean up ERROR messages related to document structure and macros:Ingo Schwarze
Hierarchical naming and mention macro names in messages.
2014-07-07no need to delete any content from .Rs blocks,Ingo Schwarze
and downgrade the related message from ERROR to WARNING
2014-07-07no need to skip content before first section headerIngo Schwarze
2014-07-07implement .dei and .amiIngo Schwarze
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-07-05Cleanup with respect to bad macro arguments.Ingo Schwarze
* 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.
2014-07-05Cleanup regarding -offset and -width:Ingo Schwarze
* Bugfix: Last one wins, not first one. * Fix .Bl -width without argument: it means 0n, so do not ignore it. * Report macro names, argument names and fallbacks in related messages. * Simplify: Garbage collect auxiliary variables in pre_bd() and pre_bl().
2014-07-04Clean up messages regarding excess arguments:Ingo Schwarze
* 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.
2014-07-04Clean up messages related to missing arguments.Ingo Schwarze
* Do not warn about empty -column cells, they seem valid to me. * Downgrade empty item and missing -std from ERROR to WARNING. * Hierarchical naming. * Descriptive, not imperative style. * Mention macro names, argument names, and fallbacks. * Garbage collect some unreachable code in post_it().
2014-07-03Fix formatting of empty .Bl -inset item heads.Ingo Schwarze
Downgrade empty item heads from ERROR to WARNING. Show the list type in the error message. Choose better variable names for nodes in post_it().
2014-07-03MANDOCERR_NOARGS reported three completely unrelated classes of problems.Ingo Schwarze
Split the roff(7) parts out of it and report the request names for these cases.
2014-07-02Improve and test the messages about empty macros,Ingo Schwarze
in particular reporting the macro names involved.
2014-07-02Disentangle the MANDOCERR_CHILD message, which reported threeIngo Schwarze
completely different things, into three distinct messages. Also mention the macro names we are talking about.
2014-07-02Clean up warnings related to macros and nesting.Ingo Schwarze
* 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.
2014-07-02Improve "skipping paragraph macro" messages,Ingo Schwarze
showing which macro was skipped and before or after what.
2014-07-02Implement the obsolete macros .En .Es .Fr .Ot for backward compatibility,Ingo Schwarze
since this is hardly more complicated than explicitly ignoring them as we did in the past. Of course, do not use them!
2014-07-01Clean up the warnings related to document structure.Ingo Schwarze
* 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.
2014-06-30garbage collect two unused enum mandocerr itemsIngo Schwarze
and fix a couple of comments while here
2014-06-25Improve messages related to the roff(7) .so request.Ingo Schwarze
In all these messages, show the filename argument that was passed to the .so request. In case of failure, show an additional message reporting the file and the line number where the failing request was found. The existing message reporting the reason for the failure - for example, "Permission denied" - is left in place, unchanged. Inspired by a question asked by Nick@ after he saw the confusing old messages that used to be emitted in this area.
2014-06-20As suggested by jmc@, only include line and column numbers into messagesIngo Schwarze
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.
2014-06-20Start systematic improvements of error reporting.Ingo Schwarze
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.
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-28Allow leading and trailing vertical lines,Ingo Schwarze
and format them in the same way as groff. While here, do not require whitespace before vertical lines in layout specifications. Issues found by bentley@ in mpv(1).
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.