summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/roff_html.c
AgeCommit message (Collapse)Author
2019-04-30In HTML output, allow switching the desired font for subsequentIngo Schwarze
text without printing an opening tag right away, and use that in the .ft request handler. While here, garbage collect redundant enum htmlfont and reduce code duplication in print_text(). Fixing an assertion failure reported by Michael <Stapelberg at Debian> in pmRegisterDerived(3) from libpcp3-dev.
2019-01-07Represent mdoc(7) .Pp (and .sp, and some SYNOPSIS and .Rs features)Ingo Schwarze
by the <p> HTML element and use the html_fillmode() mechanism for .Bd -unfilled, just like it was done for man(7) earlier, finally getting rid both of the horrible <div class="Pp"></div> hack and of the worst HTML syntax violations caused by nested displays. Care is needed because in some situations, paragraphs have to remain open across several subsequent macros, whereas in other situations, they must get closed together with a block containing them. Some implementation details include: * Always close paragraphs before emitting HTML flow content. * Let html_close_paragraph() also close <pre> for extra safety. * Drop the old, now unused function print_paragraph(). * Minor adjustments in the top-level man(7) node formatter for symmetry. * Bugfix: .Ss heads suspend no-fill mode, even though .Ss doesn't end it. * Bugfix: give up on .Op semantic markup for now, see the comment.
2019-01-06Finally, represent the man(7) .PP and .HP macros by the naturalIngo Schwarze
choice, which is <p> HTML element. On top of the previous fill-mode improvements, the key to making this possible is to automatically close the <p> when required: before headers, subsequent paragraphs, lists, indented blocks, synopsis blocks, tbl(7) blocks, and before blocks using no-fill mode. In man(7) documents, represent the .sp request by a blank line in no-fill mode and in the same way as .PP in fill mode.
2019-01-05Now that the NODE_NOFILL flag in the syntax tree is accurate,Ingo Schwarze
use it in the man(7) HTML formatter rather than keeping fill mode state locally, resulting in massive simplification (minus 40 LOC). Move the html_fillmode() state handler function to the html.c module such that both the man(7) and the roff(7) formatter (and in the future, also the mdoc(7) formatter) can use it. Give it a query mode, to be invoked with TOKEN_NONE.
2018-12-31Move parsing of the .nf and .fi (fill mode) requests from the man(7)Ingo Schwarze
parser to the roff(7) parser. As a side effect, .nf and .fi are now also parsed in mdoc(7) input, though the mdoc(7) formatters still ignore most of their effect.
2018-12-15Yet another round of improvements to manual font selection.Ingo Schwarze
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.
2018-12-13Cleanup, no functional change:Ingo Schwarze
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.
2018-12-03Render .br as <br/>, not as an empty <div>.Ingo Schwarze
The element <br/> was already employed for many other purposes, so there is nothing wrong with using it. Also, it is safer because <br/> is permitted in phrasing content, whereas <div> is only allowed in flow content. This is the first part of the HTML syntax audit which i wanted to do for a long time. Reminded by a loosely related bug report from Mark Harris <mark dot hsj at gmail dot com>. Examples of where this caused HTML nesting syntax errors: * in man(7) code between .nf and .fi * in mdoc(7) code between .Bd -unfilled and .Ed * in mdoc(7) code between .Ql Xo and .Xc * in mdoc(7) code between .Rs and .Re
2018-06-25Get rid of the last explicit length in HTML style= attributes.Ingo Schwarze
Even though style=height is not particularly harmful for responsive design except for very large arguments which don't really occur in practice, it is not useful either: nobody should use .sp in manual pages, in particular not with an argument. Even if somebody does, ignoring the argument will likely make the output look better rather than worse. Consequently, simplify by dropping a useless feature.
2017-06-24Split -Wstyle into -Wstyle and the even lower -Wbase, and addIngo Schwarze
-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@.
2017-06-14Naive implementation of the roff(7) .po (page offset) request.Ingo Schwarze
This clearly works when .po is called on the top level, but might not be sophisticated enough if people call .po inside indentation-changing contexts, but i haven't seen that in manual pages (yet :).
2017-06-14implement roff(7) .rj (right justify) requestIngo Schwarze
2017-06-08make the internal a2roffsu() interface more powerful by returningIngo Schwarze
a pointer to the end of the parsed data, making it easier to parse subsequent bytes
2017-06-06Minimal implementation of the roff(7) .ce request (center a numberIngo Schwarze
of input lines without filling). Contrary to groff, high-level macros abort .ce mode for now.
2017-06-04Implement the roff(7) .mc (right margin character) request.Ingo Schwarze
The Tcl/Tk manual pages use this extensively. Delete the TERM_MAXMARGIN hack, it breaks .mc inside .nf; instead, implement a proper TERMP_BRNEVER flag.
2017-05-08Basic implementation of the roff(7) .ti (temporary indent) request.Ingo Schwarze
Needed by about four dozen ports (thanks to naddy@ for the research).
2017-05-07Basic implementation of the roff(7) .ta (define tab stops) request.Ingo Schwarze
This is the first feature made possible by the parser reorganization. Improves the formatting of the SYNOPSIS in many Xenocara GL manuals. Also important for ports, as reported by many, including naddy@.
2017-05-05Move .sp to the roff modules. Enough infrastructure is in placeIngo Schwarze
now that this actually saves code: -70 LOC.
2017-05-05Move handling of the roff(7) .ft request from the man(7)Ingo Schwarze
modules to the new roff(7) modules. As a side effect, mdoc(7) now handles .ft, too. Of course, do not use that.
2017-05-04Start roff formatter modules for HTML and termininal output,Ingo Schwarze
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).