summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Make the character table available to libroff so it can check theIngo Schwarze2014-10-2819-87/+93
| | | | | | | | 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.
* stricter parsing of Unicode escape namesIngo Schwarze2014-10-281-13/+17
|
* Tighten Unicode escape name parsing.Ingo Schwarze2014-10-282-12/+12
| | | | | Accept only 0xXXXX, 0xYXXXX, 0x10XXXX with Y != 0. This simplifies mchars_num2uc().
* Refine -Tascii rendering of Unicode characters, mostly to better agreeIngo Schwarze2014-10-282-128/+128
| | | | | | | | | with groff, in particular in cases where groff uses backspace overstrike. In two cases, agreement is impossible because groff clobbers the previous line: \(*G \(*S In a number of cases, groff rendering is so misleading that i chose to render differently: \(Sd \(TP \(Tp \(Po \(ps \(sc \(r! \(r? \(de While here, also correct the \(la and \(ra Unicode code points.
* Support overstriking by backspace in PostScript and PDF output.Ingo Schwarze2014-10-271-15/+61
| | | | | | | | | Of course, this is only a minor improvement; it would be much better to support non-ASCII characters in these output modes, but that would require major changes that i'm not going to work on right now. The main reason for doing this is that it allows to get ASCII output closer to groff.
* Handle output encoding for unicode, numbered and named escape sequencesIngo Schwarze2014-10-271-22/+10
| | | | | | | | in one common, safe way instead of three different ways. In particular, * skip NUL, it is used to mean "no output desired" * deny 0x01-0x1F and 0x7F-0x9F, print REPLACEMENT CHARACTER instead * print 0x20-0x7E literally or name-encoded, as required * print characters above 0x9F numerically
* Fix a regression in term.c rev. 1.229 reported by bentley@:Ingo Schwarze2014-10-274-12/+11
| | | | | | | | | | In UTF-8 output, do not print anything if mchars_spec2cp() returns 0. In particular, this repairs handling of zero-width spaces (\&). While here, let mchars_spec2cp() return 0xFFFD instead of -1 if the character is not found, simplifying the using code. In HTML output, do not print obfuscated ASCII characters and do not test for one-char escapes, mchars_spec2cp() already does that.
* KNF: indentation and sort variables by size; no functional changeIngo Schwarze2014-10-261-4/+3
|
* Grrr, patch(1) merged the new function to the wrong place in this file.Ingo Schwarze2014-10-261-77/+77
| | | | Resync with OpenBSD. No code change.
* In -Tascii mode, provide approximations even for some Unicode escapeIngo Schwarze2014-10-264-2/+27
| | | | | | | | 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.
* Improve -Tascii output for Unicode escape sequences: For the first 512Ingo Schwarze2014-10-265-70/+134
| | | | | | | | | | | | code points, provide ASCII approximations. This is already much better than what groff does, which prints nothing for most code points. A few minor fixes while here: * Handle Unicode escape sequences in the ASCII range. * In case of errors, use the REPLACEMENT CHARACTER U+FFFD for -Tutf8 and the string "<?>" for -Tascii output. * Handle all one-character escape sequences in mchars_spec2{cp,str}() and remove the workarounds on the higher level.
* With the current architecture, we can't support inline equationsIngo Schwarze2014-10-251-1/+2
| | | | | | | inside tables, sorry. So don't even try to parse tbl(7) blocks for eqn(7) delimiters. Broken table layout found in glPixelMap(3) while investigating a bug report by Theo Buehler <theo at math dot ethz dot ch>.
* Fix a NULL pointer dereference reportedIngo Schwarze2014-10-251-1/+3
| | | | | by Theo Buehler <theo at math dot ethz dot ch> on tech at openbsd: Do not attempt to parse empty equations.
* Report arguments to .EQ as an error, and simplify the code:Ingo Schwarze2014-10-254-37/+13
| | | | | | | * drop trivial wrapper function roff_openeqn() * drop unused first arg of function eqn_alloc() * drop usused member "name" of struct eqn_node While here, sync to OpenBSD by killing some trailing blanks.
* integrate preconv(1) into mandoc(1);Ingo Schwarze2014-10-2510-557/+180
| | | | enhances functionality and reduces code and docs by more than 300 lines
* some new tasksIngo Schwarze2014-10-251-1/+12
|
* Protect the roff parser from dividing by zero. ok schwarze@Kristaps Dzonsons2014-10-203-13/+26
|
* improve documentation of .Fa, .Va, and .Vt;Ingo Schwarze2014-10-201-8/+20
| | | | inspired by a discussion with matthew@
* correct the spacing after in-line equationsIngo Schwarze2014-10-204-4/+6
| | | | | that start at the beginning of an input line but end before the end of an input line
* correctly parse spacing around in-line equationsIngo Schwarze2014-10-201-5/+36
| | | | | at the beginning and at the end of input lines; issue reported by kristaps@
* correct spacing *after* inline equations (much simpler than expected)Ingo Schwarze2014-10-202-0/+4
|
* correct spacing before inline equationsIngo Schwarze2014-10-205-11/+11
|
* show the {MDOC,MAN}_EQN node, it contains interesting information,Ingo Schwarze2014-10-201-10/+12
| | | | | in particular line and column numbers and flags; but hide the uninteresting EQN_ROOT box
* plug file descriptor leaks on read or write failure;Ingo Schwarze2014-10-182-14/+13
| | | | hinted at by Steffen Nurpmeso <sdaoden at yandex dot com>.
* oops, don't escape the first token of inline equationsIngo Schwarze2014-10-161-2/+2
|
* Implement in-line equations, much needed by Xenocara manuals.Ingo Schwarze2014-10-166-87/+101
| | | | | | | | Put the steering into the roff parser rather than into the mdoc parser such that it works for all macro languages and on both text and macro lines. Line breaks and blank characters generated before and after in-line equations are not perfect yet, but let's do one thing at a time.
* even if a table has zero columns, do not segfault in the formatter;Ingo Schwarze2014-10-142-2/+2
| | | | bug reported by bentley@
* annotate for difficulty, and some minor cleanupIngo Schwarze2014-10-141-8/+98
|
* bentley@ suggests Unicode table borders;Ingo Schwarze2014-10-141-2/+3
| | | | while here, remove the note about sox(1), it works now
* Rudimentary implementation of the e, x, and z table layout modifiersIngo Schwarze2014-10-147-11/+91
| | | | | | | 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@.
* implement font modifiers in table layoutsIngo Schwarze2014-10-132-24/+41
|
* Properly scale string length measurements for PostScript and PDF output;Ingo Schwarze2014-10-131-2/+6
| | | | | this doesn't change anything for ASCII and UTF-8. Problem reported by bentley@.
* Stricter syntax checking of Unicode character names:Ingo Schwarze2014-10-131-12/+11
| | | | | | | Require exactly 4, 5 or 6 hex digits and allow nothing else. This avoids mishandling stuff like \[ua] and \C'uA' as Unicode and also fixes underlining in eqn(7) -Thtml output which uses \[ul]. Problem found and semantics suggested by kristaps@.
* sync with OpenBSD:Ingo Schwarze2014-10-131-1/+2
| | | | | check sorting of .Xr's case-insensitively; no idea why this was different here
* Do not warn about declarations of functions returning function pointers,Ingo Schwarze2014-10-131-3/+5
| | | | getting rid of a false positive noticed by bentley@.
* Clarify: SEE ALSO sections are sorted case insensitively.Ingo Schwarze2014-10-131-1/+1
| | | | Patch from bentley@, ok jmc@.
* add missing entry for .ll to the dispatch table;Ingo Schwarze2014-10-121-0/+1
| | | | patch from Martin <Natano at natano dot net>, thanks
* bugfix: do not parse quoted strings for tokens; fixes glFrustum(3)Ingo Schwarze2014-10-121-0/+10
|
* Improve error handling in the eqn(7) parser.Ingo Schwarze2014-10-125-116/+119
| | | | | | | | | | | | | | | | | | | 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.
* major upgrade to eqn(7) terminal output;Ingo Schwarze2014-10-121-17/+64
| | | | | column vectors ("piles") and matrices are not yet pretty, but everything else is now more or less readable
* document the semantics of operation keywordsIngo Schwarze2014-10-121-10/+237
| | | | and some other minor improvements
* oops, don't crash when .Fo has no argumentIngo Schwarze2014-10-111-1/+1
|
* warn about parentheses in function names after .Fn and .Fo;Ingo Schwarze2014-10-114-1/+38
| | | | | particularly useful when converting from other languages to mdoc(7); feature suggested by bentley@
* sync Copyright years after merge to OpenBSD; no code changeIngo Schwarze2014-10-105-5/+5
|
* Drop trailing whitespace, adjust a few indentations,Ingo Schwarze2014-10-102-30/+29
| | | | and update Copyright year while here; no code change.
* No need to assert() that a pointer is non-null right before dereferencing it.Ingo Schwarze2014-10-101-3/+0
| | | | The assert message contains no more information than the segfault.
* Make eqn(7) -Ttree output more useful:Ingo Schwarze2014-10-101-8/+27
| | | | | | | * Reduce noise by not printing default attributes. * Print missing "top" and "bottom" attributes. * Print mnemonics, not code numbers for expression positions. * Do not print unused "pile" attribute.
* tasks found while reading the eqn(7) User's GuideIngo Schwarze2014-10-101-5/+17
|
* Ignore "delim" command.Kristaps Dzonsons2014-10-101-0/+1
| | | | This fixes run-time assertions regarding "tok".
* Re-write of eqn(7) parser and MathML output.Kristaps Dzonsons2014-10-109-778/+883
| | | | | | | | | | This adds parser-level support for the grammar described by the eqn second-edition technical paper, "Typesetting Mathematics — User's Guide" (Kernighan, Cherry). The reason for this re-write is the grouping rules, which were not possible given the existing implementation. The re-write has also considerably simplified the HTML (and, if it ever is completed, terminal) front-end.