Allow `.xx\}' where xx is a macro (e.g., `.br\}') to close scope. This is
experimental and hasn't been rigorously tested. It's only implemented in
-mdoc for the time being. This is absolutely required for pod2man. It
does, however, make the pod2man preamble be processed in full.
Handle nested, recursive mathematical subexpressions. This is
definitely not general, but it's good enough for pod2man definitions
(after I clean up the roff, which will be addressed in later fixes).
Ingo Schwarze [Sat, 21 Aug 2010 14:04:13 +0000 (14:04 +0000)]
Backout previous.
As Kristaps found out, i was wrong: .Bl -column phrases do not ignore
spacing rules for trailing punctuation in general. In particular,
- the rightmost column of a column list is unaffected
- columns terminated by the .Ta macro instead of a tab are unaffected
- columns ending in a blank are unaffected
Spacing rules for trailing punctuation are only ignored when the tab
follows the punctuation immediately, without a blank in between,
because then the combination of punctuation and tab is treated by roff
as a word, and the punctuation is not recognized as isolated.
The reason this doesn't work in mandoc is that in the special case
of .Bl -column (not in general!), mandoc treats tabs as word delimiters.
We either need to solve this differently, or call it a bug in roff.
Ingo Schwarze [Fri, 20 Aug 2010 23:22:09 +0000 (23:22 +0000)]
When a column contains trailing spaces, calculate the padding
to the start of the next column correctly.
Fixing a problem found by jmc@ in sysctl(3), reminded by kettenis@.
Ingo Schwarze [Fri, 20 Aug 2010 22:51:29 +0000 (22:51 +0000)]
.Bl -column phrases ignore spacing rules for trailing punctuation
and render it just like normal text.
Minimal fix of a formatting bug in operator(7) reported by ray@.
Ingo Schwarze [Fri, 20 Aug 2010 01:02:07 +0000 (01:02 +0000)]
Implement a simple, consistent user interface for error handling.
We now have sufficient practical experience to know what we want,
so this is intended to be final:
- provide -Wlevel (warning, error or fatal) to select what you care about
- provide -Wstop to stop after parsing a file with warnings you care about
- provide consistent exit status codes for those warnings you care about
- fully document what warnings, errors and fatal errors mean
- remove all other cruft from the user interface, less is more:
- remove all -f knobs along with the whole -f option
- remove the old -Werror because calling warnings "fatal" is silly
- always finish parsing each file, unless fatal errors prevent that
This commit also includes a couple of related simplifications behind
the scenes regarding error handling.
Feedback and OK kristaps@; Joerg Sonnenberger (NetBSD) and
Sascha Wildner (DragonFly BSD) agree with the general direction.
Remove \*(C+ from the pre-predefined strings. It is always `ds'-defined
when being used in manuals. Since we now support `ds', it's no longer
necessary to account for it. From a bug report originally by Thomas
Jeunet.
Add \v and \h to ignored escapes. These are in the category of \s.
Also made sign-less \s-style escapes be ok (this is technically against
what's in the groff.7 manual, but seems pretty widespread). Noted by
Thomas Jeunet as uglifying the gcc.1 manual.
Ingo Schwarze [Sun, 8 Aug 2010 14:51:32 +0000 (14:51 +0000)]
simplify the code copying the macro name, and sync the
accompagnying comment between man_pmacro() and mdoc_pmacro();
ok'd by kristaps@ together with main.c rev. 1.102
Ingo Schwarze [Sun, 8 Aug 2010 14:45:59 +0000 (14:45 +0000)]
Make sure we really throw away non-ASCII characters.
For example, on OpenBSD without locale settings,
isgraph(3) returns true for some eight-bit characters.
ok kristaps@
Clean out the isgraph() checks in mdoc.c and man.c. These code paths
were never taken since main.c begin skipping over unrecognisable
characters, so they were noops.
"Groff allows the initial macro on a line to be delimited by a space of
by a tab; so allow the tab in mandoc, too." Original problem noted by
schwarze@. Sync with OpenBSD.
Ingo Schwarze [Fri, 6 Aug 2010 17:09:58 +0000 (17:09 +0000)]
tweaks from jmc@:
* correct a few obvious mistakes
* adopt some of jmc@'s recent changes to man(7)
* cut down just a little on the awful tendency
to stick a hyphen between two words.
Ingo Schwarze [Fri, 6 Aug 2010 17:07:11 +0000 (17:07 +0000)]
merge from OpenBSD:
- HISTORY is interesting even when there are STANDARDS
- more precise instructions what to put into AUTHORS
- add the version argument to the mdoc(7) .Os macro
IMPORTANT FIX: add missing braces around alloc failure conditional in
fuction-isation of PS_GROWBUF. Obviously the original commit was never
actually tested, as -Tps and -Tpdf errored out immediately.
Fix `ds' handling. This was stripping characters from "val", when the
syntax of `ds' is such that ALL text following the first
non-space/non-double-quote is part of the value. This also fixes the
warning of *(string++) = NULL report by kristaps@ and joerg@.
Fix how `Bd -unfilled' and `Bd -literal' break lines. This unbreaks
displays to work as old groff shows them; however, new groff still does
some fancy shit.
Clean up some tight spots in mandoc's default mode: pessimistically
pre-allocate the output buffer for words and in-line the buffera()
function, which was only called in one place anyway.
Remove asciisz from chars.in. It frees up a nice chunk of memory and at
the overhead of running strlen() for ASCII strings (yes, I benchmarked
this running mandoc_char(7) as input again and again with
hundredth-second penalties... on my slow-ass alpha).
Initial PDF shim over PS. This produces working PDF output with -Tpdf.
It's currently missing the xref table, so you'll get a warning in most
PDF viewers). It also produces lots of redundant output, which will go
away once I get a better handle on the PDF spec. The code doesn't
really touch any existing functionality; it's a bunch of conditionals
atop the -Tps (term_ps.c) implementation. I'm checking it in now to
have it exist and be auditable. It needs clean-up, polish, and general
care (and xref!).
Bring `sp', `Sp', and `br' behaviour for -man in line with how -mdoc's
is handled: correctly. This removes superfluous line breaks in many
-man manuals.
Have `nf' and `fi' flush lines. This is necessary or the LITERAL will
be meaningless when invoked within a non-flushing context. This based
on a formatting bug report submitted by Jonathon Gray (jsg@) via
Christian Weisgerber (naddy@).
In the SYNOPSIS, .Nm at the beginning of an input line starts
an .Nm block, and gets special handling (new line, indentation).
But .Nm in the middle of a line is just a normal in-line element,
so make sure it does NOT get the special handling.
Partly fixes the test(1) SYNOPSIS; indentation after "[" is still
excessive, which is an unrelated and more difficult issue.
Reminded of the problem by jmc@;
OK kristaps@.
Accomodate for groff's crappy behaviour wherein an unrecognised
single-character escape (and ONLY this type of escape) will map back
into itself:
"If a backslash is followed by a character that does not
constitute a defined escape sequence the backslash is silently
ignored and the character maps to itself."
Strip non-graphable input characters from input. The manuals
specifically say that this is not allowed, and were it allowed, output
would be inconsistent across output media (-Tps will puke,
non-your-charset terminals will puke, etc.).
With this done, simplify check_text() to only check escapes and for
tabs. Add in a new tab warning, too.
sync to OpenBSD:
* briefly mention the HISTORY of the man(7) language
* update the copyright notice
* improve the wording in a few places
* fix a couple of typos
including two suggestions from J.C. Roberts
feedback and ok jmc@, ok sobrado@ and kristaps@