aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_html.c
Commit message (Collapse)AuthorAgeFilesLines
* Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.Ingo Schwarze2014-08-101-3/+1
| | | | | | Include <sys/types.h> where needed, it does not belong in config.h. Remove <stdio.h> from config.h; if it is missing somewhere, it should be added, but i cannot find a *.c file where it is missing.
* Bring the handling of defective prologues even closer to groff,Ingo Schwarze2014-08-061-4/+9
| | | | | | | | | | | | in particular relaxing the distinction between prologue and body and further improving messages. * The last .Dd wins and the last .Os wins, even in the body. * The last .Dt before the first body macro wins. * Missing title in .Dt defaults to UNTITLED. Warn about it. * Missing section in .Dt does not default to 1. But warn about it. * Do not warn multiple times about the same mdoc(7) prologue macro. * Warn about missing .Os. * Incomplete .TH defaults to empty strings. Warn about it.
* Clarity with respect to floating point handling:Ingo Schwarze2014-08-011-3/+3
| | | | | | Write double constants as double rather than integer literals. Remove useless explicit (double) cast done at one place and nowhere else. No functional change.
* Various improvements related to .Ex and .Rv:Ingo Schwarze2014-07-301-25/+31
| | | | | | | | | | * let .Nm fall back to the empty string, not to UNKNOWN * never let .Rv copy an argument from .Nm * avoid spurious \fR after empty .Nm in -Tman * correct handling of .Ex and .Rv in -Tman * correct the wording of the output for .Rv without arguments * use non-breaking spaces in .Ex and .Rv output where required * split MANDOCERR_NONAME into a warning for .Ex and an error for .Nm
* When .Sm is called without an argument, groff toggles the spacing mode,Ingo Schwarze2014-07-021-15/+8
| | | | | so let us do the same for compatibility. Using this feature is of course not recommended except in manual page obfuscation contests.
* Implement the obsolete macros .En .Es .Fr .Ot for backward compatibility,Ingo Schwarze2014-07-021-9/+24
| | | | | since this is hardly more complicated than explicitly ignoring them as we did in the past. Of course, do not use them!
* Audit strlcpy(3)/strlcat(3) usage.Ingo Schwarze2014-04-231-17/+22
| | | | | | | | | | | | | * 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-3/+7
| | | | | 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-305/+185
| | | | | 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-2/+12
| | | | | 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-2/+2
| | | | | | 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-8/+4
| | | | | | | | 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-29/+30
| | | | | | | | 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-4/+4
| | | | | | | | | 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-2/+6
| | | | | 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-2/+2
| | | | | | | 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-38/+18
| | | | | 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-16/+17
| | | | | 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-2/+6
| | | | doing manpages.bsd.lv stuff.
* Align `-offset indent' and `D1' by forcing BLOCKQUOTE to have a 5exKristaps Dzonsons2011-08-181-6/+3
| | | | | | | | | 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-2/+2
| | | | | `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-12/+22
| | | | | | 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-5/+2
|
* Flip eqn into using parsed nodes. I've temporarily disabled printingKristaps Dzonsons2011-07-211-3/+3
| | | | | | | 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-1/+3
| | | | | | 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-3/+4
| | | | | | 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-4/+5
| | | | 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-1/+2
| | | | Make buffmt functions internally bufinit(), too.
* Cleanups in -T[x]html: make html_idcat() use the buffer and be calledKristaps Dzonsons2011-05-171-29/+26
| | | | | | 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-2/+2
| | | | | | | | | | 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-6/+6
| | | | | 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-2/+2
| | | | test it enough).
* Make the `Nm' -Thtml attribute be min-width instead of width. This is aKristaps Dzonsons2011-04-231-2/+2
| | | | | | | | 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-1/+2
| | | | perusal of online manuals.
* Have `Fd' in -T[x]html generate an "include" link if it detects oneKristaps Dzonsons2011-04-041-5/+53
| | | | being used.
* Fix a bug that slip in: PAIR_XXXX macros expanded to run the incrementKristaps Dzonsons2011-04-041-2/+3
| | | | twice.
* Fully fix the `Rv' and `Ex' handlers for -T[x]html and -Tascii. ThisKristaps Dzonsons2011-04-041-15/+20
| | | | 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-20/+27
| | | | | 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-10/+12
| | | | | 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-23/+21
| | | | variables.
* Clean up handling of `In' for -T[x]html such that it only links to theKristaps Dzonsons2011-04-041-12/+29
| | | | | 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-5/+22
| | | | | | | | | 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-5/+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@
* EQN blocks are now printed in all modes. This is simply a printing ofKristaps Dzonsons2011-02-091-2/+8
| | | | 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-3/+5
| | | | | 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-1/+3
| | | | | 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-2/+3
| | | | | 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-3/+17
| | | | whitespace.
* Arguments to `Bsx' and friends are separated by a non-breaking space.Kristaps Dzonsons2011-01-251-2/+8
| | | | This removes a TODO raised by schwarze@.
* Push capitalisation of `Bx' second argument into validator, where it belongs.Kristaps Dzonsons2011-01-251-8/+3
|