summaryrefslogtreecommitdiffstats
path: root/html.c
Commit message (Collapse)AuthorAgeFilesLines
* Yet another round of improvements to manual font selection.Ingo Schwarze2018-12-161-3/+2
| | | | | | | | | Unify handling of \f and .ft. Support \f4 (bold+italic). Support ".ft BI" and ".ft CW" for terminal output. Support the .ft request in HTML output. Reject the bogus fonts \f(C1, \f(C2, \f(C3, and \f(CP. In regress.pl, only strip leading whitespace in math mode.
* Several improvements to escape sequence handling.Ingo Schwarze2018-12-151-3/+5
| | | | | | | | | | | | | | | | | | | | | | | * Add the missing special character \_ (underscore). * Partial implementations of \a (leader character) and \E (uninterpreted escape character). * Parse and ignore \r (reverse line feed). * Add a WARNING message about undefined escape sequences. * Add an UNSUPP message about unsupported escape sequences. * Mark \! and \? (transparent throughput) and \O (suppress output) as unsupported. * Treat the various variants of zero-width spaces as one-byte escape sequences rather than as special characters, to avoid defining bogus forms with square brackets. * For special characters with one-byte names, do not define bogus forms with square brackets, except for \[-], which is valid. * In the form with square brackets, undefined special characters do not fall back to printing the name verbatim, not even for one-byte names. * Starting a special character name with a blank is an error. * Undefined escape sequences never abort formatting of the input string, not even in HTML output mode. * Document the newly handled escapes, and a few that were missing. * Regression tests for most of the above.
* HTML syntax audit: render \p as <br/>, not as <div>.Ingo Schwarze2018-12-041-4/+1
| | | | It can occur anywhere, in particular in phrasing context.
* Support more than one style attribute one the same HTML element.Ingo Schwarze2018-11-261-15/+24
| | | | | In fact, this is already required when a table uses non-default horizontal and vertical alignment in the same cell.
* When a font escape appears in the middle of a string,Ingo Schwarze2018-11-231-1/+4
| | | | | make sure it doesn't cause output of bogus whitespace. Fixing a bug reported by Pali dot Rohar at gmail dot com.
* Implement the \f(CW and \f(CR (constant width font) escape sequencesIngo Schwarze2018-10-251-0/+10
| | | | | | | | | for HTML output. Somewhat relevant because pod2man(1) relies on this. Missing feature reported by Pali dot Rohar at gmail dot com. Note that constant width font was already correctly selected before this when required by semantic markup. Only attempting physical markup with the low-level escape sequence was ineffective.
* Add an option -T html -O toc to add a brief table of contents nearIngo Schwarze2018-10-021-0/+2
| | | | | the top of HTML pages containing at least two non-standard sections. Suggested by Adam Kalisz and discussed with kristaps@ during EuroBSDCon 2018.
* Support a second argument to -O man,Ingo Schwarze2018-10-021-2/+18
| | | | | | selecting the format according to local existence of the file. Suggested by kristaps@ during EuroBSDCon 2018. Written on the train Frankfurt-Karlsruhe returning from EuroBSDCon.
* Implement the \*(.T predefined string (interpolate device name)Ingo Schwarze2018-08-161-0/+3
| | | | | by allowing the preprocessor to pass it through to the formatters. Used for example by the groff_char(7) manual page.
* Delete substantial amounts of codeIngo Schwarze2018-06-251-138/+17
| | | | now that we no longer use variable style= attributes.
* Delete support for style=margin-left attributes, which are no longer used.Ingo Schwarze2018-06-251-10/+2
|
* Delete support for style=width attributes, which are no longer used.Ingo Schwarze2018-06-251-40/+0
|
* Do not write <colgroup> elements. Their only purpose is to enforceIngo Schwarze2018-06-251-2/+0
| | | | | | author-specified column widths, which can harm responsive design and provide no real benefit: HTML rendering engines usually do just fine automatically selecting appropriate column widths.
* Delete support for the style=text-indent attribute, which is no longer used.Ingo Schwarze2018-06-251-4/+1
|
* Revert previous: style=height is still used by roff_html.c, and itIngo Schwarze2018-06-181-1/+4
| | | | | doesn't actually harm responsive design, so keep it for now. Bug reported in de.comp.os.unix.bsd via naddy@, thanks.
* delete support for the HTML style=height property, which is no longer usedIngo Schwarze2018-06-101-3/+0
|
* Delete support for the print_otag(sw) * and - modifiers,Ingo Schwarze2018-05-291-11/+0
| | | | which are no longer used because we write fewer style= attributes.
* URL-fragment strings can only contain certain characters.Ingo Schwarze2018-05-281-2/+8
| | | | | Fixing HTML syntax violations e.g. in pf.conf(5) and ifconfig(8) reported by Anton Lazarov <lists at wrant dot com>.
* Do not write duplicate id= attributes, they violate HTML syntax.Ingo Schwarze2018-05-251-4/+44
| | | | | Append suffixes for disambiguation. Issue first reported by Jakub Klinkovsky <j dot l dot k at gmx dot com> (Arch Linux).
* Use <span> for .Ms rather than <b>; discussed with John Gardner.Ingo Schwarze2018-05-211-0/+2
|
* Use <span> for .Ad rather than <i>; also suggested by John Gardner.Ingo Schwarze2018-05-211-1/+1
|
* Use <span> rather than abusing <i> for .Pa;Ingo Schwarze2018-05-211-0/+2
| | | | suggested by John Gardner <gardnerjohng at gmail dot com>.
* Fix a long-standing issue:Ingo Schwarze2018-05-091-0/+3
| | | | | | | | | Some macros (Nd, Oo) can contain blocks but rendered as elements that can only contain phrasing content, resulting in invalid HTML nesting. Switch them to <div>. Also move the related "display: inline" style from the HTML to the CSS. Reminded during a conversation with John Gardner.
* Eliminate the class=It-* attributes.Ingo Schwarze2018-05-081-0/+4
| | | | | Cleaner HTML, more idiomatic CSS, and minus 30 lines of C code. Suggested by John Gardner <gardnerjohng at gmail dot com>.
* Switch the emitted HTML element from <b> to <code> for the fixedIngo Schwarze2018-05-081-0/+6
| | | | | | | | syntax element macros .Nm, .Fl, .Cm, .Ic, .In, .Fd, .Fn, and .Cd. Adjust both the internal and external style sheets such that rendering remains unchanged in typical browsers. Based on feedback from John Gardner <gardnerjohng at gmail dot com>.
* skip printing the embedded style sheet if an external style is referencedIngo Schwarze2018-05-011-5/+6
|
* preserve comments before .Dd and .TH (typically Copyright and license)Ingo Schwarze2018-04-131-1/+27
| | | | | 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;Ingo Schwarze2017-09-061-0/+2
| | | | | could be triggered with '.SS ""'; reported by Michael <Stapelberg at debian>
* In .Bl -tag and -hang, do not print a margin-left style attributeIngo Schwarze2017-07-151-13/+17
| | | | | | 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).Ingo Schwarze2017-07-141-1/+6
| | | | | | 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 styleIngo Schwarze2017-07-141-11/+0
| | | | | | | | 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;Ingo Schwarze2017-07-141-3/+3
| | | | from bentley@, tweaked by me
* Write text boxes as <mi>, <mn>, or <mo> as appropriate,Ingo Schwarze2017-06-231-0/+1
| | | | | and write fontstyle or fontweight attributes where required. Missing features reported by bentley@.
* implement the roff(7) \p (break output line) escape sequenceIngo Schwarze2017-06-141-7/+26
|
* make the internal a2roffsu() interface more powerful by returningIngo Schwarze2017-06-081-1/+4
| | | | | a pointer to the end of the parsed data, making it easier to parse subsequent bytes
* Tweak previous: tb@ noticed that some browser/font combinationsIngo Schwarze2017-05-141-1/+1
| | | | | | 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:Ingo Schwarze2017-05-121-4/+10
| | | | | | 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.Ingo Schwarze2017-03-151-1/+24
| | | | | 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-0/+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>.
* Print title="..." in addition to id="..." attributes for macro keysIngo Schwarze2017-03-131-5/+12
| | | | | 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>;Ingo Schwarze2017-02-051-0/+1
| | | | suggested by bentley@ long ago, but needed lots of cleanup first
* for .Rs, use <cite>Ingo Schwarze2017-02-051-0/+1
|
* Improve <table> syntax:Ingo Schwarze2017-02-051-1/+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.
* eliminate one useless struct and one level of indirection;Ingo Schwarze2017-01-291-9/+9
| | | | no functional change
* Simplify usage of print_otag() even more:Ingo Schwarze2017-01-281-32/+50
| | | | accept NULL to skip the attribute or format.
* Fix -man -Thtml formatting after .nf (which has nothing to doIngo Schwarze2017-01-261-2/+1
| | | | | | | | | | | | | | | | 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.Ingo Schwarze2017-01-251-0/+3
| | | | | | | | | | | | | | | | | | | | | 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 stylesIngo Schwarze2017-01-211-4/+0
|
* clean up markup of .Bd, .D1, .Dl, .Li, and .Ql;Ingo Schwarze2017-01-191-1/+0
| | | | in particular, stop abuse of <blockquote>
* Clean up CSS rules for sections and paragraphs.Ingo Schwarze2017-01-191-2/+2
| | | | Start using real macro names for CSS classes.