summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-06-12 11:41:50 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-06-12 11:41:50 +0000
commit16173bda3531a2bb54b45b2e327c8b7e2cf37fd6 (patch)
treef56dca9a70f2620b119aa051dbc980a7576967bf
parentdfe0c6ee455f4a355885a711c81c5ae06ac20160 (diff)
downloadmandoc-16173bda3531a2bb54b45b2e327c8b7e2cf37fd6.tar.gz
Removed stipulation that an empty `Bd -offset' will default to 6n. Not
sure where this came about. Added regression tests to convince myself that this is so. Also consolidated COMPATIBILITY notes regarding `Bd'. Added COMPATIBILITY note to the effect that old groff pukes on `Bd -compact -ragged' (regression test will fail on old groff).
-rw-r--r--main.c1
-rw-r--r--mandoc.h2
-rw-r--r--mdoc.725
-rw-r--r--mdoc_validate.c19
-rw-r--r--regress/mdoc/Bd/bd-compact.in33
-rw-r--r--regress/mdoc/Bd/bd-empty-offset.in31
-rw-r--r--regress/mdoc/Cd/cd.in2
7 files changed, 80 insertions, 33 deletions
diff --git a/main.c b/main.c
index f8e2e99f..1996712b 100644
--- a/main.c
+++ b/main.c
@@ -109,6 +109,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"unterminated quoted string",
"argument requires the width argument",
"superfluous width argument",
+ "ignoring argument",
"bad date argument",
"bad width argument",
"unknown manual section",
diff --git a/mandoc.h b/mandoc.h
index 83154f0d..74fc3a27 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -36,7 +36,9 @@ enum mandocerr {
MANDOCERR_BADESCAPE, /* bad escape sequence */
MANDOCERR_BADQUOTE, /* unterminated quoted string */
MANDOCERR_NOWIDTHARG, /* argument requires the width argument */
+ /* FIXME: merge with MANDOCERR_IGNARGV. */
MANDOCERR_WIDTHARG, /* superfluous width argument */
+ MANDOCERR_IGNARGV, /* macro ignoring argv */
MANDOCERR_BADDATE, /* bad date argument */
MANDOCERR_BADWIDTH, /* bad width argument */
MANDOCERR_BADMSEC, /* unknown manual section */
diff --git a/mdoc.7 b/mdoc.7
index f2c03c53..1a25d73f 100644
--- a/mdoc.7
+++ b/mdoc.7
@@ -1094,10 +1094,7 @@ As a scaling unit following the syntax described in
As the calculated string length of the opaque string.
.El
.Pp
-If unset, it will revert to the value of
-.Ar 8n
-as described in
-.Sx Scaling Widths .
+If not provided an argument, it will be ignored.
.It Fl compact
Do not assert a vertical space before the block.
.It Fl file Ar file
@@ -2169,11 +2166,8 @@ Heirloom troff, the other significant troff implementation accepting
.Pp
.Bl -dash -compact
.It
-groff supports a
-.Fl file Ar filename
-argument to
-.Sx \&Bd .
-mandoc does not.
+Old groff fails to assert a newline before
+.Sx \&Bd Fl ragged compact .
.It
groff behaves inconsistently when encountering
.Pf non- Sx \&Fa
@@ -2249,16 +2243,15 @@ In quoted literals, groff allowed pair-wise double-quotes to produce a
standalone double-quote in formatted output.
This idiosyncratic behaviour is not applicable in mandoc.
.It
-Display types
+Display offsets
.Sx \&Bd
-.Fl center
+.Fl offset Ar center
and
-.Fl right
-are aliases for
-.Fl left
-in mandoc. Furthermore, the
+.Fl offset Ar right
+are disregarded in mandoc.
+Furthermore, the
.Fl file Ar file
-argument is ignored.
+argument is not supported in mandoc.
Lastly, since text is not right-justified in mandoc (or even groff),
.Fl ragged
and
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 10316fc4..ed0a4c25 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -731,23 +731,8 @@ pre_bd(PRE_ARGS)
dup = (NULL != n->data.Bd.offs);
break;
}
- /*
- * If empty, assign it to a sane default, which
- * groff stipulates is about 8n.
- */
- /*
- * FIXME: remove this.
- *
- * Where the hell did I get the idea that this
- * happens?
- */
- assert(1 == n->args->refcnt);
- n->args->argv[i].sz++;
- n->args->argv[i].value =
- mandoc_malloc(sizeof(char *));
- n->args->argv[i].value[0] =
- mandoc_strdup("8n");
- offs = n->args->argv[i].value[0];
+ if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_IGNARGV))
+ return(0);
break;
case (MDOC_Compact):
comp = 1;
diff --git a/regress/mdoc/Bd/bd-compact.in b/regress/mdoc/Bd/bd-compact.in
new file mode 100644
index 00000000..a6cf21db
--- /dev/null
+++ b/regress/mdoc/Bd/bd-compact.in
@@ -0,0 +1,33 @@
+.Dd $Mdocdate$
+.Dt FOO 1
+.Os
+.Sh NAME
+.Nm foo
+.Nd bar
+.Sh DESCRIPTION
+1
+.Bd -literal -compact
+a b
+c d
+.Ed
+2
+1
+.Bd -filled -compact
+a b
+c d
+.Ed
+2
+3
+.\" NOTE: OLD GROFF WILL PUKE HERE, AS IT BUGGILY FORGETS TO EMIT A
+.\" NEWLINE BEFORE THE DISPLAY.
+.Bd -ragged -compact
+a b
+c d
+.Ed
+2
+1
+.Bd -unfilled -compact
+a b
+c d
+.Ed
+2
diff --git a/regress/mdoc/Bd/bd-empty-offset.in b/regress/mdoc/Bd/bd-empty-offset.in
new file mode 100644
index 00000000..1bb6126c
--- /dev/null
+++ b/regress/mdoc/Bd/bd-empty-offset.in
@@ -0,0 +1,31 @@
+.Dd $Mdocdate$
+.Dt FOO 1
+.Os
+.Sh NAME
+.Nm foo
+.Nd bar
+.Sh DESCRIPTION
+1
+.Bd -literal -offset
+a b
+c d
+.Ed
+2
+1
+.Bd -filled -offset
+a b
+c d
+.Ed
+2
+1
+.Bd -ragged -offset
+a b
+c d
+.Ed
+2
+1
+.Bd -unfilled -offset
+a b
+c d
+.Ed
+2
diff --git a/regress/mdoc/Cd/cd.in b/regress/mdoc/Cd/cd.in
index 82e6b0a8..d966aa45 100644
--- a/regress/mdoc/Cd/cd.in
+++ b/regress/mdoc/Cd/cd.in
@@ -9,6 +9,8 @@
.Cd "it* at isa? port 0x2e"
.Cd "it* at isa? port 0x2e"
.Sh DESCRIPTION
+.\" OLD GROFF WILL PUKE ON THIS PART, RENDERING IT JUST AS IT WAS
+.\" RENDERED IN THE SYNOPSIS.
.Cd "it* at isa? port 0x2e"
.Cd "it* at isa? port 0x2e"
.Cd "it* at isa? port 0x2e"