summaryrefslogtreecommitdiffstats
path: root/mdoc_html.c
Commit message (Collapse)AuthorAgeFilesLines
* Audit strlcpy(3)/strlcat(3) usage.Ingo Schwarze2014-04-231-16/+21
| | | | | | | | | | | | | * 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:Ingo Schwarze2014-04-201-2/+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 */,Ingo Schwarze2014-04-201-304/+184
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* Implement the roff(7) .ll (line length) request.Ingo Schwarze2014-03-301-1/+11
| | | | | Found by naddy@ in the textproc/enchant(1) port. Of course, do not use this in new manuals.
* It turns out SYNOPSIS mode does not imply .Bk in general,Ingo Schwarze2013-12-241-1/+1
| | | | | | but only within .Nm blocks. Simplify the code accordingly. Triggered by research done by Franco Fichtner.
* When deciding whether two consecutive macros are on the same input line,Ingo Schwarze2013-12-241-7/+3
| | | | | | | | we have to compare the line where the first one *ends* (not where it begins) to the line where the second one starts. This fixes the bug that .Bk allowed output line breaks right after block macros spanning more than one input line, even when the next macro follows on the same line.
* Cleanup naming of local variables to make the code easier on the eye:Ingo Schwarze2012-11-171-28/+29
| | | | | | | | 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
* .Sq should use curly right quotes in HTML output to match its curlyIngo Schwarze2012-08-121-3/+3
| | | | | | | | | left quotes. Also, properly reinitialize the styles attribute string buffer for each column in a table so that the attributes don't accumulate. Patch from Matthew@ Dempsky, tweaked by me; OpenBSD rev. 1.66.
* Correct .Eo spacing:Ingo Schwarze2011-11-031-1/+5
| | | | | no space between the delimiters and the enclosed text. The mdoc_html.c part was added by kristaps; ok kristaps@.
* Remove a bunch of useless assignments,Ingo Schwarze2011-10-161-1/+1
| | | | | | | and assert that print_bvspace cannot be called on NULL pointers. No change in behaviour, none of these were bugs, but the code becomes easier to understand. Based on a clang report posted by joerg@; ok kristaps@.
* Always print <table> column widths in -T[x]html;Ingo Schwarze2011-10-091-37/+17
| | | | | if desired, they can be overridden in the CSS file. Suggested by kristaps@, and i always like to simplify code.
* Add the -Ofragment option to -T[]x]html. This accomodates for embeddingKristaps Dzonsons2011-10-051-15/+16
| | | | | manual output in existing HTML or XHTML documents, e.g., when invoking mandoc from an SSI or CGI.
* Make sure that `Ql' literalises its arguments in -T[x]html. Found whenKristaps Dzonsons2011-08-261-1/+5
| | | | doing manpages.bsd.lv stuff.
* Align `-offset indent' and `D1' by forcing BLOCKQUOTE to have a 5exKristaps Dzonsons2011-08-181-5/+2
| | | | | | | | | margin. This is dubious: the HTML4 spec specifically says that BLOCKQUOTE shouldn't be abused for indentation, which is exactly what we do. However, `D1' needs indentation and it's the only way to force text browsers to do so. Alternatives? Also remove the unused HALFINDENT defines while here.
* Have `Li' be correctly monospaced in -T[x]html. Also make sure thatKristaps Dzonsons2011-08-181-1/+1
| | | | | `Li' prints as a CODE tag and the style-sheet has the `lit' class apply to multiple tag types.
* Allow `Sx' and `Ss' to have child nodes. Fixes manuals in NetBSD.Kristaps Dzonsons2011-08-101-11/+21
| | | | | | Originally pointed out by joerg@ then again by Thomas Klausner by way of Nicolas Joy. Note: don't use these constructions as you can't link to the sections with `Sx'.
* Flip on equation printing for -T[x]html.Kristaps Dzonsons2011-07-231-4/+1
|
* Flip eqn into using parsed nodes. I've temporarily disabled printingKristaps Dzonsons2011-07-211-2/+2
| | | | | | | these in the front-ends except for -Ttree, which will display the parsed tree. While here, fix that quoted strings aren't scanned for replacement parts.
* The bufcat() function in -T[x]html was eating one byte off the end of itsKristaps Dzonsons2011-07-041-0/+2
| | | | | | concatenated string. This for some reason hasn't been found before now... ? Anyway, fixed, and make the IDs created again be correctly prefixed by a letter as per the HTML spec.
* First fix how `sp 1' doesn't imply `1v' (it now does) and that 1Kristaps Dzonsons2011-06-291-2/+3
| | | | | | followed by non-digits, e.g. `1g', really means `1'. Next, fix some spacing issues where `sp' was invoked in -man after sections or subsections. Make sure this behaviour is mirrored in -Thtml.
* Have -T[x]html print out the link target for `Lk' if no link title isKristaps Dzonsons2011-06-161-3/+4
| | | | provided. From a patch by Tim van der Molen.
* Clean-up fallout: differentiate ID's and HREF's (where to put the `#').Kristaps Dzonsons2011-05-171-0/+1
| | | | Make buffmt functions internally bufinit(), too.
* Cleanups in -T[x]html: make html_idcat() use the buffer and be calledKristaps Dzonsons2011-05-171-28/+25
| | | | | | bufcat_id(), then collapse it into a little function without so much crap. Next, make bufinit() only be called when we really need to do so, and not simply before pre/post calls.
* Clean-ups in -T[x]html: inline print_num(), as it was just a singleKristaps Dzonsons2011-05-171-1/+1
| | | | | | | | | | conditional; same for print_xmltype() and print_doctype(), same reason; make bufncat() be static, as it was only being called from html.c; have bufcat() simply call through to strlcat(). Finally, assert() whenever we truncate. Also rename buffmt() -> bufcat_fmt() to differentiate from buffmt_man et al., which do not concatenate.
* Give -Thtml and -Txhtml the gift of recognising escapes when calculatingKristaps Dzonsons2011-05-141-5/+5
| | | | | widths (e.g., `Bl -tag -width "\s[blahblah]bar"). This has long since been done for -Tascii but escaped noticed with -T[x]html.
* Revert last change: this screwed up displaying in other pages (didn'tKristaps Dzonsons2011-04-231-1/+1
| | | | test it enough).
* Make the `Nm' -Thtml attribute be min-width instead of width. This is aKristaps Dzonsons2011-04-231-1/+1
| | | | | | | | quick fix for, say, rc.d(8) in OpenBSD, which has nested macros on the `Nm' SYNOPSIS line that were skipped over by the length calculator. This should [maybe?] be a recursive length check, but still it'd need to be a min-width to accomodate for (say) `Qq' and the like printing excess characters post-length-calculation.
* Suppress a space following the "(" for -T[x]html `Fn'. Found by randomKristaps Dzonsons2011-04-041-0/+1
| | | | perusal of online manuals.
* Have `Fd' in -T[x]html generate an "include" link if it detects oneKristaps Dzonsons2011-04-041-4/+52
| | | | being used.
* Fix a bug that slip in: PAIR_XXXX macros expanded to run the incrementKristaps Dzonsons2011-04-041-1/+2
| | | | twice.
* Fully fix the `Rv' and `Ex' handlers for -T[x]html and -Tascii. ThisKristaps Dzonsons2011-04-041-14/+19
| | | | includes an unreported bug where `Ex' wasn't properly adding a newline.
* Make `Rv' do the Right Thing regarding commas and "and" when listing itsKristaps Dzonsons2011-04-041-19/+26
| | | | | output. This also makes it easier to read. While here, remove superfluous assignment to local variables for this and `Mt'.
* Fix possible segfaults in `Lk' -T[x]html handler, which made someKristaps Dzonsons2011-04-041-9/+11
| | | | | assumptions about its children. Also remove superfluous reassignment to local variable.
* Clean-up in -T[x]html: remove some unnecessary assignments to localKristaps Dzonsons2011-04-041-22/+20
| | | | variables.
* Clean up handling of `In' for -T[x]html such that it only links to theKristaps Dzonsons2011-04-041-11/+28
| | | | | first argument. groff of course doesn't do links, but it will uglify subsequent arguments in the list (we warn about >1, anyway).
* Move mandoc_isdelim() back into libmdoc.h. This fixes an unreportedKristaps Dzonsons2011-03-221-4/+21
| | | | | | | | | error where (1) -man pages were punctuating delimiters (e.g., `.B a ;') and where (2) standalone punctuation in -mdoc or -man (e.g., ";" on its own line) would also be punctuated. This introduces a small amount of complexity of mdoc_{html,term}.c must manage their own spacing with running print_word() or print_text(). The check for delimiting now happens in mdoc_macro.c's dword().
* Clean up date handling,Ingo Schwarze2011-03-071-4/+1
| | | | | | | | | | | | 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@
* EQN blocks are now printed in all modes. This is simply a printing ofKristaps Dzonsons2011-02-091-1/+7
| | | | the concatenated string (in -T[x]html, it gets a SPAN, too).
* Fix a regression caused by mdoc_term.c 1.214 / mdoc_html.c 1.148:Ingo Schwarze2011-02-061-2/+4
| | | | | Inside .Bk or inside the SYNOPSIS, Unix variant macros cleared the keep flag.
* Add initial libmdoc and libman top-most machinery for accepting TBLKristaps Dzonsons2011-02-061-0/+2
| | | | | directives. For now this will just ignore them (except for -Ttree, which just notes that an EQN's been accepted).
* If `Ns' is specified on its own line, it should be ignored. This isKristaps Dzonsons2011-02-021-1/+2
| | | | | shitty groff behaviour. Do the same, but raise a warning to this effect. This from a TODO noted by schwarze@.
* When in a <PRE>, don't print out the <BR> before lines that have leadingKristaps Dzonsons2011-01-291-2/+16
| | | | whitespace.
* Arguments to `Bsx' and friends are separated by a non-breaking space.Kristaps Dzonsons2011-01-251-1/+7
| | | | This removes a TODO raised by schwarze@.
* Push capitalisation of `Bx' second argument into validator, where it belongs.Kristaps Dzonsons2011-01-251-7/+2
|
* Properly uppercase the first-letter of the `Bx' second argument.Kristaps Dzonsons2011-01-251-3/+8
|
* Have `Bx' accept two arguments, not just one, and join these argumentsKristaps Dzonsons2011-01-251-6/+14
| | | | with "xxBSD-yy"
* Change how -Thtml behaves with tables: use multiple rows, with widthsKristaps Dzonsons2011-01-131-3/+19
| | | | | | | | | 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@.
* If the first character of free-form text is whitespace, then a newlineKristaps Dzonsons2011-01-121-0/+2
| | | | shall precede outputted text (surprise!).
* Quiesce lint with some type handling. Does not change anything.Kristaps Dzonsons2011-01-071-3/+4
|
* Add skeleton for -T[x]html tbl stuff. Also start to put in some bits aboutKristaps Dzonsons2011-01-041-1/+4
| | | | the up-coming version, although we're not quite there yet.