aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man_html.c
Commit message (Collapse)AuthorAgeFilesLines
* Parser reorg:Ingo Schwarze2017-05-041-2/+13
| | | | | 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-3/+4
| | | | | | | | * 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 regression in mdoc_html.c 1.275, man_html 1.134:Ingo Schwarze2017-03-171-3/+5
| | | | | | 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-6/+18
| | | | | As the man(7) language does not provide semantic markup, only .SH, .SS, and .UR become anchors for now.
* Improve <table> syntax:Ingo Schwarze2017-02-051-2/+1
| | | | | | | | 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.
* Rework fill mode handling for -man -Thtml.Ingo Schwarze2017-01-301-69/+134
| | | | | | | | | | | | Basically, open <pre> whenever printing text in no-fill mode and it is not already open, and close it whenever printing something that cannot be inside <pre>. This fixes a crash reported by Michael <Stapelberg at debian dot org> in the French Linux chroot(2) manual and also improves rendering for OpenBSD pages like DPMSGetTimeouts(3) and GLwDrawingArea(3). These changes also permitted retiring struct mhtml.
* eliminate one useless struct and one level of indirection;Ingo Schwarze2017-01-291-3/+3
| | | | no functional change
* Fix -man -Thtml formatting after .nf (which has nothing to doIngo Schwarze2017-01-261-58/+47
| | | | | | | | | | | | | | | | with "literal", by the way, it means "no fill"): * Use <pre> such that whitespace is preserved. * Preserve lines breaks. * For font alternating macros, avoid node recursion which required scary juggling with the fill state. Instead, simply print the text children directly. Missing feature first noticed by kristaps@ in 2011, the again reported by afresh1@ in 2016, and finally reported here: https://github.com/Debian/debiman/issues/21 , which i only found because of Shane Kerr's comment here: https://plus.google.com/110314300533310775053/posts/H1eaw9Yskoc
* clean up the remaining class attributesIngo Schwarze2017-01-211-4/+4
|
* Standardize class attributes for semantic macros.Ingo Schwarze2017-01-201-3/+3
| | | | Correct markup for .Va and iprove markup for .Dv, .Er, .Ev while here.
* Clean up CSS rules for sections and paragraphs.Ingo Schwarze2017-01-191-13/+9
| | | | Start using real macro names for CSS classes.
* Start cleanup: trim useless HTML comments, <div> elements,Ingo Schwarze2017-01-191-10/+8
| | | | and CSS rules on the <html> and <body> levels.
* Implement line breaking of the generated HTML code at space charactersIngo Schwarze2017-01-191-3/+1
| | | | | | | | | 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-2/+1
| | | | | 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-6/+5
| | | | | | | | | 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-92/+47
| | | | | | | | | | 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.
* unify names of AST node flags; no change of cpp outputIngo Schwarze2017-01-101-4/+4
|
* Delete the redundant "nchild" member of struct roff_node, replacingIngo Schwarze2016-01-081-3/+3
| | | | | | | | 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.
* modernize style: "return" is not a functionIngo Schwarze2015-10-061-31/+31
|
* /* NOTREACHED */ after abort() is silly, delete itIngo Schwarze2015-09-261-2/+1
|
* Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),Ingo Schwarze2015-04-181-14/+8
| | | | | | 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-2/+2
| | | | | Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
* Third step towards parser unification:Ingo Schwarze2015-04-021-4/+4
| | | | | 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-9/+9
| | | | | | | | | 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-27/+28
| | | | | | 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-1/+3
| | | | | | | 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.
* trim trailing white space, no code change;Ingo Schwarze2015-02-101-2/+2
| | | | from Svyatoslav Mishyn <juef at openmailboxd dot org>, Crux Linux
* Have pity on the poor stack.Ingo Schwarze2015-01-301-5/+6
| | | | | Replace tail recursion by iteration when walking the syntax trees. No functional change.
* Strangely, ignoring the roff(7) .na request was implemented in the man(7)Ingo Schwarze2015-01-241-2/+1
| | | | | parser. Simplify the code by moving it into the roff(7) parser, also making it work for mdoc(7).
* 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 handling of roff requests having a default scale other than "n",Ingo Schwarze2014-12-041-2/+2
| | | | | in particular .sp which uses "v", when the scale is not specified; cures groff-mandoc differences in about a dozen Xenocara manuals
* Fix the implementation and documentation of \c (continue text input line).Ingo Schwarze2014-12-021-11/+4
| | | | | 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-3/+2
| | | | | | * add missing forward declarations * remove needless header inclusions * some style unification
* Don't pretend we have a separate XHTML and HTML mode any more.Kristaps Dzonsons2014-09-271-2/+2
|
* Remove <p> in favour of <div class="spacer">.Kristaps Dzonsons2014-09-271-6/+7
| | | | | | | 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-8/+1
|
* HTML5-isation: remove more alignments.Kristaps Dzonsons2014-09-271-25/+24
|
* Continue in HTML5-ing by kicking out some hard-coded alignments.Kristaps Dzonsons2014-09-271-5/+3
|
* Kick out "summary" attribute, which isn't HTML5.Kristaps Dzonsons2014-09-271-7/+5
|
* First, add space for default styling for HTML5 (non-fragment) output.Kristaps Dzonsons2014-09-271-7/+5
| | | | | This uses a <style /> block right before the <link /> for the stylesheet. Use this to kick out hardcoded header and footer table widths.
* Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.Ingo Schwarze2014-08-101-3/+1
| | | | | | Include <sys/types.h> where needed, it does not belong in config.h. Remove <stdio.h> from config.h; if it is missing somewhere, it should be added, but i cannot find a *.c file where it is missing.
* Clarity with respect to floating point handling:Ingo Schwarze2014-08-011-2/+2
| | | | | | Write double constants as double rather than integer literals. Remove useless explicit (double) cast done at one place and nowhere else. No functional change.
* Audit strlcpy(3)/strlcat(3) usage.Ingo Schwarze2014-04-231-7/+3
| | | | | | | | | | | | | * Repair three instances of silent truncation, use asprintf(3). * Change two instances of strlen(3)+malloc(3)+strlcpy(3)+strlcat(3)+... to use asprintf(3) instead to make them less error prone. * Cast the return value of four instances where the destination buffer is known to be large enough to (void). * Completely remove three useless instances of strlcpy(3)/strlcat(3). * Mark two places in -Thtml with XXX that can cause information loss and crashes but are not easy to fix, requiring design changes of some internal interfaces. * The file mandocdb.c remains to be audited.
* fix unchecked snprintf(3) in page header printing:Ingo Schwarze2014-04-201-3/+6
| | | | | the length of the title is unknown, and speed doesn't matter here, so use asprintf/free rather than a static buffer
* KNF: case (FOO): -> case FOO:, remove /* LINTED */ and /* ARGSUSED */,Ingo Schwarze2014-04-201-48/+23
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* Implement the roff(7) .ll (line length) request.Ingo Schwarze2014-03-301-1/+2
| | | | | Found by naddy@ in the textproc/enchant(1) port. Of course, do not use this in new manuals.
* To find out whether .TP head arguments are same-line or next-line arguments,Ingo Schwarze2014-03-081-6/+11
| | | | | | | | use the MAN_LINE flag instead of the man_node line member. This is required such that user-defined macros wrapping .TP work correctly. Issue found by Havard Eidnes in Tcl_NewStringObj(3), reported via the NetBSD bug tracking system and Thomas Klausner <wiz at NetBSD>.
* Implement the .UR/.UE block (uniform resource identifier) introduced in theIngo Schwarze2013-10-171-1/+29
| | | | | | | | 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:Ingo Schwarze2012-11-171-28/+28
| | | | | | | | 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
* Minimal implementation of .EX and .EE for GNU compatibility.Ingo Schwarze2012-06-021-2/+4
| | | | | Do not use this, it is not portable and only defined in esr's man-ext. For example, sox(1) wants these macros.