summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/html.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* skip printing the embedded style sheet if an external style is referencedschwarze2018-05-011-6/+7
|
* preserve comments before .Dd and .TH (typically Copyright and license)schwarze2018-04-131-2/+28
| | | | | in full HTML output, but not with -Ofragment, e.g. in man.cgi(8); suggested by Thomas Klausner <wiz at NetBSD>
* fix a NULL pointer access on deroff() failure;schwarze2017-09-061-1/+3
| | | | | could be triggered with '.SS ""'; reported by Michael <Stapelberg at debian>
* In .Bl -tag and -hang, do not print a margin-left style attributeschwarze2017-07-151-14/+18
| | | | | | for each individual item if the -width argument matches the default of 6n. Suggested by Steffen Nurpmeso <steffen at sdaoden dot eu> on <groff at GNU dot org> in April 2017.
* Fix an assertion failure triggered by print_otag("sw+-l", NULL).schwarze2017-07-141-2/+7
| | | | | | Even though we skip the style when the argument is NULL, we must still consume the options. Not found with afl(1), but during manual testing of the previous patch...
* Handle .Bl -compact via CSS rather than writing individual styleschwarze2017-07-141-12/+1
| | | | | | | | attributes into .It blocks; suggested by Steffen Nurpmeso <steffen at sdaoden dot eu> on <groff at GNU dot org> in April 2017. Delete margin-bottom and margin-top style names and the 'v' argument letter from print_otag() because they are no longer used.
* Print HTML character references as 4+ digits hexadecimal, like Unicode.bentley2017-07-141-4/+4
| | | | tweaks + ok schwarze@
* Write text boxes as <mi>, <mn>, or <mo> as appropriate,schwarze2017-06-231-1/+2
| | | | | and write fontstyle or fontweight attributes where required. Missing features reported by bentley@.
* implement the roff(7) \p (break output line) escape sequenceschwarze2017-06-141-8/+27
|
* make the internal a2roffsu() interface more powerful by returningschwarze2017-06-081-2/+5
| | | | | a pointer to the end of the parsed data, making it easier to parse subsequent bytes
* Tweak previous: tb@ noticed that some browser/font combinationsschwarze2017-05-141-2/+2
| | | | | | have so amazingly wide bold fonts (for the same nominal font size) that adding 15% to the column width still isn't sufficient to make text reliably fit, so go for 20%.
* Make the tag column in .Bl -tag lists wider:schwarze2017-05-121-5/+11
| | | | | | 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@.
* Minimal support for deep linking into man(7) pages.schwarze2017-03-151-2/+25
| | | | | 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 (mainlyschwarze2017-03-141-1/+3
| | | | | | | | | | 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>.
* Print title="..." in addition to id="..." attributes for macro keysschwarze2017-03-131-6/+13
| | | | | that can be searched for by apropos(1), such that you see the semantic function in a tooltip when hovering with the mouse.
* mark up .Ar, .Fa, .Va, .Ft, and .Vt with <var> rather than <i>;schwarze2017-02-051-1/+2
| | | | suggested by bentley@ long ago, but needed lots of cleanup first
* for .Rs, use <cite>schwarze2017-02-051-1/+2
|
* Improve <table> syntax:schwarze2017-02-051-2/+2
| | | | | | | | 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;schwarze2017-01-291-10/+10
| | | | no functional change
* Simplify usage of print_otag() even more:schwarze2017-01-281-33/+51
| | | | accept NULL to skip the attribute or format.
* Fix -man -Thtml formatting after .nf (which has nothing to doschwarze2017-01-261-3/+2
| | | | | | | | | | | | | | | | 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
* Improve HTML formatting of .Bl -tag.schwarze2017-01-251-1/+4
| | | | | | | | | | | | | | | | | | | | | 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.
* slightly simplify header and footer stylesschwarze2017-01-211-5/+1
|
* clean up markup of .Bd, .D1, .Dl, .Li, and .Ql;schwarze2017-01-191-2/+1
| | | | in particular, stop abuse of <blockquote>
* Clean up CSS rules for sections and paragraphs.schwarze2017-01-191-3/+3
| | | | Start using real macro names for CSS classes.
* Implement line breaking of the generated HTML code at space charactersschwarze2017-01-191-65/+171
| | | | | | | | | 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 logicschwarze2017-01-181-77/+144
| | | | | 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*()schwarze2017-01-171-155/+73
| | | | | | | | | 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 variableschwarze2017-01-171-50/+135
| | | | | | | | | | 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.
* style: missing blank between case statement and label;schwarze2017-01-081-2/+2
| | | | from Tiago Silva <tiagofilipesilva at icloud dot com> long ago
* Generate simpler in-page links: just replace spaces with underscores.bentley2015-12-251-4/+4
| | | | | | | | | So http://example.com/OpenBSD-current/man1/ls.1#x546865204c6f6e6720466f726d6174 becomes http://example.com/OpenBSD-current/man1/ls.1#The_Long_Format ok schwarze@
* Major character table cleanup:schwarze2015-10-131-5/+3
| | | | | | | | | | | | | * Use ohash(3) rather than a hand-rolled hash table. * Make the character table static in the chars.c module: There is no need to pass a pointer around, we most certainly never want to use two different character tables concurrently. * No need to keep the characters in a separate file chars.in; that merely encourages downstream porters to mess with them. * Sort the characters to agree with the mandoc_chars(7) manual page. * Specify Unicode codepoints in hex, not decimal (that's the detail that originally triggered this patch). No functional change, minus 100 LOC, and i don't see a performance change.
* Fix an obvious bug found during the /* FALLTHROUGH */ cleanup:schwarze2015-10-121-2/+2
| | | | ASCII_NBRSP has to be rendered as "&nbsp;", not "-".
* To make the code more readable, delete 283 /* FALLTHROUGH */ commentsschwarze2015-10-121-11/+2
| | | | | | 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 function; ok cmp(1)schwarze2015-10-061-8/+8
|
* /* NOTREACHED */ after abort() is silly, delete itschwarze2015-09-261-2/+1
|
* Actually use the new man.conf(5) "output" directive.schwarze2015-03-271-29/+10
| | | | Additional functionality, yet minus 45 lines of code.
* Rudimentary implementation of the roff(7) \o escape sequence (overstrike).schwarze2015-01-211-2/+9
| | | | | | This is of some relevance because the pod2man(1) preamble abuses it for the icelandic letter Thorn, instead of simply using \(TP and \(Tp. Missing feature found by sthen@ in DateTime::Locale::is_IS(3p).
* resolve some code duplication; no functional changeschwarze2014-12-201-27/+19
|
* Fix the implementation and documentation of \c (continue text input line).schwarze2014-12-021-2/+3
| | | | | In particular, make it work in no-fill mode, too. Reminded by Carsten dot Kunze at arcor dot de (Heirloom roff).
* The header libmandoc.h is part of the internal parser interface,schwarze2014-12-011-2/+1
| | | | | | but html.c is not part of the parser at all, so it cannot include that header, and actually, it doesn't need it. Found while auditing includes after Theo's recent *.h commit.
* In terminal output, unify handling of Unicode and numbered characterschwarze2014-10-291-4/+7
| | | | | | | | | | | 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.
* Make the character table available to libroff so it can check theschwarze2014-10-281-22/+4
| | | | | | | | 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.
* Handle output encoding for unicode, numbered and named escape sequencesschwarze2014-10-271-23/+11
| | | | | | | | 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.89 reported by bentley@:schwarze2014-10-271-5/+6
| | | | | | | | | | 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.
* Improve -Tascii output for Unicode escape sequences: For the first 512schwarze2014-10-261-3/+13
| | | | | | | | | | | | 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.
* Add missing */ after $OpenBSD$ tagchl2014-10-131-1/+1
| | | | ok schwarze@
* Partial eqn(7) rewrite by kristaps@ in order to get operator precedence right.schwarze2014-10-101-1/+2
|
* parse and render "from" and "to" clauses in eqn, and render matrices;schwarze2014-10-091-1/+4
| | | | written by kristaps@ during EuroBSDCon
* initial bits of MathML rendering for eqn(7) -Thtml;schwarze2014-10-091-1/+16
| | | | written by kristaps@ during EuroBSDCon