summaryrefslogtreecommitdiffstats
path: root/roff_html.c
Commit message (Collapse)AuthorAgeFilesLines
* Because mandoc_aux.h and mandoc.h use __attribute__, all files thatIngo Schwarze2020-06-221-1/+3
| | | | | | | | include mandoc_aux.h or mandoc.h need to include config.h, too. It is suspected that for example IRIX needs this, or it is likely to throw errors in these files because the system compiler doesn't understand __attribute__. Issue reported by Kazuo Kuroi <kazuo at irixnet dot org>.
* In HTML output, allow switching the desired font for subsequentIngo Schwarze2019-04-301-1/+1
| | | | | | | | 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.
* Represent mdoc(7) .Pp (and .sp, and some SYNOPSIS and .Rs features)Ingo Schwarze2019-01-071-3/+3
| | | | | | | | | | | | | | | | | | | 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.
* Finally, represent the man(7) .PP and .HP macros by the naturalIngo Schwarze2019-01-061-1/+7
| | | | | | | | | | | choice, which is the <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.
* Now that the NODE_NOFILL flag in the syntax tree is accurate,Ingo Schwarze2019-01-051-3/+19
| | | | | | | | | | 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.
* Move parsing of the .nf and .fi (fill mode) requests from the man(7)Ingo Schwarze2018-12-311-0/+2
| | | | | | 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.
* Yet another round of improvements to manual font selection.Ingo Schwarze2018-12-161-2/+14
| | | | | | | | | 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-1/+0
| | | | | | | | | | 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.
* Render .br as <br/>, not as an empty <div>.Ingo Schwarze2018-12-031-5/+1
| | | | | | | | | | | | | | | | | 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
* Get rid of the last explicit length in HTML style= attributes.Ingo Schwarze2018-06-251-12/+2
| | | | | | | | | 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.
* Split -Wstyle into -Wstyle and the even lower -Wbase, and addIngo Schwarze2017-06-241-0/+1
| | | | | | | | | | | | | | | -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@.
* Naive implementation of the roff(7) .po (page offset) request.Ingo Schwarze2017-06-141-0/+1
| | | | | | 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 :).
* implement roff(7) .rj (right justify) requestIngo Schwarze2017-06-141-0/+1
|
* make the internal a2roffsu() interface more powerful by returningIngo Schwarze2017-06-081-1/+1
| | | | | a pointer to the end of the parsed data, making it easier to parse subsequent bytes
* Minimal implementation of the roff(7) .ce request (center a numberIngo Schwarze2017-06-061-1/+20
| | | | | of input lines without filling). Contrary to groff, high-level macros abort .ce mode for now.
* Implement the roff(7) .mc (right margin character) request.Ingo Schwarze2017-06-041-1/+2
| | | | | | 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.
* Basic implementation of the roff(7) .ti (temporary indent) request.Ingo Schwarze2017-05-081-0/+1
| | | | Needed by about four dozen ports (thanks to naddy@ for the research).
* Basic implementation of the roff(7) .ta (define tab stops) request.Ingo Schwarze2017-05-071-0/+1
| | | | | | 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@.
* Move .sp to the roff modules. Enough infrastructure is in placeIngo Schwarze2017-05-051-1/+21
| | | | now that this actually saves code: -70 LOC.
* Move handling of the roff(7) .ft request from the man(7)Ingo Schwarze2017-05-051-1/+4
| | | | | 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-0/+48
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).