summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_html.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* Unified error and warning message system for all of mandoc,schwarze2010-05-231-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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@.
* Small fix for `D1' and `Bd' in -Thtml; from kristaps@.schwarze2010-05-231-3/+4
|
* allow non-numeric manual sections in -mdoc;schwarze2010-05-151-3/+3
| | | | | while here, allow LIBRARY in section 9; by kristaps@
* Integrate kristaps@' end-of-sentence (EOS) frameworkschwarze2010-05-141-2/+1
| | | | | | | | | | | | | which is simpler and more powerful than mine, and remove mine. * man(7) now has EOS handling, too * put EOS detection into its own function in libmandoc * use node and termp flags to communicate the EOS condition * no more EOS pseudo-macro * no more non-printable EOS marker character on the formatter level This slightly breaks EOS detection after trailing punctuation in mdoc(7) macros, but that will be restored soon.
* Merge 1.9.25, keeping local patches;schwarze2010-05-141-7/+8
| | | | | | | | | | | | | | this does not merge kristaps' end-of-sentences handling yet, i will check that separately. This one includes: * handle \*(Ba as a delimiter * introduce ARGS_PEND for .Bl -column .It end-of-line special casing * section ordering: expect EXIT STATUS at the right place * line break fixes in SYNOPSIS * allow literal contexts to have arbitrary line lengths * the input file column number can not be used to identify the beginning of a line because white space is allowed after the initial '.' * proper leading spaces in -man -Tascii mode * do not let Lb break lines in -mdoc -Thtml LIBRARY
* sync to bsd.lv mdoc_term.c 1.117, mdoc_html.c 1.61:schwarze2010-05-081-11/+3
| | | | | fixed %T: it now correctly underlines, instead of quoting; noted by jmc@, fixed by kristaps@
* Merge the good parts of 1.9.23,schwarze2010-04-071-39/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | avoid the bad parts of 1.9.23, and keep local patches. Input in general: * Basic handling of roff-style font escapes \f, \F. * Quoted punctuation does not count as punctuation. mdoc(7) parser: * Make .Pf callable; noted by Claus Assmann. * Let .Bd and .Bl ignore unknown arguments; noted by deraadt@. * Do not warn when .Er is used outside certain sections. * Replace mdoc_node_free[list] by mdoc_node_delete. * Replace #define by enum for rew*() return values. man(7) parser: * When .TH is missing, use default section and date. Output in general: * Curly braces do not count as punctuation. * No space after .Fl w/o args when a macro follows on the same line. HTML output: * Unify PAIR_*_INIT macros, introduce new PAIR_ID_INIT(). * Print whitespace after, not before .Vt .Fn .Ft .Fo. Checked that all manuals in base still build.
* Better write 'href="mailto:' instead of 'style="mailto:'.schwarze2010-04-041-2/+2
| | | | | | Diff from Tim van der Molen <tbvdm at xs4all dot nl>, thanks! ok kristaps@
* no need to die from .Xr without arguments, we can just ignore itschwarze2010-04-031-1/+4
| | | | ok deraadt@
* Proper inter-sentence spacing for mdoc(7).schwarze2010-03-021-1/+2
| | | | | | | | | When a text line or a non-block macro line in the source code ends in any of ".!?", consider that an end of sentence (EOS). This makes Jason's rule "new sentence, new line" even more important. Let the parser detect the EOS and insert a token into the AST. Let the -Tascii frontend render the EOS token as a double space before the next word.
* sync to release 1.9.15:schwarze2010-02-181-4/+7
| | | | | | | | | * corrected .Vt handling (spotted by Joerg Sonnenberger) * corrected .Xr argument handling (based on my patch) * removed \\ escape sequence (because it is for low-level roff only) * warn about trailing whitespace (suggested by jmc@) * -Txhtml support * and some general cleanup and doc improvements
* complete the sync to 1.9.15-pre2: mostly minor fixesschwarze2010-01-021-7/+19
| | | | | | | | * bugfix: do not restore TERMP flags when leaving lists, just reset them * and a few HTML fixes * clarity: return width from a2width, not width+2, and adapt to it * manual: document .Bl and .Fl * portability: no need to escape '%' in macro names
* sync to 1.9.14: rewrite escape sequence handling:schwarze2009-12-241-10/+7
| | | | | | | | | - new function a2roffdeco - font modes (\f) only affect the current stack point - implement scaling (\s) - implement space suppression (\c) - implement non-breaking space (\~) in -Tascii - many manual improvements
* sync to 1.9.13: minor fixes:schwarze2009-12-231-4/+7
| | | | | | | | | | | | | | | | | | correctness/functionality: - bugfix: properly ignore lines with only a dot in -man - bugfix: .Bl -ohang doesn't allow -width, warn about this - improve date string handling by new function mandoc_a2time - some HTML improvements - significant documentation additions in man.7 and mdoc.7 portability: - replace __dead by __attribute__((noreturn)) - bugfix: correct .Dx rendering - some more library names for NetBSD simplicity: - replace hand-rolled putchar(3)-loops by fwrite(3) - replace single-character printf(3) by putchar(3)
* sync to 1.9.12, mostly portability and refactoring:schwarze2009-12-221-24/+33
| | | | | | | | | | | | | | | | | | | correctness/functionality: - bugfix: do not die when overstep hits the right margin - new option: -fign-escape - and various HTML features portability: - replace bzero(3) by memset(3), which is ANSI C - replace err(3)/warn(3) by perror(3)/exit(3), which is ANSI C - iuse argv[0] instead of __progname - add time.h to various files for FreeBSD compilation simplicity: - do not allocate header/footer data dynamically in *_term.c - provide and use malloc frontends that error out on failure for full changelogs, see http://bsd.lv/cgi-bin/cvsweb.cgi/
* sync to 1.9.11: adapt printing of dates to groff conventions,schwarze2009-10-271-29/+38
| | | | | NetBSD portability fixes and some minor bugfixes and feature enhancements; also checked that my hyphenation code still works on top of this
* sync to 1.9.9, featuring:schwarze2009-10-211-0/+2217
* -Thtml output mode * roff scaling units * and some minor fixes for full changelogs, see http://bsd.lv/cgi-bin/cvsweb.cgi/