summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man_html.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Strangely, ignoring the roff(7) .na request was implemented in the man(7)schwarze2015-01-241-2/+1
| | | | | parser. Simplify the code by moving it into the roff(7) parser, also making it work for mdoc(7).
* some scaling unit fixes:schwarze2014-12-231-2/+2
| | | | | - .sp with an invalid argument is .sp 1v, not .sp 0v - in man(1), trailing garbage doesn't make scaling units invalid
* fix handling of roff requests having a default scale other than "n",schwarze2014-12-041-2/+2
| | | | | in particular .sp which uses "v", when the scale is not specified; cures groff-mandoc differences in about a dozen Xenocara manuals
* Fix the implementation and documentation of \c (continue text input line).schwarze2014-12-021-11/+4
| | | | | In particular, make it work in no-fill mode, too. Reminded by Carsten dot Kunze at arcor dot de (Heirloom roff).
* header cleanup:schwarze2014-12-011-3/+2
| | | | | | * add missing forward declarations * remove needless header inclusions * some style unification
* Add some missing OpenBSD RCS markersschwarze2014-11-281-1/+1
| | | | and a few missing <sys/types.h> inclusions; no code change.
* Switch HTML output to polyglot HTML5; have only one single -Thml mode.schwarze2014-10-071-37/+24
| | | | | | | | Replace hard-coded widths and alignments with a minimal embedded stylesheet. Do not use <p> because it cannot appear inside block macros. Remove the "summary" attribute because it is not HTML5. Written by kristaps@ some months ago, finished during EuroBSDCon.
* Clarity with respect to floating point handling:schwarze2014-08-081-2/+2
| | | | | | Write double constants as double rather than integer literals. Remove useless explicit (double) cast done at one place and nowhere else. No functional change.
* Audit strlcpy(3)/strlcat(3) usage.schwarze2014-04-231-7/+3
| | | | | | | | | | | | | * Repair three instances of silent truncation, use asprintf(3). * Change two instances of strlen(3)+malloc(3)+strlcpy(3)+strlcat(3)+... to use asprintf(3) instead to make them less error prone. * Cast the return value of four instances where the destination buffer is known to be large enough to (void). * Completely remove three useless instances of strlcpy(3)/strlcat(3). * Mark two places in -Thtml with XXX that can cause information loss and crashes but are not easy to fix, requiring design changes of some internal interfaces. * The file mandocdb.c remains to be audited.
* fix unchecked snprintf(3) in page header printing:schwarze2014-04-201-3/+6
| | | | | the length of the title is unknown, and speed doesn't matter here, so use asprintf/free rather than a static buffer
* KNF: case (FOO): -> case FOO, remove /* LINTED */ and /* ARGSUSED */,schwarze2014-04-201-48/+23
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* Implement the roff(7) .ll (line length) request.schwarze2014-03-301-1/+2
| | | | | Found by naddy@ in the textproc/enchant(1) port. Of course, do not use this in new manuals.
* To find out whether .TP head arguments are same-line or next-line arguments,schwarze2014-03-081-6/+11
| | | | | | | | use the MAN_LINE flag instead of the man_node line member. This is required such that user-defined macros wrapping .TP work correctly. Issue found by Havard Eidnes in Tcl_NewStringObj(3), reported via the NetBSD bug tracking system and Thomas Klausner <wiz at NetBSD>.
* Implement the .UR/.UE block (uniform resource identifier) introduced in theschwarze2013-10-171-2/+30
| | | | | | | | man-ext macros by Eric S. Raymond, enabled by default in groff_man(7). Usual disclaimer: You don't write new man(7) code, so you are not going to use these, either. Improves e.g. the bzr(1) and etherape(1) manuals. Thanks to naddy@ for bringing these to my attention.
* Cleanup naming of local variables to make the code easier on the eye:schwarze2012-11-171-28/+28
| | | | | | | | Settle for "struct man *man", "struct mdoc *mdoc", "struct meta *meta" and avoid the confusing "*m" which was sometimes this, sometimes that. No functional change. ok kristaps@ some time ago
* Minimal implementation of .EX and .EE for GNU compatibility.schwarze2012-06-021-2/+4
| | | | | Do not use this, it is not portable and only defined in esr's man-ext. For example, sox(1) wants these macros.
* Support .OP, one of the extended man macros; from kristaps@.schwarze2012-02-261-11/+42
| | | | Do not use this GNU extension, we take it for compatibility only.
* When a man document contains nothing at all except one or more invalidschwarze2011-12-041-1/+6
| | | | | | macros, do not die on an assertion, but show correct error messages. Assertions of meta data validity suggested by joerg@. ok joerg@
* Always print <table> column widths in -T[x]html;schwarze2011-10-091-36/+18
| | | | | if desired, they can be overridden in the CSS file. Suggested by kristaps@, and i always like to simplify code.
* Sync to version 1.12.0; all code by kristaps@:schwarze2011-10-091-18/+17
| | | | | | | | Implement .Rv in -Tman. Let -man -Tman work a bit like cat(1). Add the -Ofragment option to -T[x]html. Minor fixes in -T[x]html. Lots of apropos(1) and -Tman code cleanup.
* sync to version 1.11.7 from kristaps@schwarze2011-09-181-2/+1
| | | | | | | | main new feature: support the roff(7) .tr request plus various bugfixes and some refactoring regressions are so minor that it's better to get this in and fix them in the tree
* sync to version 1.11.5:schwarze2011-09-181-5/+2
| | | | | | | | adding an implementation of the eqn(7) language by kristaps@ So far, only .EQ/.EN blocks are handled, in-line equations are not, and rendering is not yet very pretty, but the parser is fairly complete.
* clean up .HP, .IP, .TP, .nf, and \c handling in -T[x]html;schwarze2011-07-081-95/+33
| | | | from kristaps@
* Sync to bsd.lv (all coded by kristaps@):schwarze2011-07-051-8/+34
| | | | | | | | | | - mdoc(7): fix an assertion if the first line after .Bd -column starts with a blank, and some simplifications in mdoc_argv.c - man(7): literal mode ends at .SH and .SS (bug reported by naddy@) - allow .RS/.RE blocks to nest (bug reported by dcoppa@ and gsoares@) - improve vertical spacing of man(7) blocks - roff(7): clear user-defined strings when starting a new file - correct ID tags in -T[x]html
* Merge release 1.11.3, almost all code by kristaps@:schwarze2011-05-291-12/+22
| | | | | | | | | * Unicode output support (no Unicode input yet, though). * Refactoring: completely handle predefined strings in roff.c. - New function mandoc_escape() replaces a2roffdeco() and mandoc_special(). - Start using mandoc_getarg() in mdoc_argv.c. - Clean up parsing of delimiters in mdoc(7). * And many minor fixes and lots of cleanup.
* Merge version 1.10.10:schwarze2011-04-211-2/+7
| | | | | | | | | | lots of cleanup and maintenance work by kristaps@. - move some main.c globals into struct curparse - move mandoc_*alloc to mandoc.h such that all code can use them - make mandoc_isdelim available to formatting frontends - dissolve mdoc_strings.c, move the code where it is used - make all error reporting functions void, their return values were useless - and various minor cleanups and fixes
* Import the foundation for eqn(7) support.schwarze2011-03-201-1/+4
| | | | | | | | Written by kristaps@. For now, i'm adding one line to each of the four frontends to just pass the input text through to the output, not yet interpreting any of then eqn keywords.
* Clean up date handling,schwarze2011-03-071-8/+2
| | | | | | | | | | | | as a first step to get rid of the frequent petty warnings in this area: - always store dates as strings, not as seconds since the Epoch - for input, try the three most common formats everywhere - for unrecognized format, just pass the date though verbatim - when there is no date at all, still use the current date Originally triggered by a one-line patch from Tim van der Molen, <tbvdm at xs4all dot nl>, which is included here. Feedback and OK on manual parts from jmc@. "please check this in" kristaps@
* Refrain from throwing fatal errors forschwarze2011-01-171-3/+3
| | | | | | | * .br .sp .nf .fi .na with arguments - just skip the arguments * .TH lacking arguments - use empty strings instead like groff * .TH with excessive arguments - skip those Reminded by Joerg Sonnenberger, ok kristaps@.
* Merge from bsd.lv, original commit message by kristaps@:schwarze2011-01-161-3/+17
| | | | | | | | | | Change how -Thtml behaves with tables: use multiple rows, with widths set by COL, until an external macro is encountered. At this point in time, close out the table and process the macro. When the first table row is again re-encountered, re-start the table. This requires a bit of tracking added to "struct html", but the change is very small and follows the logic of meta-fonts. This all follows a bug-report by joerg@.
* In literal context, do not generate output line breaks between macroschwarze2011-01-161-14/+6
| | | | | | arguments. This fixes a long-standing bug reported repeatedly, in particular by naddy@ and brad@. Fix by kristaps@, minus one regression caught by my test suite.
* If the first character of a free-form text input line is whitespace,schwarze2011-01-161-1/+10
| | | | | then it will start a new output line; from kristaps@.
* Remove an unused variable, and use int for array indices (not size_t);schwarze2011-01-091-5/+3
| | | | found by lint(1), fixed by kristaps@, no functional change.
* Merge kristaps@' cleaner tbl integration, removing mine;schwarze2011-01-041-7/+6
| | | | there are still a few bugs, but fixing these will be easier in tree.
* Multiple man(7) .IP and .TP fixes started during p2k10:schwarze2011-01-041-22/+10
| | | | | | | | | | | | | | | | | | | | | Affecting both -Tascii and -Thtml: * The .IP HEAD uses the second argument as the width, not the last one. * Only print the first .IP HEAD argument, not all but the last. Affecting only -Tascii: * The .IP and .TP HEADs must be printed without literal mode, but literal mode must be restored afterwards. * After the .IP and .TP bodies, we only want term_newln(), not term_flushln(), or we would get two blank lines in literal mode. * The .TP HEAD does not use TWOSPACE, just like .IP doesn't either. * In literal mode, clear NOLPAD after each line, or subsequent lines would get no indentation whatsoever. Affecting only -Thtml: * Only print next-line .TP children, instead of all but the first. OK kristaps@ on the -Tascii part; and: "Can you work this into man_html.c, too?"
* Yet another batch of -Thtml polishing from kristaps@:schwarze2010-12-251-29/+24
| | | | | | | | In particular, use <SMALL> for .SM and <CODE> for .Dl. Use <B> for bold and <I> for italic in general. Also call this mandoc 1.10.8 now, as it is functionally equivalent, even though one one set of refactoring patches has not been merged yet because it conflicts with our tbl(1) handling.
* Use yet more standard HTML tags,schwarze2010-12-221-97/+79
| | | | | this time some more <P> and <TABLE> instead of <DIV>. From kristaps@.
* Significant improvements to -Thtml by kristaps@:schwarze2010-12-191-96/+32
| | | | | | Use less <DIV>, use more <H1>, <H2>, <P>, <BR>, <PRE>, <UL>, <OL>, <DL> etc. Triggered by input from Will Backman. Remove CSS2 note in mandoc.1, which is no longer true.
* Remove `i' and `r' macro handlers. These macros, originally part of theschwarze2010-12-191-3/+1
| | | | | | | me package, aren't recognised by "groff -mandoc" so we don't need to do so either. Besides, they are not used in base or Xenocara, and only at two or three places in one single port, which are probably typos. From kristaps@.
* Back out my .ft implementation for -Thtml.schwarze2010-12-071-46/+2
| | | | | | Kristaps says it is broken and cannot work, because HTML needs a block structure which .ft does not provide. Thus, let us just ignore .ft in HTML output.
* Never print .P, .PP, and .LP header content.schwarze2010-12-061-2/+5
| | | | From kristaps@.
* Now that we have proper .de support in the roff(7) library,schwarze2010-11-291-21/+5
| | | | | it is time to remove the .Sp, .Vb, and .Ve kludge that was added to the man(7) library to build Perl manuals.
* Implement the roff .ft (change font) request for man(7).schwarze2010-11-291-1/+46
| | | | | | | | Of course, we don't want to encourage low-level physical markup, but pod2man(1) writes such requests, so Perl manuals contain them, and some Xenocara and lots and lots of ports manuals use them as well. In base and Xenocara, this will reduce mandoc -Tlint ERROR noise; in ports, it will improve rendering of many manuals.
* Minimal glue to integrate tbl into the mandoc man(7) parser and formatter.schwarze2010-10-151-1/+3
| | | | | | The output dosn't look nice yet, escape handling is still missing, but will follow soon. "move forward aggressively :-)" deraadt@
* Sync to bsd.lv; in particular, pull in lots of bug fixes.schwarze2010-07-251-18/+65
| | | | | | | | | | | | | | | | | | | | | new features: * support the .in macro in man(7) * support minimal PDF output * support .Sm in mdoc(7) HTML output * support .Vb and .nf in man(7) HTML output * complete the mdoc(7) manual bug fixes: * do not let mdoc(7) .Pp produce a newline before/after .Sh; reported by jmc@ * avoid double blank lines related to man(7) .sp and .br * let man(7) .nf and .fi flush the line; reported by jsg@ and naddy@ * let "\ " produce a non-breaking space; reported by deraadt@ * discard \m colour escape sequences; reported by J.C. Roberts * map undefined 1-character-escapes to the literal character itself maintenance: * express mdoc(7) arguments in terms of an enum for additional type-safety * simplify mandoc_special() and a2roffdeco() * use strcspn in term_word() in place of a manual loop * minor optimisations in the -Tps and -Thtml formatting frontends
* Merge release 1.10.4 (all code by kristaps@), providing four new features:schwarze2010-07-131-3/+2
| | | | | | | | | | 1) Proper .Bk support: allow output line breaks at input line breaks, but keep input lines together in the output, finally fixing synopses like aucat(1), mail(1) and tmux(1). 2) Mostly finished -Tps (PostScript) output. 3) Implement -Thtml output for .Nm blocks and .Bk -words. 4) Allow iterative interpolation of user-defined roff(7) strings. Also contains some minor bugfixes and some performance improvements.
* Full .nr nS support, unbreaking the kernel manuals.schwarze2010-06-271-2/+3
| | | | | | | | | Kristaps coded this from scratch after reading my .nr patch; it is simpler and more powerful. Registers live in struct regset in regs.h, struct man and struct mdoc contain pointers to it. The nS register is cleared when parsing .Sh. Frontends respect the MDOC_SYNPRETTY flag set in mdoc node_alloc.
* Merge bsd.lv release 1.10.0,schwarze2010-06-061-2/+5
| | | | | | | | | | | | | | | | which is mostly the post-hackathon release, bringing in the OpenBSD changes to bsd.lv, but which also has a few additional minor fixes: * .Lb is an in-line macro, not in_line_eoln * .Bt, .Ud now warn when discarding arguments * allow bad -man dates to flow verbatim into the front-ends - so far all reported by Ulrich Spoerlein * .Ar, .Fl and .Li starting with closing punctuation emit an empty element * empty .Li macros print nothing, but may cause spacing * proper EOS handling for .Bt, .Ex, .Rv, and .Ud. * cleanup: collapse posts_xr into posts_wtext (which is the same) * efficiency: very simple table lookup for roff.c
* Unified error and warning message system for all of mandoc,schwarze2010-05-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | featuring three message levels, as agreed during the mandoc hackathon: * FATAL parser failure, cannot produce any output from this input file: eventually, we hope to convert most of these to ERRORs. * ERROR, meaning mandoc cannot cope fully with the input syntax and will probably lose information or produce structurally garbled output; it will try to produce output anyway but exit non-zero at the end, which is eventually intended to make the ports infrastructure happy. * WARNING, meaning you should clean up the input file, but output is probably mostly OK, so this will not cause error-exit at the end. This commit is mostly just converting the old system to the new one; before the classification will become really reliable, we must check all messages. In particular, * set up a new central message string table in main.c * drop the old message string tables from man.c and mdoc.c * get rid of the piece-meal merr enums in libman and libmdoc * reduce number of error/warning functions from 16 to 6 (still a lot...) While here, handle a few problems more gracefully: * allow .Rv and .Ex to work without a prior .Nm * allow .An to ignore extra arguments * allow undeclared columns in .Bl -column Written by kristaps@.
* implement .AT and .UC; from Joerg Sonnenbergerschwarze2010-05-231-1/+2
|