summaryrefslogtreecommitdiffstats
path: root/mdoc_html.c
Commit message (Collapse)AuthorAgeFilesLines
* fix formatting of intermediate punctuation in .LkIngo Schwarze2017-05-301-9/+17
|
* Delete pointless width calculation for SYNOPSIS .Nm block heads.Ingo Schwarze2017-05-171-17/+0
| | | | | | Just let HTML <table> do its work of selecting the needed width. <Anton dot Lindqvist at gmail dot com> reported that the manually calculated width was insufficient in some manual pages.
* Make the tag column in .Bl -tag lists wider:Ingo Schwarze2017-05-121-4/+4
| | | | | | 1. I forgot about the 2n padding between tag and body. 2. The factor 1.1 was too small for bold fold, make it *1.15 + 1n. Ugliness spotted by tb@.
* Trailing \c suppresses the output line break even ifIngo Schwarze2017-05-091-3/+3
| | | | | the next line is a text line starting with whitespace. Quirk found in the sysutils/rancid port.
* Move .sp to the roff modules. Enough infrastructure is in placeIngo Schwarze2017-05-051-26/+2
| | | | now that this actually saves code: -70 LOC.
* move .ll to the roff modulesIngo Schwarze2017-05-051-1/+0
|
* Move handling of the roff(7) .ft request from the man(7)Ingo Schwarze2017-05-051-0/+1
| | | | | modules to the new roff(7) modules. As a side effect, mdoc(7) now handles .ft, too. Of course, do not use that.
* Start roff formatter modules for HTML and termininal output,Ingo Schwarze2017-05-041-17/+7
| | | | | | | used by both the mdoc and man formatters, with the ultimate goal of reducing code duplication between the two macro formatters. Made possible by the parser unification. Add the first formatting function (for the .br request).
* Parser reorg:Ingo Schwarze2017-05-041-3/+14
| | | | | Generate the first node on the roff level: .br Fix some column numbers in diagnostic messages while here.
* Continue parser unification:Ingo Schwarze2017-04-241-4/+7
| | | | | | | | * Make enum rofft an internal interface as enum roff_tok in "roff.h". * Represent mdoc and man macros in enum roff_tok. * Make TOKEN_NONE a proper enum value and use it throughout. * Put the prologue macros first in the macro tables. * Unify mdoc_macroname[] and man_macroname[] into roff_name[].
* Fix handling of trailing punctuation in .Lk.Ingo Schwarze2017-04-171-8/+14
| | | | | | | | | This macro is unusual in so far as trailing punction needs to remain inside the scope because it must be inside, not after the display of long URIs in terminal output mode. Improves formatting of fw_update(1), help(1), less(1), sendbug(1), acx(4), inet6(4), ipsec(4), oce(4), isakmpd.conf(5), afterboot(8), release(8), traceroute(8).
* Fix regression in mdoc_html.c 1.275, man_html 1.134:Ingo Schwarze2017-03-171-2/+4
| | | | | | For .Sh, .Ss, .SH, .SS, only write selflink if an id could be constructed. Crash reported by Raf Czlonka <rczlonka at gmail dot com>, analysis of root cause by natano@
* Minimal support for deep linking into man(7) pages.Ingo Schwarze2017-03-151-28/+5
| | | | | As the man(7) language does not provide semantic markup, only .SH, .SS, and .UR become anchors for now.
* Slightly increase widths calculated from string lengths (mainlyIngo Schwarze2017-03-141-1/+2
| | | | | | | | | | for .Bl -tag lists and SYNOPSIS .Nm blocks), such that the text still fits even if it is printed in bold font. This is an ugly band aid - but implementing font-dependent width measurements would be a major project and even more difficult for HTML than for PostScript. Issue reported by Jan Stary <hans at stare dot cz>.
* Port ctags-style, less(1) :t internal searching from terminal outputIngo Schwarze2017-03-131-10/+80
| | | | | | | | | | to HTML output. For certain macros appearing at the beginning of .It heads, write HTML id="..." attributes such that deep linking works. Write HTML <a> attributes such that you can easily copy out link targets with the mouse. Try: http://man.openbsd.org/vmctl.8#create Feature suggested by <guettliml at Thomas dash Guettler dot de>, some details of the design and implementation by me.
* Print title="..." in addition to id="..." attributes for macro keysIngo Schwarze2017-03-131-42/+42
| | | | | that can be searched for by apropos(1), such that you see the semantic function in a tooltip when hovering with the mouse.
* remove a few redundant conditions that jsg@ found with cppcheckIngo Schwarze2017-03-031-1/+1
|
* Handle an odd edge case where .It is preceded by .Sm.Ingo Schwarze2017-02-221-0/+1
| | | | | NULL dereference in man.cgi reported by Gabriel Guzman <gabe at guzman dash nunez dot com> on misc@.
* Remove the ENDBODY_NOSPACE flag, simplifying the code.Ingo Schwarze2017-02-161-2/+0
| | | | | | | | Comparing to groff output, it appears that all cases where it was used and made a difference actually require the opposite, ENDBODY_SPACE. I have no idea why i added it back in 2010; maybe to compensate for some other bug that has long been fixed.
* The .Nm macro does not only use the default name when it has noIngo Schwarze2017-02-061-2/+0
| | | | | | | | | | argument, but also when the first argument is a child macro. Arcane issue found in the FreeBSD cxgbetool(8) manual that Baptiste Daroussin <bapt at FreeBSD> sent me long ago for a different reason. While solving this, switch to the new technique of doing text production in the validator, reducing code duplication in the formatters, which also makes -Ttree output clearer.
* Wrap .St content in a <span class="St">.Ingo Schwarze2017-02-051-2/+10
| | | | Also add forgotten <span class="Ux"> to .At rendering.
* fix font selection for .Bf without argumentIngo Schwarze2017-02-051-1/+1
|
* mark up .Ar, .Fa, .Va, .Ft, and .Vt with <var> rather than <i>;Ingo Schwarze2017-02-051-9/+9
| | | | suggested by bentley@ long ago, but needed lots of cleanup first
* for .Rs, use <cite>Ingo Schwarze2017-02-051-1/+1
|
* Improve <table> syntax:Ingo Schwarze2017-02-051-8/+12
| | | | | | | | The <col> element can only appear inside <colgroup>, so use <colgroup>. The <tbody> element is optional and useless, so don't use it. Even if we would ever need <thead> or <tfoot>, <tbody> would still be optional and useless; besides, we will likely never need <thead> or <tfoot>, simply because our languages don't support such functionality.
* eliminate one useless struct and one level of indirection;Ingo Schwarze2017-01-291-2/+2
| | | | no functional change
* Simplify usage of print_otag() even more:Ingo Schwarze2017-01-281-47/+20
| | | | accept NULL to skip the attribute or format.
* .Bl -column with zero columns is legal, so don't segfalt on it.Ingo Schwarze2017-01-281-16/+16
| | | | | | Bug introduced in rev. 1.248 triggered for example in gssapi(3), analyzed and reported by Michael <Stapelberg at debian dot org>. Simplify the code a bit more while here.
* Improve HTML formatting of .Bl -tag.Ingo Schwarze2017-01-251-3/+45
| | | | | | | | | | | | | | | | | | | | | In particular, when using the style sheet, put the body on the same line as the head for short heads, or on the next line for long heads, in a way that preserves both correct indentation and correct vertical spacing with and without -compact, and with one or more heads per body (hi, Zaphod) - eight use cases so far - and with and without -tag, and with and without -offset, 32 use cases grand total. Using many ideas from zhuk@, from <David dot Dahlberg at fkie dot fraunhofer dot de>, and from Benny Lofgren <bl dash lists at lofgren dot biz>, and a few of my own. This is an excellent demonstration that CSS is an extremely hostile language, much more trapful and much harder to use than, say, C. When matthew@ reported this in July 2014 (!), it was already a known issue, and i no longer remember for how long. My first serious attempt at fixing it (in November 2015) failed miserably. I'd love to see simplifications of both the generated HTML code and of the style sheet, but without breaking any of the 32 use cases, please.
* Avoid writing constant style attributes over and over again.Ingo Schwarze2017-01-211-9/+14
| | | | Move them to the style sheet.
* clean up the remaining class attributesIngo Schwarze2017-01-211-7/+7
|
* Standardize class attributes for semantic macros.Ingo Schwarze2017-01-201-42/+43
| | | | Correct markup for .Va and iprove markup for .Dv, .Er, .Ev while here.
* standardize .Rs class attributesIngo Schwarze2017-01-201-23/+17
|
* standardize .Bl and .It class attributesIngo Schwarze2017-01-201-71/+103
|
* clean up markup of .Bd, .D1, .Dl, .Li, and .Ql;Ingo Schwarze2017-01-191-13/+9
| | | | in particular, stop abuse of <blockquote>
* clean up .Sx and .Xr HTML markupIngo Schwarze2017-01-191-6/+6
|
* Clean up CSS rules for sections and paragraphs.Ingo Schwarze2017-01-191-9/+7
| | | | Start using real macro names for CSS classes.
* Start cleanup: trim useless HTML comments, <div> elements,Ingo Schwarze2017-01-191-9/+7
| | | | and CSS rules on the <html> and <body> levels.
* Implement line breaking of the generated HTML code at space charactersIngo Schwarze2017-01-191-2/+0
| | | | | | | | | in filled text. This does not affect HTML semantics, but makes the HTML code even more humanly readable. While here, - collapse multiple consecutive space characters in filled text - and insert a blank between style entries.
* Make HTML output more human readable by overhauling line break logicIngo Schwarze2017-01-181-1/+0
| | | | | around tags and by introducing some simple indentation. No change of HTML semantics intended.
* Completely delete the buf field of struct html and all the buf*()Ingo Schwarze2017-01-171-73/+77
| | | | | | | | | interfaces. Such a static buffer was a bad idea in the first place, causing unfixable truncation that was only prevented by triggering an assertion failure. Instead, let the small number of remaining users allocate and free their own, temporary dynamic buffers, or for the case of .Xr and .In, pass the original data to be assembled in print_otag().
* Simplify the usage of print_otag() by making it accept a variableIngo Schwarze2017-01-171-402/+158
| | | | | | | | | | number of arguments. Delete struct htmlpair and all the PAIR_*() macros. Delete enum htmlattr, handle that in print_otag() instead. Minus 190 lines of code; no functional change except better ordering of attributes (class before style) in three cases.
* 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.