CVS log for mandoc/mdoc_man.c

[BACK] Up to [cvsweb.bsd.lv] / mandoc

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.138 / (download) - annotate - [select for diffs], Fri Apr 28 19:11:04 2023 UTC (19 months, 3 weeks ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.137: +2 -2 lines
Diff to previous 1.137 (colored)

spelling fixes from Paul Tagliamonte via tech@ and jmc@

Revision 1.137 / (download) - annotate - [select for diffs], Sun Jul 4 15:38:26 2021 UTC (3 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_6
Changes since 1.136: +23 -11 lines
Diff to previous 1.136 (colored)

The mandoc(1) manual already mentions that -T man output mode
neither supports tbl(7) nor eqn(7) input.
If an input file contains such code anyway, tell the user
rather than failing an assert(3)ion.

Fixing a crash reported by Bjarni Ingi Gislason <bjarniig at rhi dot hi dot is>
in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901636 which the
Debian maintainer of mandoc, Michael at Stapelberg dot ch, forwarded to me.

Revision 1.136 / (download) - annotate - [select for diffs], Thu Feb 27 01:43:52 2020 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.135: +49 -38 lines
Diff to previous 1.135 (colored)

Introduce the concept of nodes that are semantically transparent:
they are skipped when looking for previous or following high-level
macros.  Examples include roff(7) .ft, .ll, and .ta, mdoc(7) .Sm
and .Tg, and man(7) .DT and .PD.  Use this concept for a variety
of improved decisions in various validators and formatters.

While here,
* remove a few const qualifiers on struct arguments that caused trouble;
* get rid of some more Yoda notation in the vicinity;
* and apply some other stylistic improvements in the vicinity.

I found this class of issues while considering .Tg patches from kn@.

Revision 1.135 / (download) - annotate - [select for diffs], Thu Feb 20 22:55:42 2020 UTC (4 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.134: +4 -4 lines
Diff to previous 1.134 (colored)

bugfix: indented paragraph macros need a space character
before the width argument

Revision 1.134 / (download) - annotate - [select for diffs], Thu Feb 20 00:29:16 2020 UTC (4 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.133: +2 -2 lines
Diff to previous 1.133 (colored)

bugfix: .Tg must be ignored completely in these output modes

Revision 1.133 / (download) - annotate - [select for diffs], Sun Jan 19 18:02:00 2020 UTC (4 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.132: +2 -1 lines
Diff to previous 1.132 (colored)

Introduce a new mdoc(7) macro .Tg ("tag") to explicitly mark a place
as defining a term.  Please only use it when automatic tagging does
not work.  Manual page authors will not be required to add the new
macro; using it remains optional.  HTML output is still rudimentary
in this version and will be polished later.

Thanks to kn@ for reminding me that i have been considering since
BSDCan 2014 whether something like this might be useful.  Given
that possibilities of making automatic tagging better are running
out and there are still several situations where automatic tagging
cannot do the job, i think the time is now ripe.

Feedback and no objection from millert@; OK espie@ inoguchi@ kn@.

Revision 1.132 / (download) - annotate - [select for diffs], Fri Jan 4 03:17:36 2019 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_5
Changes since 1.131: +33 -10 lines
Diff to previous 1.131 (colored)

Oops, i forgot to adjust this file to the changes in roff.h rev. 1.67.
Provide a handler for the new .nf and .fi roff(7) request nodes,
avoiding a potential crash, and correctly restore the former fill
more at .Ed even when there was .nf or .fi inside the block.

Revision 1.131 / (download) - annotate - [select for diffs], Sun Dec 30 00:49:55 2018 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.130: +5 -6 lines
Diff to previous 1.130 (colored)

Cleanup, no functional change:

The struct roff_man used to be a bad mixture of internal parser
state and public parsing results.  Move the public results to the
parsing result struct roff_meta, which is already public.  Move the
rest of struct roff_man to the parser-internal header roff_int.h.

Since the validators need access to the parser state, call them
from the top level parser during mparse_result() rather than from
the main programs, also reducing code duplication.

This keeps parser internal state out of thee main programs (five
in mandoc portable) and out of eight formatters.

Revision 1.130 / (download) - annotate - [select for diffs], Sat Dec 15 19:30:26 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.129: +2 -1 lines
Diff to previous 1.129 (colored)

Several improvements to escape sequence handling.

* Add the missing special character \_ (underscore).
* Partial implementations of \a (leader character)
and \E (uninterpreted escape character).
* Parse and ignore \r (reverse line feed).
* Add a WARNING message about undefined escape sequences.
* Add an UNSUPP message about unsupported escape sequences.
* Mark \! and \? (transparent throughput)
and \O (suppress output) as unsupported.
* Treat the various variants of zero-width spaces as one-byte escape
sequences rather than as special characters, to avoid defining bogus
forms with square brackets.
* For special characters with one-byte names, do not define bogus
forms with square brackets, except for \[-], which is valid.
* In the form with square brackets, undefined special characters do not
fall back to printing the name verbatim, not even for one-byte names.
* Starting a special character name with a blank is an error.
* Undefined escape sequences never abort formatting of the input
string, not even in HTML output mode.
* Document the newly handled escapes, and a few that were missing.
* Regression tests for most of the above.

Revision 1.129 / (download) - annotate - [select for diffs], Mon Dec 3 21:00:10 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.128: +10 -3 lines
Diff to previous 1.128 (colored)

In the validators, translate obsolete macro aliases (Lp, Ot, LP, P)
to the standard forms (Pp, Ft, PP) up front, such that later code
does not need to look for the obsolete versions.
This reduces the risk of incomplete handling.

Revision 1.128 / (download) - annotate - [select for diffs], Thu Aug 23 19:33:27 2018 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.127: +1 -14 lines
Diff to previous 1.127 (colored)

The upcoming .while request will have to re-execute roff(7) lines
parsed earlier, so they will have to be saved for reuse - but the
read.c preparser does not know yet whether a line contains a .while
request before passing it to the roff parser.  To cope with that,
save all parsed lines for now.  Even shortens the code by 20 lines.

Revision 1.127 / (download) - annotate - [select for diffs], Fri Aug 17 20:33:37 2018 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.126: +21 -15 lines
Diff to previous 1.126 (colored)

Remove more pointer arithmetic passing via regions outside the array
that is undefined according to the C standard.  Robert Elz <kre at
munnari dot oz dot au> pointed out i wasn't quite done yet.

Revision 1.126 / (download) - annotate - [select for diffs], Wed Apr 11 17:11:13 2018 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_4
Changes since 1.125: +11 -3 lines
Diff to previous 1.125 (colored)

preserve comments before .Dd when converting mdoc(7) to man(7)
with mandoc -Tman; suggested by Thomas Klausner <wiz at NetBSD>

Revision 1.125 / (download) - annotate - [select for diffs], Thu Apr 5 22:05:08 2018 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.124: +2 -2 lines
Diff to previous 1.124 (colored)

Do not use a non-portable .R man(7) macro.  Neither groff nor the
heirloom-doctools support it.  Work around the gap by using .BR
with an empty first argument.  This was noticed more than once in
the past, but i always forgot to fix it.

Revision 1.124 / (download) - annotate - [select for diffs], Thu Apr 5 08:47:16 2018 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.123: +3 -3 lines
Diff to previous 1.123 (colored)

For .Do/.Dq, use the documented and portable \(lq and \(rq
character escape sequences rather than the undocumented and
non-portable \(Lq and \(Rq.

Bug reported by Tim L <darkxst at github>
via Thomas Klausner <wiz at NetBSD>;
see https://github.com/nih-at/libzip/pull/42

Revision 1.123 / (download) - annotate - [select for diffs], Sat Jan 13 05:23:18 2018 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.122: +1 -10 lines
Diff to previous 1.122 (colored)

Remove the implicit display feature of .Lk because it was inconsistent
across output devices, counter-intuitive, and resulted in ugly
output for many real-world manual pages.  Always format even long
links in-line.  I already committed a similar change to groff.

OK jmc@, bentley@, and the original author
of the feature, Werner Lemberg <wl@gnu.org>.

Revision 1.122 / (download) - annotate - [select for diffs], Wed Jun 14 22:51:25 2017 UTC (7 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_3, VERSION_1_14_2
Changes since 1.121: +2 -1 lines
Diff to previous 1.121 (colored)

Naive implementation of the roff(7) .po (page offset) request.

This clearly works when .po is called on the top level, but might
not be sophisticated enough if people call .po inside indentation-changing
contexts, but i haven't seen that in manual pages (yet :).

Revision 1.121 / (download) - annotate - [select for diffs], Wed Jun 14 13:00:31 2017 UTC (7 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.120: +10 -9 lines
Diff to previous 1.120 (colored)

implement roff(7) .rj (right justify) request

Revision 1.120 / (download) - annotate - [select for diffs], Sat Jun 10 01:28:33 2017 UTC (7 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.119: +19 -10 lines
Diff to previous 1.119 (colored)

do not break the line between Bsx/Bx/Fx/Nx/Ox/Dx and its arguments

Revision 1.119 / (download) - annotate - [select for diffs], Thu Jun 8 12:54:58 2017 UTC (7 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.118: +15 -9 lines
Diff to previous 1.118 (colored)

make the internal a2roffsu() interface more powerful by returning
a pointer to the end of the parsed data, making it easier to
parse subsequent bytes

Revision 1.118 / (download) - annotate - [select for diffs], Tue Jun 6 15:01:04 2017 UTC (7 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.117: +5 -1 lines
Diff to previous 1.117 (colored)

Minimal implementation of the roff(7) .ce request (center a number
of input lines without filling).
Contrary to groff, high-level macros abort .ce mode for now.

Revision 1.117 / (download) - annotate - [select for diffs], Sun Jun 4 22:44:15 2017 UTC (7 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.116: +2 -1 lines
Diff to previous 1.116 (colored)

Implement the roff(7) .mc (right margin character) request.
The Tcl/Tk manual pages use this extensively.
Delete the TERM_MAXMARGIN hack, it breaks .mc inside .nf;
instead, implement a proper TERMP_BRNEVER flag.

Revision 1.116 / (download) - annotate - [select for diffs], Tue May 30 16:31:29 2017 UTC (7 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.115: +13 -7 lines
Diff to previous 1.115 (colored)

fix formatting of intermediate punctuation in .Lk

Revision 1.115 / (download) - annotate - [select for diffs], Mon May 8 15:34:54 2017 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.114: +9 -5 lines
Diff to previous 1.114 (colored)

Basic implementation of the roff(7) .ti (temporary indent) request.
Needed by about four dozen ports (thanks to naddy@ for the research).

Revision 1.114 / (download) - annotate - [select for diffs], Sun May 7 17:31:45 2017 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.113: +12 -2 lines
Diff to previous 1.113 (colored)

Basic implementation of the roff(7) .ta (define tab stops) request.
This is the first feature made possible by the parser reorganization.
Improves the formatting of the SYNOPSIS in many Xenocara GL manuals.
Also important for ports, as reported by many, including naddy@.

Revision 1.113 / (download) - annotate - [select for diffs], Fri May 5 15:17:32 2017 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.112: +9 -15 lines
Diff to previous 1.112 (colored)

Move .sp to the roff modules.  Enough infrastructure is in place
now that this actually saves code: -70 LOC.

Revision 1.112 / (download) - annotate - [select for diffs], Fri May 5 13:17:55 2017 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.111: +24 -26 lines
Diff to previous 1.111 (colored)

move .ll to the roff modules

Revision 1.111 / (download) - annotate - [select for diffs], Fri May 5 02:06:19 2017 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.110: +18 -5 lines
Diff to previous 1.110 (colored)

Move handling of the roff(7) .ft request from the man(7)
modules to the new roff(7) modules.  As a side effect,
mdoc(7) now handles .ft, too.  Of course, do not use that.

Revision 1.110 / (download) - annotate - [select for diffs], Thu May 4 17:48:29 2017 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.109: +11 -2 lines
Diff to previous 1.109 (colored)

Parser reorg:
Generate the first node on the roff level: .br
Fix some column numbers in diagnostic messages while here.

Revision 1.109 / (download) - annotate - [select for diffs], Mon Apr 24 23:06:18 2017 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.108: +4 -4 lines
Diff to previous 1.108 (colored)

Continue parser unification:
* Make enum rofft an internal interface as enum roff_tok in "roff.h".
* Represent mdoc and man macros in enum roff_tok.
* Make TOKEN_NONE a proper enum value and use it throughout.
* Put the prologue macros first in the macro tables.
* Unify mdoc_macroname[] and man_macroname[] into roff_name[].

Revision 1.108 / (download) - annotate - [select for diffs], Mon Apr 17 13:26:47 2017 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.107: +58 -5 lines
Diff to previous 1.107 (colored)

implement display of long .Lk URIs to match -Tascii

Revision 1.107 / (download) - annotate - [select for diffs], Mon Apr 17 12:53:29 2017 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.106: +12 -4 lines
Diff to previous 1.106 (colored)

Fix handling of trailing punctuation in .Lk.
This macro is unusual in so far as trailing punction needs to remain
inside the scope because it must be inside, not after the display
of long URIs in terminal output mode.
Improves formatting of fw_update(1), help(1), less(1), sendbug(1),
acx(4), inet6(4), ipsec(4), oce(4), isakmpd.conf(5), afterboot(8),
release(8), traceroute(8).

Revision 1.106 / (download) - annotate - [select for diffs], Fri Apr 14 18:25:04 2017 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.105: +2 -2 lines
Diff to previous 1.105 (colored)

Do not make the colon after the .Lk link text italic.
I just pushed the same change to GNU troff.

Revision 1.105 / (download) - annotate - [select for diffs], Sat Mar 4 21:41:29 2017 UTC (7 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.104: +3 -5 lines
Diff to previous 1.104 (colored)

Remove a redundant condition in .%T handling, no functional change.
Found by jsg@ with scan-build.

Revision 1.104 / (download) - annotate - [select for diffs], Fri Feb 17 19:15:41 2017 UTC (7 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_1, VERSION_1_13
Changes since 1.103: +3 -5 lines
Diff to previous 1.103 (colored)

Use typographic quotes rather than '"' for .Rs %T (no change for -Tascii
output, of course).  Patch from bentley@ in November 2014.  This can be
committed now because groff merged Anthony's patch yesterday.

Revision 1.103 / (download) - annotate - [select for diffs], Thu Feb 16 03:00:23 2017 UTC (7 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.102: +1 -4 lines
Diff to previous 1.102 (colored)

Remove the ENDBODY_NOSPACE flag, simplifying the code.

Comparing to groff output, it appears that all cases where it was used
and made a difference actually require the opposite, ENDBODY_SPACE.

I have no idea why i added it back in 2010; maybe to compensate for
some other bug that has long been fixed.

Revision 1.102 / (download) - annotate - [select for diffs], Mon Feb 6 03:44:58 2017 UTC (7 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.101: +3 -5 lines
Diff to previous 1.101 (colored)

The .Nm macro does not only use the default name when it has no
argument, but also when the first argument is a child macro.
Arcane issue found in the FreeBSD cxgbetool(8) manual that Baptiste
Daroussin <bapt at FreeBSD> sent me long ago for a different reason.

While solving this, switch to the new technique of doing text
production in the validator, reducing code duplication in the
formatters, which also makes -Ttree output clearer.

Revision 1.101 / (download) - annotate - [select for diffs], Wed Jan 11 17:39:53 2017 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.100: +11 -101 lines
Diff to previous 1.100 (colored)

Do text production for .Bt, .Ex, .Rv, .Ud at the validation stage
rather than in the formatters.  Use NODE_NOSRC flag for .Lb and
NODE_NOSRC and NODE_NOPRT for .St.  Results in a more rigorous
syntax tree and in 135 lines less code.

This work was triggered by a question from Abhinav Upadhyay <er dot
abhinav dot upadhyay at gmail dot com> (NetBSD) on discuss@.

Revision 1.100 / (download) - annotate - [select for diffs], Tue Jan 10 23:36:34 2017 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.99: +2 -23 lines
Diff to previous 1.99 (colored)

Use new NODE_NOSRC and NODE_NOPRT flags for .Bx and .At.
More rigorous AST and 40 lines less code.

Revision 1.99 / (download) - annotate - [select for diffs], Tue Jan 10 21:59:47 2017 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.98: +7 -7 lines
Diff to previous 1.98 (colored)

For the .Ux/.Ox family of macros, do text production at the validation
stage rather than in each and every individual formatter, using the
new NODE_NOSRC flag.  More rigorous and also ten lines less code.

Revision 1.98 / (download) - annotate - [select for diffs], Tue Jan 10 13:47:00 2017 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.97: +18 -18 lines
Diff to previous 1.97 (colored)

unify names of AST node flags; no change of cpp output

Revision 1.97 / (download) - annotate - [select for diffs], Tue Jan 10 12:53:07 2017 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.96: +5 -2 lines
Diff to previous 1.96 (colored)

Introduce flags NODE_NOSRC and NODE_NOPRT for AST nodes.
Use them to mark generated nodes and nodes that shall not produce output.
Let -Ttree output mode display these new flags.
Use NODE_NOSRC for .Ar, .Mt, and .Pa default arguments.
Use NODE_NOPRT for .Dd, .Dt, and .Os.

These will help to make handling of text production macros more rigorous.

Revision 1.96 / (download) - annotate - [select for diffs], Fri Jan 8 17:48:09 2016 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_4
Changes since 1.95: +25 -26 lines
Diff to previous 1.95 (colored)

Delete the redundant "nchild" member of struct roff_node, replacing
most uses by one, a few by two pointer checks, and only one by a
tiny loop - not only making data smaller, but code shorter as well.

This gets rid of an implicit invariant that confused both static
analysis tools and human auditors.  No functional change.

Revision 1.95 / (download) - annotate - [select for diffs], Mon Oct 12 00:08:15 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.94: +1 -15 lines
Diff to previous 1.94 (colored)

To make the code more readable, delete 283 /* FALLTHROUGH */ comments
that were right between two adjacent case statement.  Keep only
those 24 where the first case actually executes some code before
falling through to the next case.

Revision 1.94 / (download) - annotate - [select for diffs], Tue Oct 6 18:32:19 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.93: +72 -72 lines
Diff to previous 1.93 (colored)

modernize style: "return" is not a function

Revision 1.93 / (download) - annotate - [select for diffs], Sat Apr 18 17:53:21 2015 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.92: +6 -12 lines
Diff to previous 1.92 (colored)

Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),
man_node() from the mandoc(3) semi-public interface and the internal
wrapper functions print_mdoc() and print_man() from the HTML formatters.
Minus 60 lines of code, no functional change.

Revision 1.92 / (download) - annotate - [select for diffs], Sat Apr 18 16:06:40 2015 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.91: +3 -3 lines
Diff to previous 1.91 (colored)

Replace the structs mdoc and man by a unified struct roff_man.
Almost completely mechanical, no functional change.
Written on the train from Exeter to London returning from p2k15.

Revision 1.91 / (download) - annotate - [select for diffs], Thu Apr 2 23:48:20 2015 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.90: +3 -3 lines
Diff to previous 1.90 (colored)

Third step towards parser unification:
Replace struct mdoc_meta and struct man_meta by a unified struct roff_meta.
Written of the train from London to Exeter on the way to p2k15.

Revision 1.90 / (download) - annotate - [select for diffs], Thu Apr 2 22:48:17 2015 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.89: +11 -11 lines
Diff to previous 1.89 (colored)

Second step towards parser unification:
Replace struct mdoc_node and struct man_node by a unified struct roff_node.
To be able to use the tok member for both mdoc(7) and man(7) without
defining all the macros in roff.h, sacrifice a tiny bit of type safety
and make tok an int rather than an enum.
Almost mechanical, no functional change.
Written on the Eurostar from Bruxelles to London on the way to p2k15.

Revision 1.89 / (download) - annotate - [select for diffs], Thu Apr 2 21:36:50 2015 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.88: +35 -34 lines
Diff to previous 1.88 (colored)

First step towards parser unification:
Replace enum mdoc_type and enum man_type by a unified enum roff_type.
Almost mechanical, no functional change.
Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.

Revision 1.88 / (download) - annotate - [select for diffs], Tue Feb 17 20:37:17 2015 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_3
Changes since 1.87: +3 -3 lines
Diff to previous 1.87 (colored)

Render \(lq and \(rq as '"' in -Tascii mode but leave the rendering
of .Do/.Dc, .Dq, .Lb, and .St untouched.
Reduces groff-mandoc differences in OpenBSD base by about 7%.
Reminded of the issue by naddy@.

Revision 1.87 / (download) - annotate - [select for diffs], Thu Feb 12 12:24:33 2015 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.86: +11 -8 lines
Diff to previous 1.86 (colored)

Delete the mdoc_node.pending pointer and the function calculating
it, make_pending(), which was the most difficult function of the
whole mdoc(7) parser.  After almost five years of maintaining this
hellhole, i just noticed the pointer isn't needed after all.

Blocks are always rewound in the reverse order they were opened;
that even holds for broken blocks.  Consequently, it is sufficient
to just mark broken blogs with the flag MDOC_BROKEN and breaking
blocks with the flag MDOC_ENDED.  When rewinding, instead of iterating
the pending pointers, just iterate from each broken block to its
parents, rewinding all that are MDOC_ENDED and stopping after
processing the first ancestor that it not MDOC_BROKEN.  For ENDBODY
markers, use the mdoc_node.body pointer in place of the former
mdoc_node.pending.

This also fixes an assertion failure found by jsg@ with afl,
test case #467 (Bo Bl It Bd Bc It), where (surprise surprise)
the pending pointer got corrupted.

Improved functionality, minus one function, minus one struct field,
minus 50 lines of code.

Revision 1.86 / (download) - annotate - [select for diffs], Wed Feb 11 14:15:12 2015 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.85: +3 -4 lines
Diff to previous 1.85 (colored)

do not access a NULL pointer if an .Eo block lacks a tail;
found by jsg@ with afl, test case #16

Revision 1.85 / (download) - annotate - [select for diffs], Fri Feb 6 03:38:45 2015 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.84: +6 -3 lines
Diff to previous 1.84 (colored)

better handle .Fo and .Fd without argument
better handle .Fo with more than one argument

Revision 1.84 / (download) - annotate - [select for diffs], Sun Feb 1 23:10:35 2015 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.83: +25 -3 lines
Diff to previous 1.83 (colored)

fix .Eo/.Ec spacing

Revision 1.83 / (download) - annotate - [select for diffs], Wed Jan 28 17:32:07 2015 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.82: +9 -6 lines
Diff to previous 1.82 (colored)

* Polish tbl(7) error reporting.
* Do not print out macro names in tbl(7) data blocks.
* Like with GNU tbl, let empty tables cause a blank line.
* Avoid producing empty tables in -Tman.

Revision 1.82 / (download) - annotate - [select for diffs], Fri Jan 23 14:21:01 2015 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.81: +6 -6 lines
Diff to previous 1.81 (colored)

Let .Aq/.Ao/.Ac print "<>" instead of the normal "\(la\(ra"
when the only child is .Mt, not when the preceding node is .An,
to improve robustness.  Triggered by a question from Svyatoslav
Mishyn <juef at openmailbox dot org> (Crux Linux).

Revision 1.81 / (download) - annotate - [select for diffs], Wed Dec 24 23:32:42 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.80: +28 -29 lines
Diff to previous 1.80 (colored)

Support negative indentations for mdoc(7) displays and lists.
Not exactly recommended for use, rather for groff compatibility.
While here, introduce similar SHRT_MAX limits as in man(7),
fixing a few cases of infinite output found by jsg@ with afl.

Revision 1.80 / (download) - annotate - [select for diffs], Tue Dec 23 13:48:57 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.79: +5 -1 lines
Diff to previous 1.79 (colored)

support negative horizontal widths in man(7);
minus twenty lines of code in spite of enhanced functionality

Revision 1.79 / (download) - annotate - [select for diffs], Tue Dec 23 10:09:44 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.78: +3 -3 lines
Diff to previous 1.78 (colored)

fix typo in previous

Revision 1.78 / (download) - annotate - [select for diffs], Tue Dec 23 09:31:46 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.77: +3 -3 lines
Diff to previous 1.77 (colored)

some scaling unit fixes:
- .sp with an invalid argument is .sp 1v, not .sp 0v
- in man(1), trailing garbage doesn't make scaling units invalid

Revision 1.77 / (download) - annotate - [select for diffs], Sun Nov 30 05:29:00 2014 UTC (10 years ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_2
Changes since 1.76: +3 -2 lines
Diff to previous 1.76 (colored)

Multiple fixes with respect to .Pf:
* The first argument of .Pf is not parsed.
* Normal delimiter handling does not apply to the first argument of .Pf.
* Warn if nothing follows a prefix (inspired by groff_mdoc(7)).
* In that case, do not suppress spacing.

Revision 1.76 / (download) - annotate - [select for diffs], Thu Nov 27 22:27:56 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.75: +14 -5 lines
Diff to previous 1.75 (colored)

Multiple fixes with respect to .Eo:
1. Correctly parse stray .Ec without preceding .Eo,
avoiding an assertion violation found by jsg@ with afl.
2. Correctly parse .Ec arguments when breaking another block.
3. Correct spacing around closing delimiter when breaking another block.
4. Sync some related formatting control from -Tascii to -Thtml.

Revision 1.75 / (download) - annotate - [select for diffs], Thu Nov 27 16:20:31 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.74: +11 -11 lines
Diff to previous 1.74 (colored)

Fix the obsolete .Db (toggle debug mode) macro to ignore its arguments
and not trigger an assertion when there is more than one argument;
the latter found by jsg@ with afl.

Revision 1.74 / (download) - annotate - [select for diffs], Wed Nov 19 22:00:37 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.73: +24 -3 lines
Diff to previous 1.73 (colored)

Let .Ao and .Aq render as "<>" after .An and as "\(la\(ra" elsewhere,
just like groff; minibug noticed by bentley@.

Revision 1.73 / (download) - annotate - [select for diffs], Mon Nov 17 06:44:58 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.72: +5 -1 lines
Diff to previous 1.72 (colored)

Multiple fixes with respect to in-line macros:
* .No selects the default font; relevant e.g. in .Bf blocks
* no need to force empty .Li elements
* closing delimiters as leading macro arguments do not suppress space
* opening delimiters at the end of a macro line do not suppress space
* correctly handle delimiter spacing in -Tman
As a side effect, these fixes let mandoc warn about empty .No macros
as requested by bentley@.

Revision 1.72 / (download) - annotate - [select for diffs], Thu Nov 6 22:28:36 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.71: +2 -2 lines
Diff to previous 1.71 (colored)

Let -Tascii \(bu (bullet) output agree with groff;
this is now possible because -Tps now handles backspace overstriking.

Revision 1.71 / (download) - annotate - [select for diffs], Thu Oct 30 20:10:02 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.70: +9 -9 lines
Diff to previous 1.70 (colored)

Major bugsquashing with respect to -offset and -width:
1. Support specifying the .Bd and .Bl -offset as a macro default width;
while here, simplify the code handling the same for .Bl -width.
2. Correct handling of .Bl -offset arguments:  unlike .Bd -offset, the
arguments "left", "indent", and "indent-two" have no special meaning.
3. Fix the scaling of string length -offset and -width arguments in -Thtml.
Triggered by an incomplete documentation patch from bentley@.

Revision 1.70 / (download) - annotate - [select for diffs], Thu Aug 21 12:57:17 2014 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.69: +7 -4 lines
Diff to previous 1.69 (colored)

Right after .Fl, a middle delimiter triggers an empty scope,
just like a closing delimiter.  This didn't work in groff-1.15,
but it now works in groff-1.22.

After being closed by delimiters, .Nm scopes do not reopen.

Do not suppress white space after .Fl if the next node is a text node
on the same input line; that can happen for middle delimiters.

Fixing an issue reported by jmc@.

Revision 1.69 / (download) - annotate - [select for diffs], Sun Aug 10 23:54:41 2014 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_4, VERSION_1_12
Changes since 1.68: +3 -3 lines
Diff to previous 1.68 (colored)

Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.
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.

Revision 1.68 / (download) - annotate - [select for diffs], Wed Aug 6 15:09:05 2014 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_1
Changes since 1.67: +4 -3 lines
Diff to previous 1.67 (colored)

Bring the handling of defective prologues even closer to groff,
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.

Revision 1.67 / (download) - annotate - [select for diffs], Wed Jul 30 00:19:16 2014 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.66: +95 -10 lines
Diff to previous 1.66 (colored)

Various improvements related to .Ex and .Rv:
* 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

Revision 1.66 / (download) - annotate - [select for diffs], Fri Jul 4 16:12:08 2014 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.65: +7 -5 lines
Diff to previous 1.65 (colored)

Clean up messages regarding excess arguments:
* Downgrade ".Bf -emphasis Em" from FATAL to WARNING.
* Mention the macros, the arguments, and the fallbacks.
* Hierarchical naming.

Revision 1.65 / (download) - annotate - [select for diffs], Wed Jul 2 19:55:10 2014 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.64: +9 -4 lines
Diff to previous 1.64 (colored)

When .Sm is called without an argument, groff toggles the spacing mode,
so let us do the same for compatibility.  Using this feature is of
course not recommended except in manual page obfuscation contests.

Revision 1.64 / (download) - annotate - [select for diffs], Wed Jul 2 03:48:07 2014 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.63: +42 -5 lines
Diff to previous 1.63 (colored)

Implement the obsolete macros .En .Es .Fr .Ot for backward compatibility,
since this is hardly more complicated than explicitly ignoring them
as we did in the past.  Of course, do not use them!

Revision 1.63 / (download) - annotate - [select for diffs], Sun Apr 20 19:40:13 2014 UTC (10 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.62: +7 -6 lines
Diff to previous 1.62 (colored)

make sure static buffers for snprintf(3) are large enough
and cast snprintf return value to (void) where they are

Revision 1.62 / (download) - annotate - [select for diffs], Sun Apr 20 16:46:05 2014 UTC (10 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.61: +71 -70 lines
Diff to previous 1.61 (colored)

KNF: case (FOO):  ->  case FOO:, remove /* LINTED */ and /* ARGSUSED */,
remove trailing whitespace and blanks before tabs, improve some indenting;
no functional change

Revision 1.61 / (download) - annotate - [select for diffs], Sun Mar 30 23:34:32 2014 UTC (10 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +12 -3 lines
Diff to previous 1.60 (colored)

Improve formatting of broken blocks in -Tman,
somewhat similar to what mdoc_term.c already does for -Tascii.
OpenBSD rev. 1.58.

Revision 1.60 / (download) - annotate - [select for diffs], Sun Mar 30 19:47:48 2014 UTC (10 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.59: +11 -1 lines
Diff to previous 1.59 (colored)

Implement the roff(7) .ll (line length) request.
Found by naddy@ in the textproc/enchant(1) port.
Of course, do not use this in new manuals.

Revision 1.59 / (download) - annotate - [select for diffs], Sun Mar 23 11:25:26 2014 UTC (10 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.58: +4 -3 lines
Diff to previous 1.58 (colored)

The files mandoc.c and mandoc.h contained both specialised low-level
functions used for multiple languages (mdoc, man, roff), for example
mandoc_escape(), mandoc_getarg(), mandoc_eos(), and generic auxiliary
functions.  Split the auxiliaries out into their own file and header.
While here, do some #include cleanup.

Revision 1.58 / (download) - annotate - [select for diffs], Wed Jan 22 20:58:39 2014 UTC (10 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.57: +5 -2 lines
Diff to previous 1.57 (colored)

Implement the \: (optional line break) escape sequence,
documented in the Ossanna-Kernighan-Ritter troff manual
and also supported by groff.

Missing feature reported by Steffen Nurpmeso <sdaoden at gmail dot com>.

Revision 1.57 / (download) - annotate - [select for diffs], Wed Dec 25 22:00:45 2013 UTC (10 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_3
Changes since 1.56: +9 -4 lines
Diff to previous 1.56 (colored)

Implement .Fo/.Fa/.Fc indentation and break handling for -Tman.

Revision 1.56 / (download) - annotate - [select for diffs], Wed Dec 25 00:39:31 2013 UTC (11 years ago) by schwarze
Branch: MAIN
Changes since 1.55: +11 -1 lines
Diff to previous 1.55 (colored)

Do not break output lines in .Fn function arguments in SYNOPSIS mode.
Following an idea from Franco Fichtner, but implemented more cleanly.
This reduces groff-mandoc-differences in OpenBSD base by a fantastic 7.5%.

Revision 1.55 / (download) - annotate - [select for diffs], Tue Dec 24 22:08:50 2013 UTC (11 years ago) by schwarze
Branch: MAIN
Changes since 1.54: +5 -2 lines
Diff to previous 1.54 (colored)

Implement SYNOPSIS .Fn indentation for -Tman.

Revision 1.54 / (download) - annotate - [select for diffs], Tue Dec 24 20:45:27 2013 UTC (11 years ago) by schwarze
Branch: MAIN
Changes since 1.53: +18 -19 lines
Diff to previous 1.53 (colored)

It turns out SYNOPSIS mode does not imply .Bk in general,
but only within .Nm blocks.  Simplify the code accordingly.

Triggered by research done by Franco Fichtner.

Revision 1.53 / (download) - annotate - [select for diffs], Mon Oct 7 22:22:10 2013 UTC (11 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.52: +5 -5 lines
Diff to previous 1.52 (colored)

Printf size_t vars with %zu, not %ld;
from Antonio Huete Jimenez <tuxillo at quantumachine dot net>
via Franco Fichtner (both DragonFly).

Revision 1.52 / (download) - annotate - [select for diffs], Sun Sep 15 18:48:31 2013 UTC (11 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_2
Changes since 1.51: +3 -4 lines
Diff to previous 1.51 (colored)

Use normal line macro recognition, do not attempt to roll your own.
This fixes horizontal spacing when an Ns macro follows a block-closing
macro and the corresponding block-opening macro is not on the same line.

Revision 1.51 / (download) - annotate - [select for diffs], Sun Jun 2 18:16:57 2013 UTC (11 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.50: +6 -6 lines
Diff to previous 1.50 (colored)

Let .Do .Dq .Ql .So .Sq generate the correct roff(7) character escape
sequences such that output modes like -Tutf8 have a chance to select
nice glyphs.  This doesn't change anything for -Tascii, and, for now,
it doesn't affect -Tps and -Tpdf either.
OK matthew@ bentley@; like the idea tedu@; no opinion jmc@.

Revision 1.50 / (download) - annotate - [select for diffs], Wed May 29 15:40:22 2013 UTC (11 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.49: +2 -2 lines
Diff to previous 1.49 (colored)

In SYNOPSIS mode, .Ek doesn't end a keep.
Found and fixed on the plane to the OpenBSD t2k13 hackathon in Toronto.

Revision 1.49 / (download) - annotate - [select for diffs], Sun May 19 21:40:24 2013 UTC (11 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.48: +22 -4 lines
Diff to previous 1.48 (colored)

Support .Bl -offset in -mdoc -Tman.
Issue found when Thomas Klausner <wiz at NetBSD dot org> made me
look at the manuals of his http://www.nih.at/libzip library.

Revision 1.48 / (download) - annotate - [select for diffs], Sun May 19 21:07:51 2013 UTC (11 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.47: +5 -5 lines
Diff to previous 1.47 (colored)

Move printing of the .RS macro into print_offs() such that print_offs()
takes care of printing the whole line.  This reduces code duplication -
in particular after the upcoming commit to repair .Bl -offset -
and makes print_offs() more similar to what print_width() does.
No functional change.

Revision 1.47 / (download) - annotate - [select for diffs], Mon Dec 31 22:34:48 2012 UTC (11 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +49 -35 lines
Diff to previous 1.46 (colored)

Rewrite indentation handling for nested lists in a more systematic way
to fix multiple issues reported by Todd Miller; thanks!

Specifically,
 - avoid double indentation after .Bd inside .Bl
 - set up correct indentation after .Bl inside .Bl
 - set up correct indentation after .Dl and .D1 inside .Bl

While here, also
 - set up correct indentation *inside* .Dl and .D1 inside .Bl.

Revision 1.46 / (download) - annotate - [select for diffs], Mon Nov 19 02:14:45 2012 UTC (12 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.45: +34 -22 lines
Diff to previous 1.45 (colored)

In -Tman mode, support automatic word keeps in the SYNOPSIS
just like in -Tascii mode; requested by millert@.

While here, do not escape the blank characters terminating man(7)
macros; this is becoming more important as we use more keeps now.

Note that -Tman still does not support .nr nS.

Revision 1.45 / (download) - annotate - [select for diffs], Mon Nov 19 02:08:33 2012 UTC (12 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.44: +10 -9 lines
Diff to previous 1.44 (colored)

Three portability improvements by millert@:
* Use "\\ " not "\\~" as the non-breaking space as historic nroff
doesn't support the latter.
* The '-' before the flags needs to be quoted to prevent nroff
from putting a line break between the '-' and the flag character.
* Disable hyphenation and, for nroff, disable justification which is
consistent with how mdoc behaves (and produces more readable manuals).

(OpenBSD rev. 1.39, 1.40 and 1.41)

Revision 1.44 / (download) - annotate - [select for diffs], Sun Nov 18 19:34:19 2012 UTC (12 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.43: +20 -6 lines
Diff to previous 1.43 (colored)

Make the generated man(7) code more portable by using .PD
instead of .sp -1v, which for example Solaris nroff handles poorly.

Problem report and patch by millert@,
with the print_word chunk tweaked by me.

Revision 1.43 / (download) - annotate - [select for diffs], Sun Nov 18 18:02:23 2012 UTC (12 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.42: +104 -7 lines
Diff to previous 1.42 (colored)

Correct indentation for lists and displays inside lists.

Inspired by a diff from millert@, but implemented rather
differently and with slightly better functionality.
In particular, this one respects -offset and -width
arguments found in the input file.

Revision 1.42 / (download) - annotate - [select for diffs], Sat Nov 17 00:26:33 2012 UTC (12 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.41: +20 -19 lines
Diff to previous 1.41 (colored)

Cleanup naming of local variables to make the code easier on the eye:
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

Revision 1.41 / (download) - annotate - [select for diffs], Mon Jul 16 10:45:41 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.40: +4 -3 lines
Diff to previous 1.40 (colored)

For .El .sp, avoid the weird .sp -1v .PP .PP output sequence.
Synching to OpenBSD rev. 1.38.

Revision 1.40 / (download) - annotate - [select for diffs], Mon Jul 16 09:51:54 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.39: +5 -2 lines
Diff to previous 1.39 (colored)

Several -mdoc parser improvements related to vertical spacing:
* So far, .Pp and .Lp were removed before paragraph type blocks.
* Now also remove .br before paragraph type blocks.
* Treat .Lp as a paragraph like .Pp, so remove .Pp, .Lp, .br before it.
* Do not treat .sp as a paragraph, don't remove anything before it.
* After .Sh, .Ss, .Pp, and .Lp, remove .Pp, .Lp, .sp, .br, and blank lines.
* After .sp and .br, remove .br.
OpenBSD rev. mdoc.c 1.89 and mdoc_validate.c 1.106

Revision 1.39 / (download) - annotate - [select for diffs], Sat Jul 14 09:07:18 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.38: +3 -2 lines
Diff to previous 1.38 (colored)

In -Tman .Bl -compact, skip the blank line only before the first item
of the first list in a section, not before every item of the first list.
OpenBSD rev. 1.37

Revision 1.38 / (download) - annotate - [select for diffs], Fri Jul 13 23:57:58 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.37: +11 -2 lines
Diff to previous 1.37 (colored)

Adjust -Tman SYNOPSIS .Nm indentation using .HP; requested by millert@.
There are still lots of ugly line breaks, to be fixed later.
OpenBSD rev. 1.36

Revision 1.37 / (download) - annotate - [select for diffs], Fri Jul 13 20:43:40 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.36: +55 -28 lines
Diff to previous 1.36 (colored)

If the tag in .Bl -tag .It would leave exactly one blank before the
body of the item, mdoc(7) breaks the line, whereas the .TP used to
translate this to man(7) does not.  Thus, insert an explicit roff(7)
line break in this place.
To be able to correctly count the characters, do not pass font escapes
an the like through print_word().
OpenBSD rev. 1.35

Revision 1.36 / (download) - annotate - [select for diffs], Fri Jul 13 14:19:49 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.35: +83 -70 lines
Diff to previous 1.35 (colored)

In -man -Tascii, support .sp with negative argument.
In -mdoc -Tman, improve the framework to control vertical spacing.
Use both to support .Bl -compact (surprisingly hard to get right).
OpenBSD rev. 1.85 and 1.34, respectively.

Revision 1.35 / (download) - annotate - [select for diffs], Thu Jul 12 08:55:48 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.34: +16 -9 lines
Diff to previous 1.34 (colored)

Do not crash in -Tman on:
* .Fn with exactly one argument
* .Bl -hang without a -width
Now all 3776 OpenBSD base manuals build without crashing.
OpenBSD rev. 1.33

Revision 1.34 / (download) - annotate - [select for diffs], Wed Jul 11 23:46:37 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +68 -28 lines
Diff to previous 1.33 (colored)

Polish -Tman .Rs support.
All mdoc(7) macros are now supported by -Tman.
OpenBSD rev. 1.32

Revision 1.33 / (download) - annotate - [select for diffs], Wed Jul 11 16:19:08 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.32: +42 -6 lines
Diff to previous 1.32 (colored)

basic implementation of -Tman .Bl -column using tbl(7); OpenBSD rev. 1.31

Revision 1.32 / (download) - annotate - [select for diffs], Tue Jul 10 20:37:02 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.31: +6 -6 lines
Diff to previous 1.31 (colored)

basic implementation of -Tman .Bl -tag
while here, do some minor outflags cleanup
OpenBSD rev. 1.30

Revision 1.31 / (download) - annotate - [select for diffs], Tue Jul 10 19:54:11 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.30: +23 -9 lines
Diff to previous 1.30 (colored)

multiple fixes to -Tascii .HP rendering:
* do not add an excessive blank line before the block
* in literal mode, start a new line after the tag

getting this to work requires some general (print_man_node) fixes:
* in literal mode, break the output line at the end of each
input line, not just after those input lines ending in text
* but don't break it when there was no output on the line
* and adjust the margins after the .HP tag

these general fixes require an adjustment to -Tascii .TP rendering:
* set up NOBREAK mode before the body, not after the head

finally, based on all this, implement -Tman .Bl -hang in terms of .HP

OpenBSD rev. 1.84 and 1.29, respectively

Revision 1.30 / (download) - annotate - [select for diffs], Tue Jul 10 14:38:51 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.29: +122 -9 lines
Diff to previous 1.29 (colored)

* implement -Tman .Bl -item -inset -diag -ohang -dash -hyphen -enum .It
* fix -Tman .Bl -bullet .It
* adjust the -Tascii .Bl -bullet -dash -hyphen .It
default and minimum width to new groff standards,
it changed from 4n (in groff 1.15) to 2n (in groff 1.21)
* same for -Tascii -enum, it changed from 5n to 2n
* use -hang formatting for -Tascii -enum -width 2n
* for -Tascii -enum, the default is -width 3n

Revision 1.29 / (download) - annotate - [select for diffs], Mon Jul 9 23:53:36 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.28: +23 -4 lines
Diff to previous 1.28 (colored)

fix -Tascii .Fd line breaking
and implement -Tman .Fd
OpenBSD rev. 1.27 and 1.143, respectively

Revision 1.28 / (download) - annotate - [select for diffs], Mon Jul 9 22:36:34 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.27: +13 -4 lines
Diff to previous 1.27 (colored)

implement -Tman .Eo and .Ec; OpenBSD rev. 1.26

Revision 1.27 / (download) - annotate - [select for diffs], Mon Jul 9 18:56:12 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.26: +42 -6 lines
Diff to previous 1.26 (colored)

Implement -Tman .Bf.
To get the spacing right,
* avoid man(7) code line breaks at places where no spacing is allowed
* allow spacing right after .Sm on
* allow spacing after empty .Fl at the end of an input line
OpenBSD rev. 1.25

Revision 1.26 / (download) - annotate - [select for diffs], Mon Jul 9 17:53:01 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.25: +147 -67 lines
Diff to previous 1.25 (colored)

fix -Tman font handling for:
.Ad .Ar .Cd .Cm .Dv .Em .Er .Ev .Fa .Fl .Fn .Fo .Ft
.Ic .In .Lk .Li .Ms .Mt .Nm .Pa .Sx .Sy .Tn .Va .Vt
OpenBSD rev. 1.24

Revision 1.25 / (download) - annotate - [select for diffs], Mon Jul 9 09:31:48 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.24: +27 -15 lines
Diff to previous 1.24 (colored)

implement -Tman .No and .Mt; OpenBSD rev. 1.23

Revision 1.24 / (download) - annotate - [select for diffs], Sun Jul 8 22:49:29 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.23: +31 -2 lines
Diff to previous 1.23 (colored)

fix .Lk for -Tascii and implement it for -Tman
OpenBSD rev. 1.22 and 1.142, respectively

Revision 1.23 / (download) - annotate - [select for diffs], Sun Jul 8 18:39:47 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.22: +65 -12 lines
Diff to previous 1.22 (colored)

fix vertical spacing for -Tman SYNOPSIS .Fn .Fo .Ft .In .Nm .Va .Vt
OpenBSD rev. 1.21

Revision 1.22 / (download) - annotate - [select for diffs], Sun Jul 8 16:52:20 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.21: +30 -2 lines
Diff to previous 1.21 (colored)

implement -Tman .An
also reset -[no]split mode at .Sh AUTHORS in -Tascii
OpenBSD rev. 1.20 and 1.141, respectively

Revision 1.21 / (download) - annotate - [select for diffs], Sun Jul 8 15:48:13 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.20: +30 -50 lines
Diff to previous 1.20 (colored)

Add flags to insert a .sp or .br request before the next output,
shortening some frequent idioms and preparing for better vertical
spacing in the SYNOPSIS; no functional change intended.
OpenBSD rev. 1.19

Revision 1.20 / (download) - annotate - [select for diffs], Sun Jul 8 15:01:57 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.19: +178 -182 lines
Diff to previous 1.19 (colored)

Instead of adding one integer variable for each global boolean output flag
and passing around a structure containing them into each and every function,
just use a single static bitfield.
In preparation for adding more output flags to support more features.
OpenBSD rev. 1.18

Revision 1.19 / (download) - annotate - [select for diffs], Sun Jul 8 13:57:53 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

implement -Tman .Va
and fix -Tman .Vt for the non-SYNOPSIS case
OpenBSD rev. 1.17

Revision 1.18 / (download) - annotate - [select for diffs], Sun Jul 8 11:10:13 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.17: +42 -2 lines
Diff to previous 1.17 (colored)

implement -Tman .Vt; OpenBSD rev. 1.15 and 1.16

Revision 1.17 / (download) - annotate - [select for diffs], Sun Jul 8 10:19:37 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.16: +82 -17 lines
Diff to previous 1.16 (colored)

Basic implementation of -Tman .Fo and .Fa;
again, some blank lines still missing from the output.
While here, remove the trailing semicolon
from .Fn when outside .Sh SYNOPSIS.
OpenBSD rev. 1.14

Revision 1.16 / (download) - annotate - [select for diffs], Sat Jul 7 21:16:35 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.15: +49 -3 lines
Diff to previous 1.15 (colored)

rudimentary support for -Tman .Ft and .Fn;
some blank lines are still missing from the output
OpenBSD rev. 1.13

Revision 1.15 / (download) - annotate - [select for diffs], Sat Jul 7 20:36:18 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.14: +33 -2 lines
Diff to previous 1.14 (colored)

basic support for -Tman .In; OpenBSD rev. 1.12

Revision 1.14 / (download) - annotate - [select for diffs], Sat Jul 7 14:05:40 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.13: +14 -2 lines
Diff to previous 1.13 (colored)

after .Lb in library section, break the line in the final output

Revision 1.13 / (download) - annotate - [select for diffs], Sat Jul 7 13:57:19 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.12: +36 -5 lines
Diff to previous 1.12 (colored)

implement -Tman .Bk; OpenBSD rev. 1.10

Revision 1.12 / (download) - annotate - [select for diffs], Sat Jul 7 13:53:14 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.11: +20 -4 lines
Diff to previous 1.11 (colored)

implement -Tman .Sm; OpenBSD rev. 1.9

Revision 1.11 / (download) - annotate - [select for diffs], Sat Jul 7 13:46:59 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.10: +36 -2 lines
Diff to previous 1.10 (colored)

implement -Tman .Bd -offset and -compact; OpenBSD rev. 1.8

Revision 1.10 / (download) - annotate - [select for diffs], Sat Jul 7 13:37:42 2012 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.9: +10 -3 lines
Diff to previous 1.9 (colored)

minor -mdoc -Tman fixes
* right after .Ns, avoid breaking the line in man code
* after .Fl without arguments, do not insert a blank into man code
* before each .Nm in .Sh SYNOPSIS, insert a .br into man code
* skip .Pp arguments, don't copy them to man code

OpenBSD rev. 1.7

Revision 1.9 / (download) - annotate - [select for diffs], Mon Oct 24 21:47:59 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_1
Changes since 1.8: +24 -24 lines
Diff to previous 1.8 (colored)

Implement missing enclosures (Ao Do Qo Qq So Bro Brq)
and enclosure-like in-line macros (Ad Cd Dv Er Ev Li Ms Tn).
The .No macro works without explicit implementation.

ok kristaps@

Revision 1.8 / (download) - annotate - [select for diffs], Thu Oct 20 20:27:21 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.7: +54 -19 lines
Diff to previous 1.7 (colored)

Implement the missing text production macros (Bsx Bx Dx Fx Nx Ox Ux Bt Ud).
Some macros work without explicit implementation (At Db Os St).
ok kristaps@

Revision 1.7 / (download) - annotate - [select for diffs], Sat Oct 8 12:47:40 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_12_0
Changes since 1.6: +5 -1 lines
Diff to previous 1.6 (colored)

Tweak Makefile and add config.h to -Tman to allow cross-compiling on
Windows (via MingW).

Revision 1.6 / (download) - annotate - [select for diffs], Sat Oct 8 11:37:27 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.5: +6 -3 lines
Diff to previous 1.5 (colored)

Implement a basic -Tman `Rv', like `Ex'.

Revision 1.5 / (download) - annotate - [select for diffs], Sat Oct 8 09:58:29 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.4: +176 -108 lines
Diff to previous 1.4 (colored)

Tidy up -Tman output.  This has NO functional change: (1) introduced a
state struct instead of using global statics; (2) documented throughout
the file; (3) fixed a situation of reaching past the end of our buffer
for zero-length strings; (4) alpha-ordered the functions.  (1) and (3)
ok schwarze@.  (2) and (4) are purely style and documentation.

Revision 1.4 / (download) - annotate - [select for diffs], Thu Oct 6 22:29:12 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.3: +9 -1 lines
Diff to previous 1.3 (colored)

If -Tman is specified and input is -man, echo the preprocessed (`so'
replaced by file) input.  This replaces earlier behaviour of doing
nothing, which I found unexpected (mandoc should always output).

This requires a buffer in read.c that saves the input lines before being
parsed, with a special hook if `so' is invoked.  This buffer is just
flushed to output if -mman is the input.

While mucking around doing this, I also alpha-ordered the mandoc.h
functions.

Ok schwarze@, with no screaming when the polished patch was published.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Sep 30 00:13:28 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.2: +134 -41 lines
Diff to previous 1.2 (colored)

implement .Ap .Bd .Bo .Bq .D1 .Ic .Lp .Oo .Pf .Po .Ss .Sx .Sy .br .sp
implement .Bl -bullet
add more information to the .TH line
escape dots at the beginnings of lines
add trailing newline character at the end of the file
do not misinterpret the ROOT block as .Ap

Revision 1.2 / (download) - annotate - [select for diffs], Tue Sep 20 13:47:55 2011 UTC (13 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.1: +3 -3 lines
Diff to previous 1.1 (colored)

do not assign pointers to literal strings
to variables that might be changed;
from kristaps@

Revision 1.1 / (download) - annotate - [select for diffs], Sat Sep 17 15:00:51 2011 UTC (13 years, 3 months ago) by schwarze
Branch: MAIN

Initial, incomplete support for -Tman
to convert mdoc(7) documents to the man(7) language.
This is work in progress and will be developed in tree.
It does already handle the cat(1) manual,
but will hardly handle all your fancy manuals yet.
go ahead  kristaps@ jmc@ millert@ deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb