aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_html.c
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup, no functional change:Ingo Schwarze2018-12-311-13/+4
| | | | | | | | | | Stop trying to keep fill mode state locally in the mdoc HTML formatter, rely on the state stored in the nodes instead. Note that the .Bd -literal code is buggy. Nested literal displays result in nested <pre> elements, which violates HTML syntax. But i'm not yet fixing bugs in this commit, i'm merely deleting code which has no effect.
* Cleanup, no functional change:Ingo Schwarze2018-12-301-6/+6
| | | | | | | | | | | | | | The struct roff_man used to be a bad mixture of internal parser state and public parsing results. Move the public results to the parsing result struct roff_meta, which is already public. Move the rest of struct roff_man to the parser-internal header roff_int.h. Since the validators need access to the parser state, call them from the top level parser during mparse_result() rather than from the main programs, also reducing code duplication. This keeps parser internal state out of thee main programs (five in mandoc portable) and out of eight formatters.
* bugfix: make the static class buffer long enoughIngo Schwarze2018-12-251-2/+2
| | | | for .Bl -bullet -compact -offset indent
* In the TOC, close <a> before opening <ul>.Ingo Schwarze2018-12-221-2/+3
| | | | Simplified version of a bugfix patch from rapha@.
* Yet another round of improvements to manual font selection.Ingo Schwarze2018-12-161-1/+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.
* Cleanup, no functional change:Ingo Schwarze2018-12-131-2/+1
| | | | | | | | | | Split the top level parser interface out of the utility header mandoc.h, into a new header mandoc_parse.h, for use in the main program and in the main parser only. Move enum mandoc_os into roff.h because struct roff_man is the place where it is stored. This allows removal of mandoc.h from seven files in low-level parsers and in formatters.
* In the validators, translate obsolete macro aliases (Lp, Ot, LP, P)Ingo Schwarze2018-12-031-4/+10
| | | | | | to the standard forms (Pp, Ft, PP) up front, such that later code does not need to look for the obsolete versions. This reduces the risk of incomplete handling.
* When a subsection header contains no letters but only specialIngo Schwarze2018-10-041-2/+4
| | | | characters, skip the TOC entry. Issue reported by kristaps@.
* add DESCRIPTION and .Ss to the toc; suggested by espie@Ingo Schwarze2018-10-021-7/+23
|
* Add an option -T html -O toc to add a brief table of contents nearIngo Schwarze2018-10-021-2/+32
| | | | | 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/+2
| | | | | | 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.
* Remove more pointer arithmetic passing via regions outside the arrayIngo Schwarze2018-08-171-8/+8
| | | | | that is undefined according to the C standard. Robert Elz <kre at munnari dot oz dot au> pointed out i wasn't quite done yet.
* garbage collect the unused "#define INDENT"Ingo Schwarze2018-07-271-3/+1
|
* Delete substantial amounts of codeIngo Schwarze2018-06-251-4/+3
| | | | now that we no longer use variable style= attributes.
* Drop explicit, constant style=margin-left attribute on .Bf blocks.Ingo Schwarze2018-06-251-2/+2
| | | | Since <div> uses HTML_NLAROUND, it is no longer needed.
* Do not write <colgroup> elements. Their only purpose is to enforceIngo Schwarze2018-06-251-22/+2
| | | | | | 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.
* In HTML output, for lists that have an -indent argument, just useIngo Schwarze2018-06-101-17/+10
| | | | | | | | | | | | | a uniform indentation in CSS adapted to the viewport width and ignore the value of the argument taken from mdoc(7). While author-specified widths somewhat work as a micro-optimization in terminal and typeset output, they are nothing but harmful in HTML style= attributes because they break responsive design, whereas using a reasonable default indent almost never results in ugly output. Admittedly, the author-specified width might occasionally look even better, but only slightly so, and only for some viewport sizes. Based on guidance provided by John Gardner.
* Ignore author-specified -width arguments for -tag and -hang listsIngo Schwarze2018-05-291-7/+6
| | | | | | | | | | | | | | | in HTML output. For terminal and typeset output, such arguments kind of work to achieve presentational micro-optimization. But for HTML, they only do harm. Large increases usually look ugly. Large reductions are impossible since the default is not large in the first place. Small tweaks in either direction are not important; at least not important enough to justify making responsive design impossible. Triggered by John Gardner's suggestion to further reduce style= attributes in the HTML code, in particular those containing hard-coded lengths.
* Do not write duplicate id= attributes, they violate HTML syntax.Ingo Schwarze2018-05-251-17/+6
| | | | | 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-2/+2
|
* Use <span> for .Ad rather than <i>; also suggested by John Gardner.Ingo Schwarze2018-05-211-2/+2
|
* Use <span> rather than abusing <i> for .Pa;Ingo Schwarze2018-05-211-2/+2
| | | | suggested by John Gardner <gardnerjohng at gmail dot com>.
* Fix a long-standing issue:Ingo Schwarze2018-05-091-15/+11
| | | | | | | | | 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-54/+13
| | | | | 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-11/+11
| | | | | | | | 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>.
* replace my vague and idiosyncratic term "selflink"Ingo Schwarze2018-04-241-12/+12
| | | | | with the clearer and more usual "permalink"; suggested by John Gardner <gardnerjohng at gmail dot com>
* preserve comments before .Dd and .TH (typically Copyright and license)Ingo Schwarze2018-04-131-13/+20
| | | | | in full HTML output, but not with -Ofragment, e.g. in man.cgi(8); suggested by Thomas Klausner <wiz at NetBSD>
* preserve comments before .Dd when converting mdoc(7) to man(7)Ingo Schwarze2018-04-111-2/+2
| | | | with mandoc -Tman; suggested by Thomas Klausner <wiz at NetBSD>
* In .Bl -tag and -hang, do not print a margin-left style attributeIngo Schwarze2017-07-151-5/+5
| | | | | | 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.
* use the same width increase logic for .Bl -hang as for .Bl -tagIngo Schwarze2017-07-151-2/+2
|
* Handle .Bl -compact via CSS rather than writing individual styleIngo Schwarze2017-07-141-26/+19
| | | | | | | | 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.
* Split -Wstyle into -Wstyle and the even lower -Wbase, and addIngo Schwarze2017-06-241-1/+2
| | | | | | | | | | | | | | | -Wopenbsd and -Wnetbsd to check conventions for the base system of a specific operating system. Mark operating system specific messages with "(OpenBSD)" at the end. Please use just "-Tlint" to check base system manuals (defaulting to -Wall, which is now -Wbase), but prefer "-Tlint -Wstyle" for the manuals of portable software projects you maintain that are not part of OpenBSD base, to avoid bogus recommendations about base system conventions that do not apply. Issue originally reported by semarie@, solution using an idea from tedu@, discussed with jmc@ and jca@.
* Fix a regression in the previous revision:Ingo Schwarze2017-06-191-3/+7
| | | | | When there is no link description, reuse the URI. Reported by tj@ and bentley@.
* fix formatting of intermediate punctuation in .LkIngo Schwarze2017-05-301-10/+18
|
* Delete pointless width calculation for SYNOPSIS .Nm block heads.Ingo Schwarze2017-05-171-18/+1
| | | | | | 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-5/+5
| | | | | | 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-4/+4
| | | | | 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-27/+3
| | | | now that this actually saves code: -70 LOC.
* move .ll to the roff modulesIngo Schwarze2017-05-051-2/+1
|
* Move handling of the roff(7) .ft request from the man(7)Ingo Schwarze2017-05-051-1/+2
| | | | | 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-18/+8
| | | | | | | 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-4/+15
| | | | | 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-5/+8
| | | | | | | | * 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-9/+15
| | | | | | | | | 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-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-29/+6
| | | | | 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-2/+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>.
* Port ctags-style, less(1) :t internal searching from terminal outputIngo Schwarze2017-03-131-11/+81
| | | | | | | | | | 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-43/+43
| | | | | 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-2/+2
|