summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man_term.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* As .RS may nest and may contain embedded paragraphs,schwarze2011-07-071-35/+29
| | | | | | | keep a stack of left margins; this fixes e.g. lynx(1). While here, clean up some code in .TP HEAD; it can only have text children, anyway. From kristaps@.
* Sync to bsd.lv (all coded by kristaps@):schwarze2011-07-051-30/+46
| | | | | | | | | | - 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
* Merge release 1.11.3, almost all code by kristaps@:schwarze2011-05-291-9/+2
| | | | | | | | | * 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-2/+1
| | | | | | | | | | | | | | 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.
* 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-9/+3
| | | | | | | | | | | | 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@
* Avoid double blank line before a table preceded by .PP.schwarze2011-01-251-1/+4
| | | | ok kristaps@
* Fix another regression caused by the reorg of print_man_node() in rev. 1.61:schwarze2011-01-231-1/+4
| | | | End-of-sentence spacing got lost for man(7) after plain text lines.
* Refrain from throwing fatal errors forschwarze2011-01-171-3/+3
| | | | | | | * .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@.
* In literal context, do not generate output line breaks between macroschwarze2011-01-161-29/+35
| | | | | | 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.
* If the first character of a free-form text input line is whitespace,schwarze2011-01-161-3/+7
| | | | | then it will start a new output line; from kristaps@.
* When (cumulative) indentation requested by .in exceeds the rightschwarze2011-01-111-1/+6
| | | | | margin, do not run into an assert(3)ion. Problem reported by brad@ in gm(1), fix by kristaps@.
* Merge kristaps@' cleaner tbl integration, removing mine;schwarze2011-01-041-22/+14
| | | | there are still a few bugs, but fixing these will be easier in tree.
* Multiple man(7) .IP and .TP fixes started during p2k10:schwarze2011-01-041-17/+25
| | | | | | | | | | | | | | | | | | | | | 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?"
* Remove `i' and `r' macro handlers. These macros, originally part of theschwarze2010-12-191-3/+1
| | | | | | | 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@.
* Complete the merge of bsd.lv version 1.10.7:schwarze2010-12-071-5/+1
| | | | No more functional changes, just sync ordering, comments and white space.
* Never print .P, .PP, and .LP header content.schwarze2010-12-061-2/+2
| | | | From kristaps@.
* Now that we have proper .de support in the roff(7) library,schwarze2010-11-291-12/+4
| | | | | it is time to remove the .Sp, .Vb, and .Ve kludge that was added to the man(7) library to build Perl manuals.
* Implement the roff .ft (change font) request for man(7).schwarze2010-11-291-1/+46
| | | | | | | | Of course, we don't want to encourage low-level physical markup, but pod2man(1) writes such requests, so Perl manuals contain them, and some Xenocara and lots and lots of ports manuals use them as well. In base and Xenocara, this will reduce mandoc -Tlint ERROR noise; in ports, it will improve rendering of many manuals.
* Font alternating blocks like .RB must not break the line between childrenschwarze2010-10-281-71/+47
| | | | | | | | in literal mode. Fixing a bug found by naddy@ in the gettext(3) SYNOPSIS. This required a bit of refactoring: * consolidate pre_RB(), pre_RI(), and pre_BI() into pre_alternate() * save the MANT_LITERAL mode before descending into children * restore MANT_LITERAL mode before printing the last child
* Do not abort() on tbl errors, reduce the risk that tbl stuff kills a build,schwarze2010-10-161-5/+3
| | | | and provide more useful tbl error messages in a non-intrusive way.
* Move tbl width calculation from plain strlen to mandoc terminal widthschwarze2010-10-151-2/+2
| | | | | calculation routines. This gives us mostly sane table column widths. "move forward" deraadt@
* Move tbl output from plain stdio to mandoc terminal output routines.schwarze2010-10-151-2/+2
| | | | | | This fixes (1) all escape sequences and (2) some aspects of indentation. Table column widths are still way off, though. "move forward" deraadt@
* Minimal glue to integrate tbl into the mandoc man(7) parser and formatter.schwarze2010-10-151-1/+22
| | | | | | The output dosn't look nice yet, escape handling is still missing, but will follow soon. "move forward aggressively :-)" deraadt@
* When calculating string lengths, resolve escape sequences and useschwarze2010-09-211-1/+5
| | | | | | | their actual lengths. Will improve vertical alignment in some uncommon situations, for example when escape sequences occur in list or column width strings or in .Nm block arguments in the SYNOPSIS. From kristaps@.
* Sync to bsd.lv; in particular, pull in lots of bug fixes.schwarze2010-07-251-30/+69
| | | | | | | | | | | | | | | | | | | | | 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-3/+2
| | | | | | | | | | 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.
* Full .nr nS support, unbreaking the kernel manuals.schwarze2010-06-271-2/+3
| | | | | | | | | 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.
* As a first step towards variable-width font support,schwarze2010-06-261-41/+39
| | | | | move all width calculations in term_*.c, *_width(). From kristaps.
* minimal initial -Tps support, from kristaps@ GSOCschwarze2010-06-101-9/+14
| | | | | so far, monospace without font decoration, but it already has page headers and footers
* Merge bsd.lv release 1.10.0,schwarze2010-06-061-2/+5
| | | | | | | | | | | | | | | | which is mostly the post-hackathon release, bringing in the OpenBSD changes to bsd.lv, but which also has a few additional minor fixes: * .Lb is an in-line macro, not in_line_eoln * .Bt, .Ud now warn when discarding arguments * allow bad -man dates to flow verbatim into the front-ends - so far all reported by Ulrich Spoerlein * .Ar, .Fl and .Li starting with closing punctuation emit an empty element * empty .Li macros print nothing, but may cause spacing * proper EOS handling for .Bt, .Ex, .Rv, and .Ud. * cleanup: collapse posts_xr into posts_wtext (which is the same) * efficiency: very simple table lookup for roff.c
* Increase the -man -Tascii text width from 65 to 78 charactersschwarze2010-06-051-8/+3
| | | | | | | | | | | | | | | | | | | | | in both our old in-tree groff and in mandoc, because 1) It looks and reads better. 2) It agrees with both bsd.lv mandoc and with modern groff. The tmac.an part was done by millert@, with a minor fix by me. While touching our old groff, switch off hyphenation, suggested a long time ago by millert@. It helps searching and comparisons. While touching mandoc terminal_man(), explicitely initialize the tabwidth - not strictly required, but easier to understand and more robust, also suggested by millert@. General mumbling of agreement by many, including millert@ deraadt@ jmc@ sobrado@ ... Remaining problem: Setting the title length (.lt) has no effect for me, but we can fix this in tree in case anybody figures it out.
* sync to bsd.lv:schwarze2010-05-241-1/+3
| | | | | modern groff produces three blank lines before the man(7) footer; from Joerg Sonnenberger.
* Unified error and warning message system for all of mandoc,schwarze2010-05-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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@.
* implement .AT and .UC; from Joerg Sonnenbergerschwarze2010-05-231-1/+2
|
* Support nested roff instructions:schwarze2010-05-201-4/+1
| | | | | | | | | | | | | | | | | | | * allow roff_parseln() to be re-run * allow roff_parseln() to manipulate the line buffer offset * support the offset in the man and mdoc libraries * adapt .if, .ie, .el, .ig, .am* and .de* support * interpret some instructions even in conditional-negative context Coded by kristaps during the last day of the mandoc hackathon. To avoid regressions in the OpenBSD tree, commit this together with some small local additions: * detect roff block end "\}" even on macro lines * actually implement the ".if n" conditional * ignore .ds, .rm and .tr in libroff Also back my old .if/.ie/.el-handling out of libman, reverting: man.h 1.15 man.c 1.25 man_macro.c 1.15 man_validate.c 1.19 man_action.c 1.15 man_term.c 1.28 man_html.c 1.9.
* In theory, Kristaps never intended to write a roff parser,schwarze2010-05-161-7/+1
| | | | | | | | | | | | | | | | | | but in practice, most real legacy man(7)uals are using so much low level roff that we can't really get away without at least partially handling some roff instructions. As doing this in man(7) only has become messy and as even some mdoc(7) pages need it, start a minimal partial roff preprocessor. As a first step, move handling of .am[i], .de[i] and .ig there. Do not use the roff preprocessor for new manuals! Now that we have three main parser libraries - roff, man and mdoc - each one having its own error handling is becoming messy, too. Thus, start unifying message handling in one central place, introducing a new generic function mmsg(). coded by kristaps@
* For .IP, a single space after the head is sufficient;schwarze2010-05-151-3/+1
| | | | by Joerg Sonnenberger.
* More systematic output width handling by Joerg Sonnenberger:schwarze2010-05-151-3/+13
| | | | | | | * save and restore the output width when switching to MANT_LITERAL * add an argument to ascii_alloc to specify the output width * set the default output width to 80 minus 2 characters * OpenBSD local: set the output width to 65 characters for -man
* removed restriction on integer manual sections in -man;schwarze2010-05-151-2/+2
| | | | by kristaps@
* Integrate kristaps@' end-of-sentence (EOS) frameworkschwarze2010-05-141-1/+4
| | | | | | | | | | | | | 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-6/+22
| | | | | | | | | | | | | | 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
* Implement roff conditional instructions .if .ie .el, in man(7) only for now;schwarze2010-04-251-1/+4
| | | | fixing OpenBSD::PackageName(3p) and friends for espie@.
* merge 1.9.17, keeping local patchesschwarze2010-03-261-7/+19
| | | | | | | * much improved pod2man support and low-level roff robustness * have -Tlint imply -Wall and -fstrict * use fewer macros and more enum in libman * and various bug fixes
* merge 1.9.16, keeping local patchesschwarze2010-03-251-38/+42
| | | | | | | This is mostly cleanup by kristaps@ after my rather hackish patch to tolerate the non-text macros .na, .sp, .br in next-line scope; plus some nesting issues fixed by him, all in man(7). This survived a full cd /usr/src; make man.
* In man(7), do not crash on very long title lines,schwarze2010-03-021-9/+16
| | | | | | and do not emulate groff's habit of printing garbage either, but just print the wanted information even though the format must be sacrificed because it won't fit.
* For -man -Tascii, limit the width of normal text to 65 characters,schwarze2010-03-021-1/+4
| | | | | | and effectively unlimit the width of literal displays. Following this traditional behaviour allows for automatic output comparisons.
* Accept the non-standard macros .Sp (similar to .sp)schwarze2010-03-021-1/+4
| | | | | | | and .Vb/.Ve (similar to .nf/.fi) in man(7) mode. These are not intended to be used manually, but they allow us to properly render man(7) code autogenerated by pod2man(1), making Perl and OpenSSL happy in our tree.
* The groff_man(7) manual says "the first line of text following" .TP isschwarze2010-02-261-3/+6
| | | | | | | | | used as a label, not "the first line following", so allow (some kinds of) intervening macros - some people actually put macros in between. On the other hand, when there is no text line before the next block macro, that is, when the .TP block ends without any text line, then something *is* broken, so still error out in that case.
* sync to 1.9.14: rewrite escape sequence handling:schwarze2009-12-241-117/+43
| | | | | | | | | - 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