]> git.cameronkatri.com Git - mandoc.git/log
mandoc.git
7 years agoMacro argument quoting does not prevent recognition of punctuation
Ingo Schwarze [Tue, 30 May 2017 16:22:03 +0000 (16:22 +0000)]
Macro argument quoting does not prevent recognition of punctuation
and of called macros.

This bug affects almost all macros, and fixing it simplifies the
code.  It is amazing that the bogus ARGS_QWORD feature got implemented
in the first place, and then carrier along for more than eight years
without anybody ever noticing that it was pointless.

Reported by Leah Neukirchen <leah at vuxu dot org>, found on Void Linux.

7 years agoUse [ rather than [[ for portability,
Ingo Schwarze [Thu, 18 May 2017 14:45:34 +0000 (14:45 +0000)]
Use [ rather than [[ for portability,
in particular since it makes no difference in the case at hand.
Reported by Leah Neukirchen <leah at vuxu dot org> (Void Linux).

7 years agoDelete the -T xhtml command line option.
Ingo Schwarze [Wed, 17 May 2017 23:39:31 +0000 (23:39 +0000)]
Delete the -T xhtml command line option.
It has been obsolete for more than two years.
Use -T html.

7 years agoFix documentation bug:
Ingo Schwarze [Wed, 17 May 2017 23:23:00 +0000 (23:23 +0000)]
Fix documentation bug:
man(1) does not ignore manpath directories lacking mandoc.db(5) files;
instead, it uses filename lookup to find manuals in such directories.

7 years agoModernize an example showing antiquated syntax,
Ingo Schwarze [Wed, 17 May 2017 23:20:32 +0000 (23:20 +0000)]
Modernize an example showing antiquated syntax,
and delete an example showing the arcane -W stop option.

7 years agomissing space between macro arg and punctuation; from jmc@
Ingo Schwarze [Wed, 17 May 2017 22:43:56 +0000 (22:43 +0000)]
missing space between macro arg and punctuation; from jmc@

7 years agoNever create empty databases.
Ingo Schwarze [Wed, 17 May 2017 22:27:12 +0000 (22:27 +0000)]
Never create empty databases.

When pkg_add(1)ing packages installing manual pages into some directory,
the database in that directory automatically gets created or updated,
no change so far.  This patch causes the database file to be
automatically unlinked when pkg_delete(1)ing the last package having
manual pages in that directory, to leave less cruft behind.

Suggested by ajacoutot@.

7 years agoDo not warn if a database file does not exist
Ingo Schwarze [Wed, 17 May 2017 21:19:32 +0000 (21:19 +0000)]
Do not warn if a database file does not exist
because that is simply equivalent to an empty database.
Suggested by ajacoutot@

7 years agoDelete pointless width calculation for SYNOPSIS .Nm block heads.
Ingo Schwarze [Wed, 17 May 2017 17:54:45 +0000 (17:54 +0000)]
Delete pointless width calculation for SYNOPSIS .Nm block heads.
Just let HTML <table> do its work of selecting the needed width.
<Anton dot Lindqvist at gmail dot com> reported that the manually
calculated width was insufficient in some manual pages.

7 years agoIntroduce a new mandoc(1) message level, -W style, below -W warning.
Ingo Schwarze [Tue, 16 May 2017 19:06:30 +0000 (19:06 +0000)]
Introduce a new mandoc(1) message level, -W style, below -W warning.
Switch -W all from meaning -W warning to meaning -W style.
The meaning of -T lint does *not* change, it still implies -W warning.
No messages on the new level yet, but they will come.

Usually, i do not lightly make the user interface larger.
But this has been planned for years, and EXIT STATUS 1
was reserved for it all the time.  The message system
is now stable enough to finally implement it.

jmc@ regarding the concept: "really good idea"

7 years agowarn about punctuation between .Xr and .Rs in SEE ALSO;
Ingo Schwarze [Sun, 14 May 2017 14:00:58 +0000 (14:00 +0000)]
warn about punctuation between .Xr and .Rs in SEE ALSO;
inspired by mdoclint

7 years agoTweak previous: tb@ noticed that some browser/font combinations
Ingo Schwarze [Sun, 14 May 2017 12:27:28 +0000 (12:27 +0000)]
Tweak previous: tb@ noticed that some browser/font combinations
have so amazingly wide bold fonts (for the same nominal font size)
that adding 15% to the column width still isn't sufficient to make
text reliably fit, so go for 20%.

7 years agoMake the tag column in .Bl -tag lists wider:
Ingo Schwarze [Fri, 12 May 2017 17:58:21 +0000 (17:58 +0000)]
Make the tag column in .Bl -tag lists wider:
1. I forgot about the 2n padding between tag and body.
2. The factor 1.1 was too small for bold fold, make it *1.15 + 1n.
Ugliness spotted by tb@.

7 years agoTrailing \c suppresses the output line break even if
Ingo Schwarze [Tue, 9 May 2017 14:10:01 +0000 (14:10 +0000)]
Trailing \c suppresses the output line break even if
the next line is a text line starting with whitespace.
Quirk found in the sysutils/rancid port.

7 years agoLine-breaking roff(7) requests also break man(7) next-line scope.
Ingo Schwarze [Mon, 8 May 2017 20:33:53 +0000 (20:33 +0000)]
Line-breaking roff(7) requests also break man(7) next-line scope.
Considering that real roff implements next-line scope using input
line traps, that isn't all that surprising.
Issue found in the games/xbattle port.

7 years agoBasic implementation of the roff(7) .ti (temporary indent) request.
Ingo Schwarze [Mon, 8 May 2017 15:34:54 +0000 (15:34 +0000)]
Basic implementation of the roff(7) .ti (temporary indent) request.
Needed by about four dozen ports (thanks to naddy@ for the research).

7 years agoConvert REQUEST REFERENCE from using .Ss to .Bl -tag, allowing to
Ingo Schwarze [Mon, 8 May 2017 03:55:25 +0000 (03:55 +0000)]
Convert REQUEST REFERENCE from using .Ss to .Bl -tag, allowing to
specify request arguments and supporting tag searching in less(1).
Improve some entries and document .ta.

7 years agoimplement .DT in terms of .ta; needed for print/ghostview, for example
Ingo Schwarze [Sun, 7 May 2017 21:44:49 +0000 (21:44 +0000)]
implement .DT in terms of .ta; needed for print/ghostview, for example

7 years agoBasic implementation of the roff(7) .ta (define tab stops) request.
Ingo Schwarze [Sun, 7 May 2017 17:31:45 +0000 (17:31 +0000)]
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@.

7 years agoShorten the description of .sp and move it to roff(7).
Ingo Schwarze [Fri, 5 May 2017 15:54:59 +0000 (15:54 +0000)]
Shorten the description of .sp and move it to roff(7).
If is not a macro but a low-level roff request
and not recommended for use in manual pages.

7 years agoMove .sp to the roff modules. Enough infrastructure is in place
Ingo Schwarze [Fri, 5 May 2017 15:17:32 +0000 (15:17 +0000)]
Move .sp to the roff modules.  Enough infrastructure is in place
now that this actually saves code: -70 LOC.

7 years agomove .ll to the roff modules
Ingo Schwarze [Fri, 5 May 2017 13:17:54 +0000 (13:17 +0000)]
move .ll to the roff modules

7 years agoClean up docs after today's .br and .ft code cleanup; simpler.
Ingo Schwarze [Fri, 5 May 2017 02:31:35 +0000 (02:31 +0000)]
Clean up docs after today's .br and .ft code cleanup; simpler.

7 years agoMove handling of the roff(7) .ft request from the man(7)
Ingo Schwarze [Fri, 5 May 2017 02:06:19 +0000 (02:06 +0000)]
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.

7 years agoStart roff formatter modules for HTML and termininal output,
Ingo Schwarze [Thu, 4 May 2017 22:16:09 +0000 (22:16 +0000)]
Start roff formatter modules for HTML and termininal output,
used by both the mdoc and man formatters, with the ultimate
goal of reducing code duplication between the two macro formatters.
Made possible by the parser unification.
Add the first formatting function (for the .br request).

7 years agoParser reorg:
Ingo Schwarze [Thu, 4 May 2017 17:48:28 +0000 (17:48 +0000)]
Parser reorg:
Generate the first node on the roff level: .br
Fix some column numbers in diagnostic messages while here.

7 years agoA few days ago, a patch from <G dot Branden dot Robinson at gmail dot com>
Ingo Schwarze [Mon, 1 May 2017 23:27:39 +0000 (23:27 +0000)]
A few days ago, a patch from <G dot Branden dot Robinson at gmail dot com>
got committed to groff which changed .TP from using .it to using .itc,
such that groff now supports more than one man(7) macro line in the .TP
head if all but the last line in the head end with \c.

Of course, relying on that behaviour is utterly non-portable, but if
authors are reckless enough to use that idiom, let's do what they want.

7 years agoWhen trying to expand some columns in a table where the sum of the
Ingo Schwarze [Mon, 1 May 2017 20:54:59 +0000 (20:54 +0000)]
When trying to expand some columns in a table where the sum of the
widths of the remaining columns is already wider than the line
length, underflowing size_t and dying from ENOMEM is the wrong plan.
Instead, simply refrain from expanding anything in such a situation,
avoiding a crash that tb@ found with afl.

7 years agoParser unification: use nice ohashes for all three request and macro tables;
Ingo Schwarze [Sat, 29 Apr 2017 12:45:41 +0000 (12:45 +0000)]
Parser unification: use nice ohashes for all three request and macro tables;
no functional change, minus two source files, minus 200 lines of code.

7 years agoDelete .Pp right before the first .Sh and right before any .Ss,
Ingo Schwarze [Fri, 28 Apr 2017 16:25:11 +0000 (16:25 +0000)]
Delete .Pp right before the first .Sh and right before any .Ss,
and warn about it; mdoclint(1) does so, and it makes sense.

7 years agoASCII characters that are special to roff
Ingo Schwarze [Thu, 27 Apr 2017 17:08:04 +0000 (17:08 +0000)]
ASCII characters that are special to roff

7 years agoDelete the manpage(1) utility.
Ingo Schwarze [Mon, 24 Apr 2017 23:32:00 +0000 (23:32 +0000)]
Delete the manpage(1) utility.
It was never enabled in any release, nor was a manual ever written.

In general, we want to simplify the user interface rather than
succumb to featurism.  Consequently, integrating manpage(1)
into the main binary would seem like a dubious direction.

7 years agoContinue parser unification:
Ingo Schwarze [Mon, 24 Apr 2017 23:06:17 +0000 (23:06 +0000)]
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[].

7 years agoMore thoroughly reject direct access to unintended files, such that
Ingo Schwarze [Wed, 19 Apr 2017 01:00:03 +0000 (01:00 +0000)]
More thoroughly reject direct access to unintended files, such that
URIs like http://man.openbsd.org/OpenBSD-current/mandoc.db and
http://man.openbsd.org/OpenBSD-current/man1/ do not cause display
of garbage.

7 years agoNow that global -i is gone, pass -i through to the apropos(1)
Ingo Schwarze [Tue, 18 Apr 2017 16:01:20 +0000 (16:01 +0000)]
Now that global -i is gone, pass -i through to the apropos(1)
expression parser, such that "apropos -i 'Nm~dump\>'"
finds kdump(1) and WCOREDUMP(2) and you don't need
to type the counter-intuitive "apropos -- -i 'Nm~dump\>'".

7 years agoDelete the undocumented and unimplemented man(1) -i (interactive
Ingo Schwarze [Tue, 18 Apr 2017 15:27:09 +0000 (15:27 +0000)]
Delete the undocumented and unimplemented man(1) -i (interactive
apropos) option.  It will not be implemented.  Featurism isn't the
plan for the future; simplicity is.

7 years agoThe apropos(1) manual still documents the unary -i operator for
Ingo Schwarze [Tue, 18 Apr 2017 15:06:49 +0000 (15:06 +0000)]
The apropos(1) manual still documents the unary -i operator for
regular expression search terms, but it appears that somewhere
along the way, the implementation got lost, so restore it.
Bug found while investigating other reports from Gonzalo Tornaria.

7 years agoFix previous: i forgot explicit NUL termination;
Ingo Schwarze [Tue, 18 Apr 2017 13:57:56 +0000 (13:57 +0000)]
Fix previous: i forgot explicit NUL termination;
noticed by Gonzalo <Tornaria at cmat dot edu dot uy>, thanks!

7 years agoRestore -kO Nd, -kO Nm, -kO sec, and -kO arch to working order.
Ingo Schwarze [Mon, 17 Apr 2017 20:05:08 +0000 (20:05 +0000)]
Restore -kO Nd, -kO Nm, -kO sec, and -kO arch to working order.
They got broken in the SQLite removal.
As opposed to the rest of -kO, they are no longer very useful,
but they are certainly not supposed to fail assertions.
Issue reported by Gonzalo Tornaria <tornaria at cmat dot edu dot uy>.

7 years agoadjust tests to recent .Lk improvements
Ingo Schwarze [Mon, 17 Apr 2017 13:37:40 +0000 (13:37 +0000)]
adjust tests to recent .Lk improvements

7 years agoimplement display of long .Lk URIs to match -Tascii
Ingo Schwarze [Mon, 17 Apr 2017 13:26:47 +0000 (13:26 +0000)]
implement display of long .Lk URIs to match -Tascii

7 years agoFix handling of trailing punctuation in .Lk.
Ingo Schwarze [Mon, 17 Apr 2017 12:53:29 +0000 (12:53 +0000)]
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).

7 years agoShow long .Lk URIs in like an indented display, similar to groff.
Ingo Schwarze [Fri, 14 Apr 2017 19:35:22 +0000 (19:35 +0000)]
Show long .Lk URIs in like an indented display, similar to groff.
Suggested by bentley@.

7 years agoDo not make the colon after the .Lk link text italic.
Ingo Schwarze [Fri, 14 Apr 2017 18:25:04 +0000 (18:25 +0000)]
Do not make the colon after the .Lk link text italic.
I just pushed the same change to GNU troff.

7 years agodelete documentation of some stuff that no longer exists,
Ingo Schwarze [Thu, 30 Mar 2017 22:22:05 +0000 (22:22 +0000)]
delete documentation of some stuff that no longer exists,
mostly about SQLite3; noticed by Jan Stary <hans at stare dor cz>

7 years agosimplify the SYNOPSIS as well, just like the option lists;
Ingo Schwarze [Mon, 27 Mar 2017 18:51:36 +0000 (18:51 +0000)]
simplify the SYNOPSIS as well, just like the option lists;
suggested by and OK jmc@

7 years agoFor some options that are rarely needed in mandoc(1),
Ingo Schwarze [Mon, 27 Mar 2017 15:17:11 +0000 (15:17 +0000)]
For some options that are rarely needed in mandoc(1),
delete the descriptions and point to man(1) instead.
Inspired by apropos.1 rev. 1.43.

7 years agoSimplify: mention at one place that -fkl override each other,
Ingo Schwarze [Mon, 27 Mar 2017 14:40:39 +0000 (14:40 +0000)]
Simplify: mention at one place that -fkl override each other,
rather than stating it separately for each option.
Suggested, OKed, and tweaked by jmc@.

7 years agoFor some options that are rarely needed in apropos(1) and man(1),
Ingo Schwarze [Sat, 25 Mar 2017 12:46:36 +0000 (12:46 +0000)]
For some options that are rarely needed in apropos(1) and man(1),
delete the verbose descriptions and point to man(1) and mandoc(1),
respectively, instead.  That shortens the pages and makes them
easier to read.
Tweaks and OK jmc@, based in part on ideas from tedu@.

7 years agosimplify description of -S and -w, point from EXIT STATUS
Ingo Schwarze [Wed, 22 Mar 2017 13:31:49 +0000 (13:31 +0000)]
simplify description of -S and -w, point from EXIT STATUS
to mandoc(1) for details, and remove duplicate .Xr to whatis(1);
OK jmc@

7 years agosimplify .Nd; to display manuals, use man(1) instead;
Ingo Schwarze [Tue, 21 Mar 2017 18:25:51 +0000 (18:25 +0000)]
simplify .Nd; to display manuals, use man(1) instead;
OK jmc@

7 years agodelete documentation of a hack that was removed years ago
Ingo Schwarze [Tue, 21 Mar 2017 18:06:12 +0000 (18:06 +0000)]
delete documentation of a hack that was removed years ago

7 years agoSilently ignore invalid -m input formats rather than erroring out.
Ingo Schwarze [Mon, 20 Mar 2017 14:32:24 +0000 (14:32 +0000)]
Silently ignore invalid -m input formats rather than erroring out.
As observed by Jan Stary <hans at stare dot cz>, this is useful such
that after 'alias man="man -m $HOME/man"', 'man -l foo.1' still works.
Simplify and shorten the description of -m, and use .Ic for macros.

7 years agominor issues found with mandoc -Tlint
Ingo Schwarze [Sat, 18 Mar 2017 19:56:01 +0000 (19:56 +0000)]
minor issues found with mandoc -Tlint

7 years agoCorrect description of MANPATH, and a few more improvements
Ingo Schwarze [Sat, 18 Mar 2017 19:51:19 +0000 (19:51 +0000)]
Correct description of MANPATH, and a few more improvements
to the ENVIRONMENT section; OK jmc@

7 years agoSimplify: write HTTP 303 redirects with relative locations.
Ingo Schwarze [Sat, 18 Mar 2017 16:48:24 +0000 (16:48 +0000)]
Simplify: write HTTP 303 redirects with relative locations.
Suggested by bentley@.

Delete the HTTP_HOST configuration variable that is now obsolete.

7 years agoBugfix: use SCRIPT_NAME for .Xr hyperlinks.
Ingo Schwarze [Sat, 18 Mar 2017 16:19:11 +0000 (16:19 +0000)]
Bugfix: use SCRIPT_NAME for .Xr hyperlinks.
Patch from <andreas at AndreasVoegele dot com>.

7 years agoDocument man(1) section selection priority,
Ingo Schwarze [Fri, 17 Mar 2017 17:24:41 +0000 (17:24 +0000)]
Document man(1) section selection priority,
and correct description of apropos(1) output search order.
Suggested by tb@.

7 years agoUpdate HISTORY and AUTHORS: we no longer use SQLite.
Ingo Schwarze [Fri, 17 Mar 2017 12:56:57 +0000 (12:56 +0000)]
Update HISTORY and AUTHORS: we no longer use SQLite.
Outdated information reported by an Anonymous Coward on undeadly.org.

7 years agoFix regression in mdoc_html.c 1.275, man_html 1.134:
Ingo Schwarze [Fri, 17 Mar 2017 12:10:16 +0000 (12:10 +0000)]
Fix regression in mdoc_html.c 1.275, man_html 1.134:
For .Sh, .Ss, .SH, .SS, only write selflink if an id could be constructed.
Crash reported by Raf Czlonka <rczlonka at gmail dot com>,
analysis of root cause by natano@

7 years agoIn URIs in apropos(1) result tables,
Ingo Schwarze [Wed, 15 Mar 2017 13:49:50 +0000 (13:49 +0000)]
In URIs in apropos(1) result tables,
only write the manpath if it does not match the default.

7 years agoMention the manual page name and section in the HTML page <title>.
Ingo Schwarze [Wed, 15 Mar 2017 13:18:53 +0000 (13:18 +0000)]
Mention the manual page name and section in the HTML page <title>.
Based on a patch from <Anton dot Lindqvist at gmail dot com>,
but simplified and also covering apropos(1) search results.

7 years agoMinimal support for deep linking into man(7) pages.
Ingo Schwarze [Wed, 15 Mar 2017 11:29:53 +0000 (11:29 +0000)]
Minimal support for deep linking into man(7) pages.
As the man(7) language does not provide semantic markup,
only .SH, .SS, and .UR become anchors for now.

7 years agoIt's annoying that people keep writing URIs including redundant parts
Ingo Schwarze [Wed, 15 Mar 2017 10:17:29 +0000 (10:17 +0000)]
It's annoying that people keep writing URIs including redundant parts
like "/OpenBSD-current/manN/".  To discourage that, let man.cgi(8)
redirect search form results to nice, concise URIs.

7 years agoSlightly increase widths calculated from string lengths (mainly
Ingo Schwarze [Tue, 14 Mar 2017 01:35:15 +0000 (01:35 +0000)]
Slightly increase widths calculated from string lengths (mainly
for .Bl -tag lists and SYNOPSIS .Nm blocks), such that the text
still fits even if it is printed in bold font.
This is an ugly band aid - but implementing font-dependent width
measurements would be a major project and even more difficult
for HTML than for PostScript.

Issue reported by Jan Stary <hans at stare dot cz>.

7 years agoPort ctags-style, less(1) :t internal searching from terminal output
Ingo Schwarze [Mon, 13 Mar 2017 20:22:18 +0000 (20:22 +0000)]
Port ctags-style, less(1) :t internal searching from terminal output
to HTML output.  For certain macros appearing at the beginning of .It
heads, write HTML id="..." attributes such that deep linking works.
Write HTML <a> attributes such that you can easily copy out link
targets with the mouse.  Try: http://man.openbsd.org/vmctl.8#create

Feature suggested by <guettliml at Thomas dash Guettler dot de>,
some details of the design and implementation by me.

7 years agoPrint title="..." in addition to id="..." attributes for macro keys
Ingo Schwarze [Mon, 13 Mar 2017 19:01:38 +0000 (19:01 +0000)]
Print title="..." in addition to id="..." attributes for macro keys
that can be searched for by apropos(1), such that you see the
semantic function in a tooltip when hovering with the mouse.

7 years agotest infinite recursion in eqn(7) "define" statements
Ingo Schwarze [Sat, 11 Mar 2017 16:04:18 +0000 (16:04 +0000)]
test infinite recursion in eqn(7) "define" statements

7 years agoImprove detection of recursive eqn(7) "define" statements:
Ingo Schwarze [Sat, 11 Mar 2017 15:43:04 +0000 (15:43 +0000)]
Improve detection of recursive eqn(7) "define" statements:
Do not only catch "define key 'key other stuff'",
but also "define key 'other stuff key'".
Fixing infinite loop found by tb@ with afl(1).

7 years agoIn markdown, autolinks are dangerous. Different compilers disagree
Ingo Schwarze [Sat, 11 Mar 2017 12:35:45 +0000 (12:35 +0000)]
In markdown, autolinks are dangerous.  Different compilers disagree
with respect to what constitutes a valid autolink, and if a compiler
deems an autolink invalid, the input turns into an unintended and
potentially harmful raw HTML tag.  So, never write autolinks.
Instead of <link>, write [link](link).
Instead of <addr>, write [addr](mailto:addr).

Issue pointed out by bentley@, who also agrees with the general
direction of the change.

7 years agoReally commit some files that failed to get committed in this commit:
Ingo Schwarze [Thu, 9 Mar 2017 15:33:40 +0000 (15:33 +0000)]
Really commit some files that failed to get committed in this commit:

Now that markdown output is tested for almost everything, test all
input files in -T markdown output mode by default and only mark
those files with SKIP_MARKDOWN that are not to be tested.
Much easier to read, and almost minus 40 lines of Makefile code.

7 years agoFix blunder in previous: we must keep the line parse buffer
Ingo Schwarze [Thu, 9 Mar 2017 15:29:35 +0000 (15:29 +0000)]
Fix blunder in previous:  we must keep the line parse buffer
consistent even when aborting the parsing of the line.  That buffer
is not our own, but owned and reused by mparse_buf_r(), read.c.
Returning without cleanup leaked memory and caused write overruns
of the old, typically much smaller buffer in mparse_buf_r().
Promptly noticed by tb@ with afl(1), using MALLOC_OPTIONS=C.

7 years agoNow that markdown output is tested for almost everything, test all
Ingo Schwarze [Wed, 8 Mar 2017 22:54:22 +0000 (22:54 +0000)]
Now that markdown output is tested for almost everything, test all
input files in -T markdown output mode by default and only mark
those files with SKIP_MARKDOWN that are not to be tested.
Much easier to read, and almost minus 40 lines of Makefile code.

7 years agoDocument that -T markdown produces ASCII output, and the implied
Ingo Schwarze [Wed, 8 Mar 2017 19:40:59 +0000 (19:40 +0000)]
Document that -T markdown produces ASCII output, and the implied
limitations.  Of course, we could write UTF-8 output instead,
but even the CommonMark specification doesn't require parsers
to support that, so portability would be doubtful.

While here, provide a link to the CommonMark specification.

7 years agoThe CommonMark specification wants that opening parentheses
Ingo Schwarze [Wed, 8 Mar 2017 19:23:43 +0000 (19:23 +0000)]
The CommonMark specification wants that opening parentheses
inside link destinations be escaped.
While here, remove the obsolete ESC_PAR.

7 years agoAccording to the CommonMark specification, backslash escapes
Ingo Schwarze [Wed, 8 Mar 2017 18:17:21 +0000 (18:17 +0000)]
According to the CommonMark specification, backslash escapes
and markdown markup do not work inside code spans.

7 years agoThe CommonMark specification allows list markers fo the form "number) "
Ingo Schwarze [Wed, 8 Mar 2017 17:51:58 +0000 (17:51 +0000)]
The CommonMark specification allows list markers fo the form "number) "
as well as "number. ", so escape closing parentheses after leading digits
to improve portability.

7 years agoDo not increment .Bl -enum list markers beyond two digits.
Ingo Schwarze [Wed, 8 Mar 2017 17:40:55 +0000 (17:40 +0000)]
Do not increment .Bl -enum list markers beyond two digits.
Otherwise, we would indent subsequent paragraphs less than
the CommonMark specification requires, harming portability.

7 years ago.Bl -column never gets blank lines between rows
Ingo Schwarze [Wed, 8 Mar 2017 15:08:36 +0000 (15:08 +0000)]
.Bl -column never gets blank lines between rows

7 years agoadd two result files that were forgotten
Ingo Schwarze [Wed, 8 Mar 2017 14:51:40 +0000 (14:51 +0000)]
add two result files that were forgotten

7 years agoenable -T markdown tests of filled displays and tagged lists
Ingo Schwarze [Wed, 8 Mar 2017 14:45:55 +0000 (14:45 +0000)]
enable -T markdown tests of filled displays and tagged lists

7 years agoAdd a blank after ">" when quoting.
Ingo Schwarze [Wed, 8 Mar 2017 14:30:06 +0000 (14:30 +0000)]
Add a blank after ">" when quoting.
If is allowed by markdown syntax and more human-readable.

7 years agoprevent infinite recursion while expanding the arguments
Ingo Schwarze [Wed, 8 Mar 2017 13:18:10 +0000 (13:18 +0000)]
prevent infinite recursion while expanding the arguments
of a user-defined macro; issue found by tb@ with afl(1)

7 years agoIf a user-defined macro is aborted because it exceeds the stack
Ingo Schwarze [Tue, 7 Mar 2017 20:00:08 +0000 (20:00 +0000)]
If a user-defined macro is aborted because it exceeds the stack
limit, usually due to infinite recursion, discard whatever remains
in all those open stack levels.  Otherwise, insane constructions
like the following could generate macros of enormous size, causing
mandoc(1) to die from memory exhaustion:

.de m  \" original macro definition
.m     \" recursion to blow up the stack
.de m  \" definition to be run during the call of .m marked (*)
very long plain text (some kilobytes)
.m     \" expand the above a thousand times while unwinding the stack
..     \" end of the original definition
.m     \" (*) recursively generate a ridiculously large macro
..     \" end of recursively generated definition
.m     \" execute the giant macro, exhausting memory

Very creative abuse found by tb@ with afl(1).

7 years agoEscape blanks at the end of markdown lines
Ingo Schwarze [Tue, 7 Mar 2017 15:31:24 +0000 (15:31 +0000)]
Escape blanks at the end of markdown lines
such that they don't look like output line breaks.

7 years agofix completely empty .Eo: no blank line wanted
Ingo Schwarze [Tue, 7 Mar 2017 14:04:08 +0000 (14:04 +0000)]
fix completely empty .Eo: no blank line wanted

7 years agofix spacing after empty .Fl
Ingo Schwarze [Tue, 7 Mar 2017 13:28:02 +0000 (13:28 +0000)]
fix spacing after empty .Fl

7 years agoimplement .An -split and -nosplit
Ingo Schwarze [Tue, 7 Mar 2017 13:09:27 +0000 (13:09 +0000)]
implement .An -split and -nosplit

7 years agoFix .In formatting in the SYNOPSIS:
Ingo Schwarze [Tue, 7 Mar 2017 12:39:01 +0000 (12:39 +0000)]
Fix .In formatting in the SYNOPSIS:
No &zwnj; in the middle of **, please.

7 years agoUsing .Nd only makes sense in the NAME section.
Ingo Schwarze [Mon, 6 Mar 2017 17:26:04 +0000 (17:26 +0000)]
Using .Nd only makes sense in the NAME section.
Warn if that macro occurs elsewhere.
Triggered by a question from Dag-Erling Smoergrav <des @ FreeBSD>.

7 years agoURIs need different escaping; reported by reyk@
Ingo Schwarze [Mon, 6 Mar 2017 14:58:10 +0000 (14:58 +0000)]
URIs need different escaping; reported by reyk@

7 years agofirst batch of -T markdown tests
Ingo Schwarze [Sun, 5 Mar 2017 19:59:33 +0000 (19:59 +0000)]
first batch of -T markdown tests

7 years agoInfrastructure for -T markdown tests.
Ingo Schwarze [Sun, 5 Mar 2017 19:57:39 +0000 (19:57 +0000)]
Infrastructure for -T markdown tests.

This is needed because -T marksdown is expected to receive less
maintenance than -T ascii, so we need automation to make sure
that regular parser maintenance doesn't break this output mode.

7 years agoRemove a redundant condition in .%T handling, no functional change.
Ingo Schwarze [Sat, 4 Mar 2017 21:41:29 +0000 (21:41 +0000)]
Remove a redundant condition in .%T handling, no functional change.
Found by jsg@ with scan-build.

7 years agoMake the description of -K autodetection easer to understand.
Ingo Schwarze [Sat, 4 Mar 2017 17:17:34 +0000 (17:17 +0000)]
Make the description of -K autodetection easer to understand.
Basic idea suggested by jmc@, OK jmc@.

7 years agoDebian needs relative symlinks not only for manual pages,
Ingo Schwarze [Sat, 4 Mar 2017 16:36:29 +0000 (16:36 +0000)]
Debian needs relative symlinks not only for manual pages,
but also for program files.
Issue reported by Michael <Stapelberg at debian dot org>
and by Markus <Waldeck at gmx dot de>.

7 years agoMarkdown output mode helped us to find the first parser bug (as such,
Ingo Schwarze [Fri, 3 Mar 2017 15:05:48 +0000 (15:05 +0000)]
Markdown output mode helped us to find the first parser bug (as such,
this bug could cause wrong output in other modes as well):
Do not misinterpret tab characters as .Ta macros when they appear
on non-column .It lines in non-column .Bl lists that are nested
inside a parent .Bl -column list.  (Admittedly, such constructions
are not very useful; don't use them!)
Found by tb@ with afl(1) because the resulting tree corruption
triggered an assertion in the markdown output module.

7 years agonew -mdoc -Tmarkdown output mode; OK millert@ reyk@ tb@;
Ingo Schwarze [Fri, 3 Mar 2017 14:23:23 +0000 (14:23 +0000)]
new -mdoc -Tmarkdown output mode; OK millert@ reyk@ tb@;
thanks to reyk@ and to Vsevolod at FreeBSD for suggesting it

7 years agoremove a few redundant conditions that jsg@ found with cppcheck
Ingo Schwarze [Fri, 3 Mar 2017 13:55:31 +0000 (13:55 +0000)]
remove a few redundant conditions that jsg@ found with cppcheck

7 years agoFix a copy-and-paste error that caused man(7) manuals without
Ingo Schwarze [Fri, 3 Mar 2017 13:41:42 +0000 (13:41 +0000)]
Fix a copy-and-paste error that caused man(7) manuals without
a section number in .TH to be misinterpreted as preformatted.
Found by jsg@ with cppcheck.