summaryrefslogtreecommitdiffstats
path: root/mdoc_html.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Do text production for .Bt, .Ex, .Rv, .Ud at the validation stageIngo Schwarze2017-01-111-112/+4
| | | | | | | | | rather than in the formatters. Use NODE_NOSRC flag for .Lb and NODE_NOSRC and NODE_NOPRT for .St. Results in a more rigorous syntax tree and in 135 lines less code. This work was triggered by a question from Abhinav Upadhyay <er dot abhinav dot upadhyay at gmail dot com> (NetBSD) on discuss@.
* Use new NODE_NOSRC and NODE_NOPRT flags for .Bx and .At.Ingo Schwarze2017-01-101-29/+1
| | | | More rigorous AST and 40 lines less code.
* For the .Ux/.Ox family of macros, do text production at the validationIngo Schwarze2017-01-101-34/+1
| | | | | stage rather than in each and every individual formatter, using the new NODE_NOSRC flag. More rigorous and also ten lines less code.
* unify names of AST node flags; no change of cpp outputIngo Schwarze2017-01-101-18/+18
|
* Introduce flags NODE_NOSRC and NODE_NOPRT for AST nodes.Ingo Schwarze2017-01-101-0/+3
| | | | | | | | | Use them to mark generated nodes and nodes that shall not produce output. Let -Ttree output mode display these new flags. Use NODE_NOSRC for .Ar, .Mt, and .Pa default arguments. Use NODE_NOPRT for .Dd, .Dt, and .Os. These will help to make handling of text production macros more rigorous.
* The .No macro is not supposed to produce fixed-width font, it is notIngo Schwarze2017-01-091-1/+1
| | | | | the same as .Li, so don't use <code>. Bug reported by <Anton dot Lindqvist at gmail dot com> on tech@.
* Indentation must be measured in units of the surrounding text,Ingo Schwarze2017-01-081-8/+8
| | | | | | | | | | not in units of the contained text. Consequently, "display" and "lit" class tags must not be on the same element: First, "display" must set up the indentation, still using the outer units, and only after that, "lit" may change the font. This fixes .Bd -literal which got the wrong indentation. Bug reported by tb@.
* Delete the redundant "nchild" member of struct roff_node, replacingIngo Schwarze2016-01-081-24/+25
| | | | | | | | most uses by one, a few by two pointer checks, and only one by a tiny loop - not only making data smaller, but code shorter as well. This gets rid of an implicit invariant that confused both static analysis tools and human auditors. No functional change.
* Generate simpler in-page links: just replace spaces with underscores.Ingo Schwarze2016-01-041-3/+1
| | | | Patch from bentley@.
* To make the code more readable, delete 283 /* FALLTHROUGH */ commentsIngo Schwarze2015-10-121-54/+0
| | | | | | that were right between two adjacent case statement. Keep only those 24 where the first case actually executes some code before falling through to the next case.
* modernize style: "return" is not a functionIngo Schwarze2015-10-061-95/+95
|
* /* NOTREACHED */ after abort() is silly, delete itIngo Schwarze2015-09-261-5/+0
|
* resolve code duplication and do style cleanup in mdoc_nm_pre(),Ingo Schwarze2015-09-261-8/+4
| | | | no functional change
* Fix multiple aspects of SYNOPSIS .Nm formatting:Ingo Schwarze2015-09-261-2/+3
| | | | | | * Don't break lines before non-block .Nm elements. * Use proper <b> markup for the heads of .Nm blocks. * Make the width measurements work by doing them on the head children.
* If an .Fo macro lacks its mandatory argument, don't die on an assertion.Ingo Schwarze2015-08-301-3/+2
| | | | Bug found by jsg@ with afl.
* Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),Ingo Schwarze2015-04-181-17/+10
| | | | | | man_node() from the mandoc(3) semi-public interface and the internal wrapper functions print_mdoc() and print_man() from the HTML formatters. Minus 60 lines of code, no functional change.
* Replace the structs mdoc and man by a unified struct roff_man.Ingo Schwarze2015-04-181-1/+1
| | | | | Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
* Restore the page headers and page footers that accidentally got lostIngo Schwarze2015-04-161-6/+2
| | | | in rev. 1.225. Regression reported by florian@.
* Third step towards parser unification:Ingo Schwarze2015-04-021-1/+1
| | | | | Replace struct mdoc_meta and struct man_meta by a unified struct roff_meta. Written of the train from London to Exeter on the way to p2k15.
* Second step towards parser unification:Ingo Schwarze2015-04-021-6/+6
| | | | | | | | | Replace struct mdoc_node and struct man_node by a unified struct roff_node. To be able to use the tok member for both mdoc(7) and man(7) without defining all the macros in roff.h, sacrifice a tiny bit of type safety and make tok an int rather than an enum. Almost mechanical, no functional change. Written on the Eurostar from Bruxelles to London on the way to p2k15.
* First step towards parser unification:Ingo Schwarze2015-04-021-53/+54
| | | | | | Replace enum mdoc_type and enum man_type by a unified enum roff_type. Almost mechanical, no functional change. Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.
* If an eqn(7) starts on a new input line, be sure to output whitespaceIngo Schwarze2015-03-031-0/+2
| | | | | | | in front of it. Issue found by tedu@ in glOrtho(3). There are also cases of excessive whitespace before and after equations. This patch neither fixes them nor makes them worse.
* Delete the mdoc_node.pending pointer and the function calculatingIngo Schwarze2015-02-121-4/+5
| | | | | | | | | | | | | | | | | | | | | | | it, make_pending(), which was the most difficult function of the whole mdoc(7) parser. After almost five years of maintaining this hellhole, i just noticed the pointer isn't needed after all. Blocks are always rewound in the reverse order they were opened; that even holds for broken blocks. Consequently, it is sufficient to just mark broken blogs with the flag MDOC_BROKEN and breaking blocks with the flag MDOC_ENDED. When rewinding, instead of iterating the pending pointers, just iterate from each broken block to its parents, rewinding all that are MDOC_ENDED and stopping after processing the first ancestor that it not MDOC_BROKEN. For ENDBODY markers, use the mdoc_node.body pointer in place of the former mdoc_node.pending. This also fixes an assertion failure found by jsg@ with afl, test case #467 (Bo Bl It Bd Bc It), where (surprise surprise) the pending pointer got corrupted. Improved functionality, minus one function, minus one struct field, minus 50 lines of code.
* do not access a NULL pointer if an .Eo block lacks a tail;Ingo Schwarze2015-02-111-3/+2
| | | | found by jsg@ with afl, test case #16
* fix handling of empty .An macrosIngo Schwarze2015-02-051-3/+0
|
* Simplify by deleting the "lastline" member of struct mdoc_node.Ingo Schwarze2015-02-051-6/+3
| | | | Minus one struct member, minus 17 lines of code, no functional change.
* fix .Eo/.Ec spacingIngo Schwarze2015-02-011-13/+51
|
* Have pity on the poor stack.Ingo Schwarze2015-01-301-3/+4
| | | | | Replace tail recursion by iteration when walking the syntax trees. No functional change.
* Let .Aq/.Ao/.Ac print "<>" instead of the normal "\(la\(ra"Ingo Schwarze2015-01-231-5/+5
| | | | | | when the only child is .Mt, not when the preceding node is .An, to improve robustness. Triggered by a question from Svyatoslav Mishyn <juef at openmailbox dot org> (Crux Linux).
* support negative horizontal widths in man(7);Ingo Schwarze2014-12-231-2/+6
| | | | minus twenty lines of code in spite of enhanced functionality
* some scaling unit fixes:Ingo Schwarze2014-12-231-2/+2
| | | | | - .sp with an invalid argument is .sp 1v, not .sp 0v - in man(1), trailing garbage doesn't make scaling units invalid
* Fix the implementation and documentation of \c (continue text input line).Ingo Schwarze2014-12-021-1/+2
| | | | | In particular, make it work in no-fill mode, too. Reminded by Carsten dot Kunze at arcor dot de (Heirloom roff).
* header cleanup:Ingo Schwarze2014-12-011-2/+1
| | | | | | * add missing forward declarations * remove needless header inclusions * some style unification
* Multiple fixes with respect to .Pf:Ingo Schwarze2014-11-301-1/+2
| | | | | | | * The first argument of .Pf is not parsed. * Normal delimiter handling does not apply to the first argument of .Pf. * Warn if nothing follows a prefix (inspired by groff_mdoc(7)). * In that case, do not suppress spacing.
* Multiple fixes with respect to .Eo:Ingo Schwarze2014-11-271-8/+13
| | | | | | | | 1. Correctly parse stray .Ec without preceding .Eo, avoiding an assertion violation found by jsg@ with afl. 2. Correctly parse .Ec arguments when breaking another block. 3. Correct spacing around closing delimiter when breaking another block. 4. Sync some related formatting control from -Tascii to -Thtml.
* Fix the obsolete .Db (toggle debug mode) macro to ignore its argumentsIngo Schwarze2014-11-271-1/+1
| | | | | and not trigger an assertion when there is more than one argument; the latter found by jsg@ with afl.
* Let .Ao and .Aq render as "<>" after .An and as "\(la\(ra" elsewhere,Ingo Schwarze2014-11-191-2/+4
| | | | just like groff; minibug noticed by bentley@.
* Multiple fixes with respect to in-line macros:Ingo Schwarze2014-11-171-1/+12
| | | | | | | | | | * .No selects the default font; relevant e.g. in .Bf blocks * no need to force empty .Li elements * closing delimiters as leading macro arguments do not suppress space * opening delimiters at the end of a macro line do not suppress space * correctly handle delimiter spacing in -Tman As a side effect, these fixes let mandoc warn about empty .No macros as requested by bentley@.
* Major bugsquashing with respect to -offset and -width:Ingo Schwarze2014-10-301-27/+13
| | | | | | | | | 1. Support specifying the .Bd and .Bl -offset as a macro default width; while here, simplify the code handling the same for .Bl -width. 2. Correct handling of .Bl -offset arguments: unlike .Bd -offset, the arguments "left", "indent", and "indent-two" have no special meaning. 3. Fix the scaling of string length -offset and -width arguments in -Thtml. Triggered by an incomplete documentation patch from bentley@.
* sync Copyright years after merge to OpenBSD; no code changeIngo Schwarze2014-10-101-1/+1
|
* Don't pretend we have a separate XHTML and HTML mode any more.Kristaps Dzonsons2014-09-271-1/+1
|
* Remove <p> in favour of <div class="spacer">.Kristaps Dzonsons2014-09-271-5/+5
| | | | | | | This is good because <p> is brittle: it can't appear within other block macros. This fixes a regression of the original HTML5 patch as noted by schwarze@ on the tech@ list, 14/8/2014.
* Remove last hard-coded width attribute.Kristaps Dzonsons2014-09-271-7/+0
|
* HTML5-isation: remove more alignments.Kristaps Dzonsons2014-09-271-24/+23
|
* Continue in HTML5-ing by kicking out some hard-coded alignments.Kristaps Dzonsons2014-09-271-4/+2
|
* Kick out "summary" attribute, which isn't HTML5.Kristaps Dzonsons2014-09-271-6/+4
|
* First, add space for default styling for HTML5 (non-fragment) output.Kristaps Dzonsons2014-09-271-6/+4
| | | | | This uses a <style /> block right before the <link /> for the stylesheet. Use this to kick out hardcoded header and footer table widths.
* implement .An -[no]split for -ThtmlIngo Schwarze2014-09-171-3/+27
|
* Right after .Fl, a middle delimiter triggers an empty scope,Ingo Schwarze2014-08-211-3/+4
| | | | | | | | | | | | just like a closing delimiter. This didn't work in groff-1.15, but it now works in groff-1.22. After being closed by delimiters, .Nm scopes do not reopen. Do not suppress white space after .Fl if the next node is a text node on the same input line; that can happen for middle delimiters. Fixing an issue reported by jmc@.
* Revert previous, as requested by kristaps@.Ingo Schwarze2014-08-141-4/+6
| | | | | | | | | | | | | The .Bf block can contain subblocks, so it has to render as an element that can contain flow content. But <em> cannot contain flow content, only phrasing content. Rendering .Em and .Bf differently would by unfortunate, and closing out .Bf before subblocks and re-opening it afterwards would merely complicate both the C code of the program and the generated HTML code. Besides, converting .Em to semantic HTML markup would require some content to be put into <em> and some into <i>, but we cannot automatically distinguish which is which, so strictly speaking, we can't use semantic HTML here but have to fall back to physical markup. Wonders of HTML...