Ingo Schwarze [Sun, 11 Jun 2017 14:24:55 +0000 (14:24 +0000)]
Do not issue the message "no blank before trailing delimiter" for .No.
In practice, that message only matters inside .Bf, and even there, it
can occasionally be a false positive. In all other cases, it usually
is a false positive, so it is better to drop it outright.
Suggested by jmc@.
Ingo Schwarze [Thu, 8 Jun 2017 18:11:22 +0000 (18:11 +0000)]
Implement w layout specifier (minimum column width).
Improve width calculation of text blocks.
Reduces the groff/mandoc diff in Base+Xenocara by about 800 lines.
Ingo Schwarze [Wed, 7 Jun 2017 20:58:49 +0000 (20:58 +0000)]
Also catch "new sentence, new line" if there are three blanks
between the sentences. Thomas Klausner says he has seen some
of these, and i don't see any false positives.
Ingo Schwarze [Wed, 7 Jun 2017 20:30:40 +0000 (20:30 +0000)]
Make "new sentence, new line" detection stricter:
Also catch cases where the new sentence starts with a one-letter word
and the input line is broken right after that word.
Suggested by Thomas Klausner <wiz @ NetBSD>.
It's merely a three-bit diff, changing one byte from 0x34 to 0x33,
so what can possibly go wrong...
Ingo Schwarze [Wed, 7 Jun 2017 20:01:19 +0000 (20:01 +0000)]
Prepare the terminal driver for filling multiple columns in parallel,
second step: make the per-column byte pointer persistent across
term_flushln() calls, such that a subsequent call can continue at
the point where the previous call left. If more than one column
is in use, return from term_flushln() when the column is full,
rather than breaking the output line.
No functional change, because nothing sets up multiple columns yet.
Ingo Schwarze [Wed, 7 Jun 2017 17:38:26 +0000 (17:38 +0000)]
Prepare the terminal driver for filling multiple columns in parallel,
first step: split column data out of the terminal state struct into
a new column state struct and use an array of such column state
structs. No functional change.
Ingo Schwarze [Wed, 7 Jun 2017 02:14:09 +0000 (02:14 +0000)]
The \h escape sequence provides another method for moving backwards,
and after that, previously written output gets overwritten, but
overwriting with blanks does *not* erase previously written content.
Yes, manual pages exist that are crazy enough to rely on that...
Ingo Schwarze [Wed, 7 Jun 2017 00:50:34 +0000 (00:50 +0000)]
Implement the roff(7) .rn (rename macro or string) request.
Renaming a user-defined macro is very simple: just copy
the definition to the new name and delete the old name.
Renaming high-level macros is a bit tricky: use a dedicated
key-value-table, with non-standard names as keys and standard
names as values. When a macro is found that is not user-defined,
look it up in the "renamed" table and translate it back to the
standard name before passing it on to the high-level parsers.
Ingo Schwarze [Tue, 6 Jun 2017 15:01:04 +0000 (15:01 +0000)]
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.
Ingo Schwarze [Sun, 4 Jun 2017 22:44:15 +0000 (22:44 +0000)]
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.
Ingo Schwarze [Sun, 4 Jun 2017 18:50:35 +0000 (18:50 +0000)]
Make term_flushln() simpler and more robust:
Eliminate the "overstep" state variable.
The information is already contained in "viscol".
Minus 60 lines of code, no functional change intended.
Ingo Schwarze [Sun, 4 Jun 2017 00:13:15 +0000 (00:13 +0000)]
Pure preprocessor implementation of the roff(7) .ec and .eo requests
(escape character control), touching nothing after the preprocessing
stage and keeping even the state variable local to the preprocessor.
Since the escape character is also used for line continuation, this
requires pulling the implementation of line continuation from the
input reader to the preprocessor, which also considerably shortens
the code required for that.
When the escape character is changed, simply let the preprocessor
replace bare by escaped backslashes and instances of the non-standard
escape character with bare backslashes - that's all we need.
Oh, and if anybody dares to use these requests in OpenBSD manuals,
sending a medium-sized pack of axe-murderers after them might be a
worthwhile part of the punishment, but probably insuffient on its own.
Ingo Schwarze [Fri, 2 Jun 2017 19:21:23 +0000 (19:21 +0000)]
Partial implementation of \h (horizontal line drawing function).
A full implementation would require access to output device properties
and state variables (both only available after the main parser has
finalized the parse tree) before numerical expansions in the roff
preprocessor (i.e., before the main parser is even started).
Not trying to pull that stunt right now because the static-width
implementation committed here is sufficient for tcl-style manual pages
and already more complicated than i would have suspected.
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.
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).
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.
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.
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.
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.
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%.
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@.
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.
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.
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@.
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.
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).
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.
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.
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.
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[].
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.
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\>'".
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.
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.
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>.
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).
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@.
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.
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@
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.
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.
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.
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>.
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.