Ingo Schwarze [Sat, 2 Oct 2010 15:15:55 +0000 (15:15 +0000)]
style cleanup, no functional change:
* make the initial maxvis/mmax calculation easier to understand
* where real, non-indexing casts happen, make them explicit
* avoid a few lint warnings that can easily be fixed
* remove one needless LINTED comment
"I like this" kristaps@
Unify mdoc and man enums and structs into mandoc.h. This is part of the
slow process of logically splitting formatting frontend and parser backend
without pollution.
Ingo Schwarze [Fri, 1 Oct 2010 21:51:13 +0000 (21:51 +0000)]
* need a space before .No even if it starts with a closing delimiter
* slightly simplify .Pf *_IGNDELIM code, and share part of it with .No
* do not let opening delimiters fall out of the front of .Ns (from kristaps@)
This fixes a few spacing issues in csh(1) and ksh(1).
OK kristaps@
Merge from OpenBSD right after 1.10.6; now back to full sync.
* mdoc.c: blank lines outside literal mode are more similar to .sp than .Pp
* backslashes do not terminate macros; partial revert of mdoc.c 1.164;
the intention of that commit is fully achieved in roff.c
* mdoc_term.c: no need to list the same prototype twice
* mdoc_validate.c: drop .Pp before .sp just like .Pp before .Pp
* fix off-by-one found by jsg@ with parfait, OpenBSD term_ps.c 1.12
ok kristaps@
If an explicit scope is still open at the end of an input file,
report an ERROR: We can still render the page by just closing
the open scope, but it is likely that information will be missing
or document structure mangled.
Before, man(7) only reported a WARNING (which is dangerous because
we cannot be sure rendering is correct) and mdoc(7) ran into FATAL
(which is too drastic, there is no reason not to show what we have).
"looks good" kristaps@
sync to OpenBSD:
note that IMPLEMENTATION NOTES is not used in OpenBSD
add missing comma in "sections 1, 6, & 8 only" below EXIT STATUS
below SEE ALSO, add an .Xr to man(1), and from man(7) to mdoc(7)
Big clean-up consolidating all punctuation opening/closing functions into
a single one. This makes code auditing easier and cuts down on
bytesize.
I also removed some NOSPACE clauses that were handled implicitly by the
punctuation itself, e.g., a NOSPACE prior to printing ')', which in
term.c has its leading whitespace automatically suppressed.
A `%T' invoked outside of `Rs' should not produce trailing punctuation.
This from a TODO entry. Also stripped the superfluous NOSPACE, which is
handled in term_word() or print_text() anyway.
When the HEAD of an .Nm block in the SYNOPSIS might be wider
than the column containing it, the TERMP_HANG flag is required,
but avoid the flag when we know that the HEAD is shorter,
because in that case, the flag might ruin the alignment.
Problem originally reported by jmc@, who also spotted a regression
in an earlier version of this patch.
Allow string lengths to account for escapes. Now all calls to calculate
column width in -Tascii, -Tpdf, and -Tps will account for "more real"
string lengths.
Remove last pod2man escapes. These render ok, although \*(-- renders as
O- because the underlying macro depends on \(*W, which a prior pod2man
preamble `tr' macro rewrites as "-". This is an error in groff as this
tramples on the real \(*W, or Greek omega.
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.