summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_html.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Cleanup naming of local variables to make the code easier on the eye: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 curlymatthew2012-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. tweak and ok schwarze
* Correct .Eo spacing: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,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;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.
* Sync to version 1.12.0; all code by kristaps@:schwarze2011-10-091-16/+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-19/+30
| | | | | | | | 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.
* Sync to bsd.lv (all coded by kristaps@):schwarze2011-07-051-3/+6
| | | | | | | | | | - 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
* Have -T[x]html print out the link target for `Lk'schwarze2011-06-181-4/+5
| | | | | if no link title is provided. Based on a patch by Tim van der Molen, tweaked by kristaps@.
* Merge release 1.11.3, almost all code by kristaps@:schwarze2011-05-291-35/+33
| | | | | | | | | * 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.11.1:schwarze2011-04-241-79/+175
| | | | | | | | | | | | | | Again lots of cleanup and maintenance work by kristaps@. - simplify error reporting: less function pointers, more mandoc_[v]msg - main: split document parsing out of main.c into read.c - roff, mdoc, man: improved recognition of control characters - roff: better handling of if/else stack overflows - roff: add some predefined strings for backward compatibility - mdoc, man: empty sections are not errors - mdoc: move delimiter handling to libmdoc - some header restructuring and some minor features and fixes This merge causes two minor regressions that i will fix in separate commits right afterwards.
* 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-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@
* Do not break the line between the arguments of .Bsx .Dx .Fx .Nx .Ox .Ux.schwarze2011-02-061-2/+10
| | | | Original patch from kristaps@, but i fixed a regression regarding .Bk.
* If .Ns is specified on its own line, ignore it, like groff does;schwarze2011-02-061-2/+3
| | | | from kristaps@.
* When in a <PRE>, don't print out the <BR> before lines that haveschwarze2011-01-311-3/+17
| | | | leading whitespace; from kristaps@.
* Make .Bx accept not more than two arguments.schwarze2011-01-301-7/+15
| | | | | | | Convert the first character of the second argument to uppercase. Append the second argument with a hyphen. Improves chpass(1), column(1), fstat(1), ... from kristaps@
* Merge from bsd.lv, original commit message by kristaps@:schwarze2011-01-161-5/+21
| | | | | | | | | | 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@.
* If the first character of a free-form text input line is whitespace,schwarze2011-01-161-1/+3
| | | | | 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-4/+5
| | | | found by lint(1), fixed by kristaps@, no functional change.
* Merge kristaps@' cleaner tbl integration, removing mine;schwarze2011-01-041-3/+6
| | | | there are still a few bugs, but fixing these will be easier in tree.
* Reorg by Kristaps: In libmdoc, replace the union of pointers to structsschwarze2010-12-291-27/+25
| | | | | | | of macro-specific data by a pointer to a union of structs, which makes the code simpler and more robust at the expense of a small memory overhead. Merging was somewhat difficult because we mustn't break tbl(1) support which the bsd.lv version does not yet have.
* Yet another batch of -Thtml polishing from kristaps@:schwarze2010-12-251-11/+12
| | | | | | | | 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.
* More small -Thtml improvements by kristaps@,schwarze2010-12-221-41/+81
| | | | | | | | in particular, use <B>, <I> and <U> where appropriate. Provide relative widths for header and footer lines. Manuals: More concise short descriptions of output modes. Correct a few places still talking about CSS2 to say CSS1. Code examples should use .Dl, not .D1.
* Handle .Bk in -Thmtl the same way as in -Tascii.schwarze2010-12-191-2/+3
| | | | From kristaps@.
* Significant improvements to -Thtml by kristaps@:schwarze2010-12-191-491/+318
| | | | | | 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.
* Do not follow .D1 and .Dl inside .Bd with a blank line.schwarze2010-12-061-1/+5
| | | | | Kristaps@ came up with this improvement when he merged my patch introducing support for nested displays.
* Merge mdoc_action.c into mdoc_validate.c, because having two places to doschwarze2010-12-011-2/+2
| | | | | | basically the same things just causes code duplication and confusion. Work by kristaps@, including a few bugfixes he found during the merge, and reapplying OpenBSD changes on top.
* let .Bsx print just "BSD/OS" like in modern groffschwarze2010-10-231-2/+2
| | | | from Ulrich Spoerlein <uqs at spoerlein dot net>
* .Sm no longer produces a linebreak when used in .Bdschwarze2010-10-231-2/+14
| | | | | also avoid an extra space after the opening bracket in .Op in -Thtml from kristaps@
* Support tbl(1) code embedded into mdoc(7) input files.schwarze2010-10-161-1/+3
| | | | | | Very similar to what i have done in man(7) yesterday. Allows to build cpu(4) on HPPA, wi(4), and phantasia(6). Now we are able to build all tbl code in base.
* * need a space before .No even if it starts with a closing delimiterschwarze2010-10-011-6/+5
| | | | | | | * slightly simplify .Pf *_IGNDELIM code, and share part of it with .No * do not let opening delimiters fall out of the front of .Ns (from kristaps@) This fixes a few spacing issues in csh(1) and ksh(1). OK kristaps@
* Merge the last bits of 1.10.6 (released today), most were already in:schwarze2010-09-271-1/+21
| | | | | | | | | | | | * ignore double-.Pp * ignore .Pp before .Bd and .Bl (unless -compact in specified) * avoid double blank line upon .Pp, .br and friends in literal context * cast enums to int when passing them to exit(3) to please lint(1) While merging, fix a regression introduced by kristaps@: Outside literal mode, double blank lines must both be printed. To achieve this again after kristaps@ improvements in 1.10.6, treat such blank lines as .sp (instead of .Pp as in 1.10.5) and drop .Pp before .sp just like dropping .Pp before .Pp.
* consolidate all enclosure opening and closing functionsschwarze2010-09-261-215/+144
| | | | | | to help code comprehension and reduce code size also remove redundant TERMP_NOSPACE here and there from kristaps@
* no punctuation after .%* outside .Rsschwarze2010-09-261-8/+7
| | | | | in .Rs, mark full stops after .%* as end of a sentence from kristaps@
* Format multiple authors (.%A) in the same way as groff:schwarze2010-09-201-1/+10
| | | | | | Two authors with "and", but without a comma. Three or more with commata, and an "and" before the last one. From kristaps@.
* Implement a simple, consistent user interface for error handling.schwarze2010-08-201-2/+2
| | | | | | | | | | | | | | | | | We now have sufficient practical experience to know what we want, so this is intended to be final: - provide -Wlevel (warning, error or fatal) to select what you care about - provide -Wstop to stop after parsing a file with warnings you care about - provide consistent exit status codes for those warnings you care about - fully document what warnings, errors and fatal errors mean - remove all other cruft from the user interface, less is more: - remove all -f knobs along with the whole -f option - remove the old -Werror because calling warnings "fatal" is silly - always finish parsing each file, unless fatal errors prevent that This commit also includes a couple of related simplifications behind the scenes regarding error handling. Feedback and OK kristaps@; Joerg Sonnenberger (NetBSD) and Sascha Wildner (DragonFly BSD) agree with the general direction.
* In -Thtml output, preserve blank lines at the end of .Bd -literal.schwarze2010-08-071-5/+5
| | | | | Patch from kristaps@, analoguous to mdoc_term.c rev. 1.100. With permission from deraadt@ to still fix bugs in mandoc.
* Merge bsd.lv version 1.10.5: last larger batch of bug fixes before release.schwarze2010-07-311-8/+5
| | | | | | | | | | | | | NOT including Kristaps' .Bd -literal changes which cause regressions. Features: * -Tpdf now fully working Bugfixes: * proper handling of quoted strings by .ds in roff(7) * allow empty .Dd * make .Sm start no-spacing after the first output word * underline .Ad * minor fixes in -Thtml and some optimisations in terminal output.
* Sync to bsd.lv; in particular, pull in lots of bug fixes.schwarze2010-07-251-3/+26
| | | | | | | | | | | | | | | | | | | | | 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-69/+147
| | | | | | | | | | 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.
* Support for badly nested blocks, written around the time ofschwarze2010-06-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | the Rostock mandoc hackathon and tested and polished since, supporting constructs like: .Ao Bo Ac Bc (exp breaking exp) .Aq Bo eol Bc (imp breaking exp) .Ao Bq Ac eol (exp breaking imp) .Ao Bo So Bc Ac Sc (double break, inner before outer) .Ao Bo So Ac Bc Sc (double break, outer before inner) .Ao Bo Ac So Bc Sc (broken breaker) .Ao Bo So Bc Do Ac Sc Dc (broken double breaker) There are still two known issues which are tricky: 1) Breaking two identical explicit blocks (Ao Bo Bo Ac or Aq Bo Bo eol) fails outright, triggering a bogus syntax error. 2) Breaking a block by two identical explicit blocks (Ao Ao Bo Ac Ac Bc or Ao Ao Bq Ac Ac eol) still has a minor rendering error left: "<ao1 <ao2 [bo ac2> ac1> bc]>" should not have the final ">". We can fix these later in the tree, let's not grow this diff too large. "get it in" kristaps@
* Full .nr nS support, unbreaking the kernel manuals.schwarze2010-06-271-6/+7
| | | | | | | | | 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 release 1.10.2schwarze2010-06-261-49/+21
| | | | | | | | | | | | * bug fixes: - interaction of ASCII_HYPH with special chars (found by Ulrich Spoerlein) - handling of roff conditionals (found by Ulrich Spoerlein) - .Bd -offset will no more default to 6n * maintenance: - more caching of .Bd and .Bl arguments for efficiency - deconstify man(7) validation routines - add FreeBSD library names (provided by Ulrich Spoerlein) * start PostScript font-switching
* Merge more bits that will be going into 1.10.1:schwarze2010-06-081-61/+67
| | | | | | | | | | | | Clean up vertical spacing in the SYNOPSIS, making the code much more systematic; this doesn't solve all SYNOPSIS problems yet, in particular not those related to keeps, indentation and the low-level .nr roff instruction, but it's a nice step forward and i couldn't find relevant regressions. (from kristaps) Besides, * make the output width configurable (default: -Owidth=80) (kristaps) * use mmap with MAP_SHARED (from Joerg Sonnenberger)
* Merge bsd.lv version 1.10.1 (to be released soon).schwarze2010-06-061-69/+68
| | | | | | | | | | | | | | | | | | | | The main step forward is that this now has *much* better .Bl -column support, now supporting many manuals that previously errored out without producing any output. Other fixes include: * do not die from multiple list types, use the first and warn * in .Bl without a type, default to -item * various tweaks to .Dt * fix .In, .Fd, .Ft, .Fn and .Fo formatting * some documentation fixes and additions * and fix a couple of bugs reported by Ulrich Spoerlein: * better support for roff block-end "\}" without a preceding dot * .In must not break the line outside SYNOPSIS * spelling in some error messages While merging, fix one regression in .In spacing that needs to go to bsd.lv, too.
* Fix segfault in mixing old enum types for -Thtml -mdoc; from kristaps@.schwarze2010-05-241-3/+3
|
* Increase performance by saving the list type in struct mdoc_node.schwarze2010-05-241-80/+35
| | | | | | | | | | | This will eventually be used so that mdoc_macro can know whether to dump list line arguments into the body (`Bl -column' overflowing). Remove a2list() and arg_listtype() because of this. From kristaps@. While merging, fix a regression in mdoc_term.c, print_bvspace(): The bsd.lv version of this broke vertical spacing in .Bl -column.