aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit9e1c8c4504be3ee8555871134f21b59fba7bd8ac (patch)
treef962a1dc9d54009b312c3de97f2013da79ae5c9f
parentaf1a16ee46c535e7e97fe26fc4c6c05844de41e2 (diff)
downloadmandoc-9e1c8c4504be3ee8555871134f21b59fba7bd8ac.tar.gz
mandoc-9e1c8c4504be3ee8555871134f21b59fba7bd8ac.tar.zst
mandoc-9e1c8c4504be3ee8555871134f21b59fba7bd8ac.zip
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.c3
-rw-r--r--mandoc.h4
-rw-r--r--mdoc.727
-rw-r--r--mdoc_validate.c21
-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.in4
7 files changed, 85 insertions, 38 deletions
diff --git a/main.c b/main.c
index d397d3dd..0c014da1 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.87 2010/06/12 10:09:19 kristaps Exp $ */
+/* $Id: main.c,v 1.88 2010/06/12 11:41:50 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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 d8c25cf2..2fc74676 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.11 2010/06/12 10:09:19 kristaps Exp $ */
+/* $Id: mandoc.h,v 1.12 2010/06/12 11:41:50 kristaps Exp $ */
/*
* Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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 c52dae19..bc5f1ee3 100644
--- a/mdoc.7
+++ b/mdoc.7
@@ -1,4 +1,4 @@
-.\" $Id: mdoc.7,v 1.125 2010/06/12 10:09:19 kristaps Exp $
+.\" $Id: mdoc.7,v 1.126 2010/06/12 11:41:50 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
@@ -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 59e3d79c..ad7b6418 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.94 2010/06/12 11:21:44 kristaps Exp $ */
+/* $Id: mdoc_validate.c,v 1.95 2010/06/12 11:41:50 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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..ec2e036b
--- /dev/null
+++ b/regress/mdoc/Bd/bd-compact.in
@@ -0,0 +1,33 @@
+.Dd $Mdocdate: June 12 2010 $
+.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..11f20db9
--- /dev/null
+++ b/regress/mdoc/Bd/bd-empty-offset.in
@@ -0,0 +1,31 @@
+.Dd $Mdocdate: June 12 2010 $
+.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 cce3c661..fc1d4e7d 100644
--- a/regress/mdoc/Cd/cd.in
+++ b/regress/mdoc/Cd/cd.in
@@ -1,4 +1,4 @@
-.Dd $Mdocdate: June 7 2010 $
+.Dd $Mdocdate: June 12 2010 $
.Dt FOO 1
.Os
.Sh NAME
@@ -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"