summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/man_html.c
AgeCommit message (Collapse)Author
2015-10-06modernize style: "return" is not a function; ok cmp(1)Ingo Schwarze
2015-09-26/* NOTREACHED */ after abort() is silly, delete itIngo Schwarze
2015-04-18Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),Ingo Schwarze
man_node() from the mandoc(3) semi-public interface and the internal wrapper functions print_mdoc() and print_man() from the HTML formatters. Minus 60 lines of code, no functional change.
2015-04-18Replace the structs mdoc and man by a unified struct roff_man.Ingo Schwarze
Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
2015-04-02Third step towards parser unification:Ingo Schwarze
Replace struct mdoc_meta and struct man_meta by a unified struct roff_meta. Written of the train from London to Exeter on the way to p2k15.
2015-04-02Second step towards parser unification:Ingo Schwarze
Replace struct mdoc_node and struct man_node by a unified struct roff_node. To be able to use the tok member for both mdoc(7) and man(7) without defining all the macros in roff.h, sacrifice a tiny bit of type safety and make tok an int rather than an enum. Almost mechanical, no functional change. Written on the Eurostar from Bruxelles to London on the way to p2k15.
2015-04-02First step towards parser unification:Ingo Schwarze
Replace enum mdoc_type and enum man_type by a unified enum roff_type. Almost mechanical, no functional change. Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.
2015-03-03If an eqn(7) starts on a new input line, be sure to output whitespaceIngo Schwarze
in front of it. Issue found by tedu@ in glOrtho(3). There are also cases of excessive whitespace before and after equations. This patch neither fixes them nor makes them worse.
2015-02-10trim trailing white space, no code change;Ingo Schwarze
from Svyatoslav Mishyn <juef at openmailboxd dot org>, Crux Linux
2015-01-30Have pity on the poor stack.Ingo Schwarze
Replace tail recursion by iteration when walking the syntax trees. No functional change.
2015-01-24Strangely, ignoring the roff(7) .na request was implemented in the man(7)Ingo Schwarze
parser. Simplify the code by moving it into the roff(7) parser, also making it work for mdoc(7).
2014-12-23some scaling unit fixes:Ingo Schwarze
- .sp with an invalid argument is .sp 1v, not .sp 0v - in man(1), trailing garbage doesn't make scaling units invalid
2014-12-04fix handling of roff requests having a default scale other than "n",Ingo Schwarze
in particular .sp which uses "v", when the scale is not specified; cures groff-mandoc differences in about a dozen Xenocara manuals
2014-12-02Fix the implementation and documentation of \c (continue text input line).Ingo Schwarze
In particular, make it work in no-fill mode, too. Reminded by Carsten dot Kunze at arcor dot de (Heirloom roff).
2014-12-01header cleanup:Ingo Schwarze
* add missing forward declarations * remove needless header inclusions * some style unification
2014-11-28Add some missing OpenBSD RCS markersIngo Schwarze
and a few missing <sys/types.h> inclusions; no code change.
2014-10-07Switch HTML output to polyglot HTML5; have only one single -Thml mode.Ingo Schwarze
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.
2014-08-08Clarity with respect to floating point handling:Ingo Schwarze
Write double constants as double rather than integer literals. Remove useless explicit (double) cast done at one place and nowhere else. No functional change.
2014-04-23Audit strlcpy(3)/strlcat(3) usage.Ingo Schwarze
* 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.
2014-04-20fix unchecked snprintf(3) in page header printing:Ingo Schwarze
the length of the title is unknown, and speed doesn't matter here, so use asprintf/free rather than a static buffer
2014-04-20KNF: case (FOO): -> case FOO, remove /* LINTED */ and /* ARGSUSED */,Ingo Schwarze
remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
2014-03-30Implement the roff(7) .ll (line length) request.Ingo Schwarze
Found by naddy@ in the textproc/enchant(1) port. Of course, do not use this in new manuals.
2014-03-08To find out whether .TP head arguments are same-line or next-line arguments,Ingo Schwarze
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>.
2013-10-17Implement the .UR/.UE block (uniform resource identifier) introduced in theIngo Schwarze
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.
2012-11-17Cleanup naming of local variables to make the code easier on the eye:Ingo Schwarze
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
2012-06-02Minimal implementation of .EX and .EE for GNU compatibility.Ingo Schwarze
Do not use this, it is not portable and only defined in esr's man-ext. For example, sox(1) wants these macros.
2012-02-26Support .OP, one of the extended man macros; from kristaps@.Ingo Schwarze
Do not use this GNU extension, we take it for compatibility only.
2011-12-04When a man document contains nothing at all except one or more invalidIngo Schwarze
macros, do not die on an assertion, but show correct error messages. Assertions of meta data validity suggested by joerg@. ok joerg@
2011-10-09Always print <table> column widths in -T[x]html;Ingo Schwarze
if desired, they can be overridden in the CSS file. Suggested by kristaps@, and i always like to simplify code.
2011-10-09Sync to version 1.12.0; all code by kristaps@:Ingo Schwarze
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.
2011-09-18sync to version 1.11.7 from kristaps@Ingo Schwarze
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
2011-09-18sync to version 1.11.5:Ingo Schwarze
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.
2011-07-08clean up .HP, .IP, .TP, .nf, and \c handling in -T[x]html;Ingo Schwarze
from kristaps@
2011-07-05Sync to bsd.lv (all coded by kristaps@):Ingo Schwarze
- 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
2011-05-29Merge release 1.11.3, almost all code by kristaps@:Ingo Schwarze
* 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.
2011-04-21Merge version 1.10.10:Ingo Schwarze
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
2011-03-20Import the foundation for eqn(7) support.Ingo Schwarze
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.
2011-03-07Clean up date handling,Ingo Schwarze
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@
2011-01-17Refrain from throwing fatal errors forIngo Schwarze
* .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@.
2011-01-16Merge from bsd.lv, original commit message by kristaps@:Ingo Schwarze
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@.
2011-01-16In literal context, do not generate output line breaks between macroIngo Schwarze
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.
2011-01-16If the first character of a free-form text input line is whitespace,Ingo Schwarze
then it will start a new output line; from kristaps@.
2011-01-09Remove an unused variable, and use int for array indices (not size_t);Ingo Schwarze
found by lint(1), fixed by kristaps@, no functional change.
2011-01-04Merge kristaps@' cleaner tbl integration, removing mine;Ingo Schwarze
there are still a few bugs, but fixing these will be easier in tree.
2011-01-04Multiple man(7) .IP and .TP fixes started during p2k10:Ingo Schwarze
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?"
2010-12-25Yet another batch of -Thtml polishing from kristaps@:Ingo Schwarze
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.
2010-12-22Use yet more standard HTML tags,Ingo Schwarze
this time some more <P> and <TABLE> instead of <DIV>. From kristaps@.
2010-12-19Significant improvements to -Thtml by kristaps@:Ingo Schwarze
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.
2010-12-19Remove `i' and `r' macro handlers. These macros, originally part of theIngo Schwarze
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@.
2010-12-07Back out my .ft implementation for -Thtml.Ingo Schwarze
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.