summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-06-07 11:01:15 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-06-07 11:01:15 +0000
commit6a6afd0cbfd5a9b6b666e7adc6f2aaa52f1019eb (patch)
treef87c522067c7f7dcd77cdef6afa2d5a1d030aec6
parent98d6618adfd9bb24eeecfc2dba7aa4653c592e10 (diff)
downloadmandoc-6a6afd0cbfd5a9b6b666e7adc6f2aaa52f1019eb.tar.gz
mandoc-6a6afd0cbfd5a9b6b666e7adc6f2aaa52f1019eb.tar.zst
mandoc-6a6afd0cbfd5a9b6b666e7adc6f2aaa52f1019eb.zip
Normalise SYNOPSIS behaviour after I gave up on following groff's
inconsistent behaviour. In short: Some macros are displayed differently in the SYNOPSIS section, particularly Nm, Cd, Fd, Fn, Fo, In, Vt, and Ft. All of these macros are output on their own line. If two such dissimilar macros are pair-wise invoked (except for Ft before Fo or Fn), they are separated by a vertical space, unless in the case of Fo, Fn, and Ft, which are always separated by vertical space. Behaviour ok Jason McIntyre, ingo@. Fallout will be treated case-by-case. I had to clear out some regressions that were testing against groff's stranger behaviours: these will now break, as we don't care about such invocations. Also removed the newline for `Cd' invocation in a non-SYNOPSIS context.
-rw-r--r--mdoc.795
-rw-r--r--mdoc_html.c128
-rw-r--r--mdoc_term.c168
-rw-r--r--regress/mdoc/Cd/cd.in14
-rw-r--r--regress/mdoc/Fd/fd.in22
-rw-r--r--regress/mdoc/Fn/fn1.in21
-rw-r--r--regress/mdoc/Fo/fo0.in32
-rw-r--r--regress/mdoc/Ft/ft0.in25
-rw-r--r--regress/mdoc/In/in.in24
9 files changed, 220 insertions, 309 deletions
diff --git a/mdoc.7 b/mdoc.7
index b6c2b35b..a16b3b1b 100644
--- a/mdoc.7
+++ b/mdoc.7
@@ -1,4 +1,4 @@
-.\" $Id: mdoc.7,v 1.121 2010/06/06 22:25:56 kristaps Exp $
+.\" $Id: mdoc.7,v 1.122 2010/06/07 11:01:15 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: June 6 2010 $
+.Dd $Mdocdate: June 7 2010 $
.Dt MDOC 7
.Os
.Sh NAME
@@ -333,8 +333,11 @@ must be the NAME section, consisting of at least one
followed by
.Sx \&Nd .
.Pp
-Following that, convention dictates specifying at least the SYNOPSIS and
-DESCRIPTION sections, although this varies between manual sections.
+Following that, convention dictates specifying at least the
+.Em SYNOPSIS
+and
+.Em DESCRIPTION
+sections, although this varies between manual sections.
.Pp
The following is a well-formed skeleton
.Nm
@@ -450,13 +453,31 @@ And for the third, configurations (section 4):
Manuals not in these sections generally don't need a
.Em SYNOPSIS .
.Pp
-See
-.Sx \&Op ,
+Some macros are displayed differently in the
+.Em SYNOPSIS
+section, particularly
+.Sx \&Nm ,
.Sx \&Cd ,
+.Sx \&Fd ,
.Sx \&Fn ,
-.Sx \&Ft ,
+.Sx \&Fo ,
+.Sx \&In ,
+.Sx \&Vt ,
and
-.Sx \&Vt .
+.Sx \&Ft .
+All of these macros are output on their own line. If two such
+dissimilar macros are pair-wise invoked (except for
+.Sx \&Ft
+before
+.Sx \&Fo
+or
+.Sx \&Fn ) ,
+they are separated by a vertical space, unless in the case of
+.Sx \&Fo ,
+.Sx \&Fn ,
+and
+.Sx \&Ft ,
+which are always separated by vertical space.
.It Em DESCRIPTION
This expands upon the brief, one-line description in
.Em NAME .
@@ -1656,6 +1677,8 @@ This usage has been deprecated in favour of
Do not use this macro.
.Pp
See also
+.Sx MANUAL STRUCTURE
+and
.Sx \&In .
.Ss \&Fl
Command-line flag.
@@ -1685,10 +1708,7 @@ Its syntax is as follows:
.Op Oo Cm argtype Oc Cm argname
.Ed
.Pp
-If invoked in the
-.Em SYNOPSIS
-section, vertical space is asserted before and after the macro.
-In all cases, the function arguments are surrounded in parenthesis and
+Function arguments are surrounded in parenthesis and
are delimited by commas.
If no arguments are specified, blank parenthesis are output.
.Pp
@@ -1702,9 +1722,7 @@ Examples:
.Ed
.Pp
See also
-.Sx \&Fa ,
-.Sx \&Fo ,
-.Sx \&Fc ,
+.Sx MANUAL STRUCTURE
and
.Sx \&Ft .
.Ss \&Fo
@@ -1728,42 +1746,21 @@ Invocations usually occur in the following context:
.Pf \. Sx \&Fc
.Ed
.Pp
-In the
-.Em SYNOPSIS
-section, a
-.Sx \&Fo
-block is surrounded by vertical space unless
-.Sx \&Ft
-is the prior macro, in which case it is preceded by only a newline.
-.Pp
A
.Sx \&Fo
scope is closed by
.Pp
See also
+.Sx MANUAL STRUCTURE ,
.Sx \&Fa ,
.Sx \&Fc ,
and
-.Sx \&Fn .
-.Sx \&Fc .
-.Ss \&Fr
.Ss \&Ft
A function type.
Its syntax is as follows:
.Pp
.D1 Pf \. Sx \&Ft Cm functype
.Pp
-If invoked before a
-.Sx \&Fo
-or
-.Sx \&Fn
-in the
-.Em SYNOPSIS
-section, a line-break will follow.
-Furthermore, if invoked in the
-.Em SYNOPSIS
-section, it will assert vertical space prior to its arguments.
-.Pp
Examples:
.D1 \&.Ft int
.Bd -literal -offset indent -compact
@@ -1772,10 +1769,10 @@ Examples:
.Ed
.Pp
See also
-.Sx \&Fo ,
-.Sx \&Fc ,
+.Sx MANUAL STRUCTURE ,
+.Sx \&Fn ,
and
-.Sx \&Fn .
+.Sx \&Fo .
.Ss \&Fx
Format the FreeBSD version provided as an argument, or a default value
if no argument is provided.
@@ -1804,11 +1801,13 @@ In the
section (only if invoked as the line macro), the first argument is
preceded by
.Qq #include ,
-the arguments is enclosed in angled braces, and a newline is asserted.
-In all other invocations, only angled braces will enclose the argument.
+the arguments is enclosed in angled braces.
.Pp
-Examples
+Examples:
.D1 \&.In sys/types
+.Pp
+See also
+.Sx MANUAL STRUCTURE .
.Ss \&It
A list item.
The syntax of this macro depends on the list type.
@@ -2098,12 +2097,14 @@ and
.Ss \&Va
.Ss \&Vt
A variable type.
-This is also used for indicating global variables in the SYNOPSIS
+This is also used for indicating global variables in the
+.Em SYNOPSIS
section, in which case a variable name is also specified.
Note that it accepts
.Sx Block partial-implicit
-syntax when invoked as the first macro in the SYNOPSIS section, else it
-accepts ordinary
+syntax when invoked as the first macro in the
+.Em SYNOPSIS
+section, else it accepts ordinary
.Sx In-line
syntax.
.Pp
@@ -2116,7 +2117,7 @@ Examples:
.D1 \&.Vt extern const char * const sys_signame[] \&;
.Pp
See also
-.Sx \&Ft
+.Sx MANUAL STRUCTURE
and
.Sx \&Va .
.Ss \&Xc
diff --git a/mdoc_html.c b/mdoc_html.c
index c7bd3dbb..1ac0139e 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.77 2010/06/06 10:50:56 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.78 2010/06/07 11:01:15 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -53,6 +53,8 @@ static void print_mdoc(MDOC_ARGS);
static void print_mdoc_head(MDOC_ARGS);
static void print_mdoc_node(MDOC_ARGS);
static void print_mdoc_nodelist(MDOC_ARGS);
+static void synopsis_pre(struct html *,
+ const struct mdoc_node *);
static void a2width(const char *, struct roffsu *);
static void a2offs(const char *, struct roffsu *);
@@ -84,7 +86,6 @@ static void mdoc_dq_post(MDOC_ARGS);
static int mdoc_dq_pre(MDOC_ARGS);
static int mdoc_dv_pre(MDOC_ARGS);
static int mdoc_fa_pre(MDOC_ARGS);
-static void mdoc_fd_post(MDOC_ARGS);
static int mdoc_fd_pre(MDOC_ARGS);
static int mdoc_fl_pre(MDOC_ARGS);
static int mdoc_fn_pre(MDOC_ARGS);
@@ -159,7 +160,7 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{mdoc_ev_pre, NULL}, /* Ev */
{mdoc_ex_pre, NULL}, /* Ex */
{mdoc_fa_pre, NULL}, /* Fa */
- {mdoc_fd_pre, mdoc_fd_post}, /* Fd */
+ {mdoc_fd_pre, NULL}, /* Fd */
{mdoc_fl_pre, NULL}, /* Fl */
{mdoc_fn_pre, NULL}, /* Fn */
{mdoc_ft_pre, NULL}, /* Ft */
@@ -294,6 +295,55 @@ a2width(const char *p, struct roffsu *su)
/*
+ * See the same function in mdoc_term.c for documentation.
+ */
+static void
+synopsis_pre(struct html *h, const struct mdoc_node *n)
+{
+ struct roffsu su;
+ struct htmlpair tag;
+
+ if (NULL == n->prev || SEC_SYNOPSIS != n->sec)
+ return;
+
+ SCALE_VS_INIT(&su, 1);
+ bufcat_su(h, "margin-top", &su);
+ PAIR_STYLE_INIT(&tag, h);
+
+ if (n->prev->tok == n->tok &&
+ MDOC_Fo != n->tok &&
+ MDOC_Ft != n->tok &&
+ MDOC_Fn != n->tok) {
+ print_otag(h, TAG_DIV, 0, NULL);
+ return;
+ }
+
+ switch (n->prev->tok) {
+ case (MDOC_Fd):
+ /* FALLTHROUGH */
+ case (MDOC_Fn):
+ /* FALLTHROUGH */
+ case (MDOC_Fo):
+ /* FALLTHROUGH */
+ case (MDOC_In):
+ /* FALLTHROUGH */
+ case (MDOC_Vt):
+ print_otag(h, TAG_DIV, 1, &tag);
+ break;
+ case (MDOC_Ft):
+ if (MDOC_Fn != n->tok && MDOC_Fo != n->tok) {
+ print_otag(h, TAG_DIV, 1, &tag);
+ break;
+ }
+ /* FALLTHROUGH */
+ default:
+ print_otag(h, TAG_DIV, 0, NULL);
+ break;
+ }
+}
+
+
+/*
* Calculate the scaling unit passed in an `-offset' argument. This
* uses either a native scaling unit (e.g., 1i, 2m), one of a set of
* predefined strings (indent, etc.), or the string length of the value.
@@ -690,18 +740,12 @@ mdoc_nm_pre(MDOC_ARGS)
if (NULL == n->child && NULL == m->name)
return(1);
- if (SEC_SYNOPSIS == n->sec &&
- n->prev && MDOC_LINE & n->flags) {
- bufcat_style(h, "clear", "both");
- PAIR_STYLE_INIT(&tag, h);
- print_otag(h, TAG_BR, 1, &tag);
- }
+ synopsis_pre(h, n);
PAIR_CLASS_INIT(&tag, "name");
print_otag(h, TAG_SPAN, 1, &tag);
if (NULL == n->child)
print_text(h, m->name);
-
return(1);
}
@@ -1438,7 +1482,7 @@ mdoc_cd_pre(MDOC_ARGS)
{
struct htmlpair tag;
- print_otag(h, TAG_DIV, 0, NULL);
+ synopsis_pre(h, n);
PAIR_CLASS_INIT(&tag, "config");
print_otag(h, TAG_SPAN, 1, &tag);
return(1);
@@ -1511,20 +1555,13 @@ mdoc_fa_pre(MDOC_ARGS)
/* ARGSUSED */
-static void
-mdoc_fd_post(MDOC_ARGS)
-{
-
- print_otag(h, TAG_BR, 0, NULL);
-}
-
-
-/* ARGSUSED */
static int
mdoc_fd_pre(MDOC_ARGS)
{
struct htmlpair tag;
+ synopsis_pre(h, n);
+
PAIR_CLASS_INIT(&tag, "macro");
print_otag(h, TAG_SPAN, 1, &tag);
return(1);
@@ -1536,18 +1573,12 @@ static int
mdoc_vt_pre(MDOC_ARGS)
{
struct htmlpair tag;
- struct roffsu su;
- if (SEC_SYNOPSIS == n->sec && MDOC_BLOCK == n->type) {
- if (n->next && MDOC_Vt != n->next->tok) {
- SCALE_VS_INIT(&su, 1);
- bufcat_su(h, "margin-bottom", &su);
- PAIR_STYLE_INIT(&tag, h);
- print_otag(h, TAG_DIV, 1, &tag);
- } else
- print_otag(h, TAG_DIV, 0, NULL);
-
+ if (MDOC_BLOCK == n->type) {
+ synopsis_pre(h, n);
return(1);
+ } else if (MDOC_ELEM == n->type) {
+ synopsis_pre(h, n);
} else if (MDOC_HEAD == n->type)
return(0);
@@ -1563,9 +1594,7 @@ mdoc_ft_pre(MDOC_ARGS)
{
struct htmlpair tag;
- if (SEC_SYNOPSIS == n->sec && n->prev)
- print_otag(h, TAG_BR, 0, NULL);
-
+ synopsis_pre(h, n);
PAIR_CLASS_INIT(&tag, "ftype");
print_otag(h, TAG_SPAN, 1, &tag);
return(1);
@@ -1582,21 +1611,8 @@ mdoc_fn_pre(MDOC_ARGS)
char nbuf[BUFSIZ];
const char *sp, *ep;
int sz, i;
- struct roffsu su;
- /* NB: MDOC_LINE has no effect on this macro! */
- if (SEC_SYNOPSIS == n->sec) {
- SCALE_HS_INIT(&su, INDENT);
- bufcat_su(h, "margin-left", &su);
- su.scale = -su.scale;
- bufcat_su(h, "text-indent", &su);
- if (n->prev && MDOC_Ft != n->prev->tok) {
- SCALE_VS_INIT(&su, 1);
- bufcat_su(h, "margin-top", &su);
- }
- PAIR_STYLE_INIT(&tag[0], h);
- print_otag(h, TAG_DIV, 1, tag);
- }
+ synopsis_pre(h, n);
/* Split apart into type and name. */
assert(n->child->string);
@@ -1782,7 +1798,6 @@ static int
mdoc_fo_pre(MDOC_ARGS)
{
struct htmlpair tag;
- struct roffsu su;
struct tag *t;
if (MDOC_BODY == n->type) {
@@ -1791,16 +1806,7 @@ mdoc_fo_pre(MDOC_ARGS)
h->flags |= HTML_NOSPACE;
return(1);
} else if (MDOC_BLOCK == n->type) {
- if (SEC_SYNOPSIS != n->sec)
- return(1);
- if (NULL == n->prev || MDOC_Ft == n->prev->tok) {
- print_otag(h, TAG_DIV, 0, NULL);
- return(1);
- }
- SCALE_VS_INIT(&su, 1);
- bufcat_su(h, "margin-top", &su);
- PAIR_STYLE_INIT(&tag, h);
- print_otag(h, TAG_DIV, 1, &tag);
+ synopsis_pre(h, n);
return(1);
}
@@ -1821,6 +1827,7 @@ mdoc_fo_pre(MDOC_ARGS)
static void
mdoc_fo_post(MDOC_ARGS)
{
+
if (MDOC_BODY != n->type)
return;
h->flags |= HTML_NOSPACE;
@@ -1839,6 +1846,8 @@ mdoc_in_pre(MDOC_ARGS)
struct htmlpair tag[2];
int i;
+ synopsis_pre(h, n);
+
PAIR_CLASS_INIT(&tag[0], "includes");
print_otag(h, TAG_SPAN, 1, tag);
@@ -1865,9 +1874,6 @@ mdoc_in_pre(MDOC_ARGS)
h->flags |= HTML_NOSPACE;
print_text(h, ">");
- if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)
- print_otag(h, TAG_BR, 0, NULL);
-
return(0);
}
diff --git a/mdoc_term.c b/mdoc_term.c
index e6be6214..72344740 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.142 2010/06/06 22:08:15 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.143 2010/06/07 11:01:15 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -68,6 +68,8 @@ static void print_mdoc_node(DECL_ARGS);
static void print_mdoc_head(DECL_ARGS);
static void print_mdoc_nodelist(DECL_ARGS);
static void print_foot(DECL_ARGS);
+static void synopsis_pre(struct termp *,
+ const struct mdoc_node *);
static void termp____post(DECL_ARGS);
static void termp_an_post(DECL_ARGS);
@@ -79,8 +81,7 @@ static void termp_brq_post(DECL_ARGS);
static void termp_bx_post(DECL_ARGS);
static void termp_d1_post(DECL_ARGS);
static void termp_dq_post(DECL_ARGS);
-static void termp_fd_post(DECL_ARGS);
-static void termp_fn_post(DECL_ARGS);
+static int termp_fd_pre(DECL_ARGS);
static void termp_fo_post(DECL_ARGS);
static void termp_in_post(DECL_ARGS);
static void termp_it_post(DECL_ARGS);
@@ -92,7 +93,6 @@ static void termp_qq_post(DECL_ARGS);
static void termp_sh_post(DECL_ARGS);
static void termp_sq_post(DECL_ARGS);
static void termp_ss_post(DECL_ARGS);
-static void termp_vt_post(DECL_ARGS);
static int termp_an_pre(DECL_ARGS);
static int termp_ap_pre(DECL_ARGS);
@@ -162,9 +162,9 @@ static const struct termact termacts[MDOC_MAX] = {
{ NULL, NULL }, /* Ev */
{ termp_ex_pre, NULL }, /* Ex */
{ termp_fa_pre, NULL }, /* Fa */
- { termp_bold_pre, termp_fd_post }, /* Fd */
+ { termp_fd_pre, NULL }, /* Fd */
{ termp_fl_pre, NULL }, /* Fl */
- { termp_fn_pre, termp_fn_post }, /* Fn */
+ { termp_fn_pre, NULL }, /* Fn */
{ termp_ft_pre, NULL }, /* Ft */
{ termp_bold_pre, NULL }, /* Ic */
{ termp_in_pre, termp_in_post }, /* In */
@@ -177,7 +177,7 @@ static const struct termact termacts[MDOC_MAX] = {
{ termp_rv_pre, NULL }, /* Rv */
{ NULL, NULL }, /* St */
{ termp_under_pre, NULL }, /* Va */
- { termp_vt_pre, termp_vt_post }, /* Vt */
+ { termp_vt_pre, NULL }, /* Vt */
{ termp_xr_pre, NULL }, /* Xr */
{ NULL, termp____post }, /* %A */
{ termp_under_pre, termp____post }, /* %B */
@@ -1055,14 +1055,11 @@ termp_nm_pre(DECL_ARGS)
if (NULL == n->child && NULL == m->name)
return(1);
- if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)
- term_newln(p);
+ synopsis_pre(p, n);
term_fontpush(p, TERMFONT_BOLD);
-
if (NULL == n->child)
term_word(p, m->name);
-
return(1);
}
@@ -1313,32 +1310,78 @@ termp_xr_pre(DECL_ARGS)
}
-static int
-termp_vt_pre(DECL_ARGS)
+/*
+ * This decides how to assert whitespace before any of the SYNOPSIS set
+ * of macros (which, as in the case of Ft/Fo and Ft/Fn, may contain
+ * macro combos).
+ */
+static void
+synopsis_pre(struct termp *p, const struct mdoc_node *n)
{
+ /*
+ * Obviously, if we're not in a SYNOPSIS or no prior macros
+ * exist, do nothing.
+ */
+ if (NULL == n->prev || SEC_SYNOPSIS != n->sec)
+ return;
- if (MDOC_ELEM == n->type)
- return(termp_under_pre(p, pair, m, n));
- else if (MDOC_HEAD == n->type)
- return(0);
- else if (MDOC_BLOCK == n->type)
- return(1);
+ /*
+ * If we're the second in a pair of like elements, emit our
+ * newline and return. UNLESS we're `Fo', `Fn', `Fn', in which
+ * case we soldier on.
+ */
+ if (n->prev->tok == n->tok &&
+ MDOC_Ft != n->tok &&
+ MDOC_Fo != n->tok &&
+ MDOC_Fn != n->tok) {
+ term_newln(p);
+ return;
+ }
- return(termp_under_pre(p, pair, m, n));
+ /*
+ * If we're one of the SYNOPSIS set and non-like pair-wise after
+ * another (or Fn/Fo, which we've let slip through) then assert
+ * vertical space, else only newline and move on.
+ */
+ switch (n->prev->tok) {
+ case (MDOC_Fd):
+ /* FALLTHROUGH */
+ case (MDOC_Fn):
+ /* FALLTHROUGH */
+ case (MDOC_Fo):
+ /* FALLTHROUGH */
+ case (MDOC_In):
+ /* FALLTHROUGH */
+ case (MDOC_Vt):
+ term_vspace(p);
+ break;
+ case (MDOC_Ft):
+ if (MDOC_Fn != n->tok && MDOC_Fo != n->tok) {
+ term_vspace(p);
+ break;
+ }
+ /* FALLTHROUGH */
+ default:
+ term_newln(p);
+ break;
+ }
}
-/* ARGSUSED */
-static void
-termp_vt_post(DECL_ARGS)
+static int
+termp_vt_pre(DECL_ARGS)
{
- if (MDOC_BLOCK != n->type)
- return;
- if (n->next && MDOC_Vt == n->next->tok)
- term_newln(p);
- else if (n->next)
- term_vspace(p);
+ if (MDOC_ELEM == n->type) {
+ synopsis_pre(p, n);
+ return(termp_under_pre(p, pair, m, n));
+ } else if (MDOC_BLOCK == n->type) {
+ synopsis_pre(p, n);
+ return(1);
+ } else if (MDOC_HEAD == n->type)
+ return(0);
+
+ return(termp_under_pre(p, pair, m, n));
}
@@ -1353,11 +1396,12 @@ termp_bold_pre(DECL_ARGS)
/* ARGSUSED */
-static void
-termp_fd_post(DECL_ARGS)
+static int
+termp_fd_pre(DECL_ARGS)
{
- term_newln(p);
+ synopsis_pre(p, n);
+ return(termp_bold_pre(p, pair, m, n));
}
@@ -1511,9 +1555,7 @@ termp_ft_pre(DECL_ARGS)
{
/* NB: MDOC_LINE does not effect this! */
- if (SEC_SYNOPSIS == n->sec && n->prev)
- term_vspace(p);
-
+ synopsis_pre(p, n);
term_fontpush(p, TERMFONT_UNDER);
return(1);
}
@@ -1525,13 +1567,7 @@ termp_fn_pre(DECL_ARGS)
{
const struct mdoc_node *nn;
- /* NB: MDOC_LINE has no effect on this macro! */
- if (SEC_SYNOPSIS == n->sec) {
- if (n->prev && MDOC_Ft == n->prev->tok)
- term_newln(p);
- else if (n->prev)
- term_vspace(p);
- }
+ synopsis_pre(p, n);
term_fontpush(p, TERMFONT_BOLD);
term_word(p, n->child->string);
@@ -1559,17 +1595,6 @@ termp_fn_pre(DECL_ARGS)
/* ARGSUSED */
-static void
-termp_fn_post(DECL_ARGS)
-{
-
- /* NB: MDOC_LINE has no effect on this macro! */
- if (SEC_SYNOPSIS == n->sec)
- term_newln(p);
-}
-
-
-/* ARGSUSED */
static int
termp_fa_pre(DECL_ARGS)
{
@@ -1834,8 +1859,8 @@ static int
termp_cd_pre(DECL_ARGS)
{
+ synopsis_pre(p, n);
term_fontpush(p, TERMFONT_BOLD);
- term_newln(p);
return(1);
}
@@ -1845,8 +1870,7 @@ static int
termp_in_pre(DECL_ARGS)
{
- if (SEC_SYNOPSIS == n->sec && n->prev && MDOC_In != n->prev->tok)
- term_vspace(p);
+ synopsis_pre(p, n);
if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) {
term_fontpush(p, TERMFONT_BOLD);
@@ -1867,16 +1891,14 @@ static void
termp_in_post(DECL_ARGS)
{
- if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)
+ if (SEC_SYNOPSIS == n->sec)
term_fontpush(p, TERMFONT_BOLD);
p->flags |= TERMP_NOSPACE;
term_word(p, ">");
- if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) {
+ if (SEC_SYNOPSIS == n->sec)
term_fontpop(p);
- term_newln(p);
- }
}
@@ -1987,13 +2009,7 @@ termp_fo_pre(DECL_ARGS)
{
if (MDOC_BLOCK == n->type) {
- /* NB: MDOC_LINE has no effect on this macro! */
- if (SEC_SYNOPSIS != n->sec)
- return(1);
- if (n->prev && MDOC_Ft == n->prev->tok)
- term_newln(p);
- else if (n->prev)
- term_vspace(p);
+ synopsis_pre(p, n);
return(1);
} else if (MDOC_BODY == n->type) {
p->flags |= TERMP_NOSPACE;
@@ -2017,17 +2033,15 @@ static void
termp_fo_post(DECL_ARGS)
{
- if (MDOC_BLOCK == n->type) {
- /* NB: MDOC_LINE has no effect on this macro! */
- if (SEC_SYNOPSIS == n->sec)
- term_newln(p);
- } else if (MDOC_BODY == n->type) {
+ if (MDOC_BODY != n->type)
+ return;
+
+ p->flags |= TERMP_NOSPACE;
+ term_word(p, ")");
+
+ if (SEC_SYNOPSIS == n->sec) {
p->flags |= TERMP_NOSPACE;
- term_word(p, ")");
- if (SEC_SYNOPSIS == n->sec) {
- p->flags |= TERMP_NOSPACE;
- term_word(p, ";");
- }
+ term_word(p, ";");
}
}
diff --git a/regress/mdoc/Cd/cd.in b/regress/mdoc/Cd/cd.in
new file mode 100644
index 00000000..cce3c661
--- /dev/null
+++ b/regress/mdoc/Cd/cd.in
@@ -0,0 +1,14 @@
+.Dd $Mdocdate: June 7 2010 $
+.Dt FOO 1
+.Os
+.Sh NAME
+.Nm foo
+.Nd bar
+.Sh SYNOPSIS
+.Cd "it* at isa? port 0x2e"
+.Cd "it* at isa? port 0x2e"
+.Cd "it* at isa? port 0x2e"
+.Sh DESCRIPTION
+.Cd "it* at isa? port 0x2e"
+.Cd "it* at isa? port 0x2e"
+.Cd "it* at isa? port 0x2e"
diff --git a/regress/mdoc/Fd/fd.in b/regress/mdoc/Fd/fd.in
deleted file mode 100644
index 80285012..00000000
--- a/regress/mdoc/Fd/fd.in
+++ /dev/null
@@ -1,22 +0,0 @@
-.Dd $Mdocdate: June 4 2010 $
-.Dt FOO
-.Os
-.Sh NAME
-.Nm foo
-.Nd bar
-.Sh SYNOPSIS
-1
-.Fl
-.Fd 2 3 4
-.Fd 3
-4
-.Sh DESCRIPTION
-1
-.Fd 2
-.Fd 3
-4
-.Sh BLAH
-1
-.Fd 2
-.Fd 3
-4
diff --git a/regress/mdoc/Fn/fn1.in b/regress/mdoc/Fn/fn1.in
deleted file mode 100644
index 7d7f9757..00000000
--- a/regress/mdoc/Fn/fn1.in
+++ /dev/null
@@ -1,21 +0,0 @@
-.Dd $Mdocdate: June 4 2010 $
-.Dt FOO 1
-.Os
-.Sh NAME
-.Nm foo
-.Nd bar
-.Sh SYNOPSIS
-1
-.In 2
-a
-.Fn 3
-.Fn 4 5 6
-.Ar a Fn 4
-5
-.Sh DESCRIPTION
-1
-.In 2
-.Fn 3
-.Fn 3 4 5
-.Ar a Fn 6
-4
diff --git a/regress/mdoc/Fo/fo0.in b/regress/mdoc/Fo/fo0.in
deleted file mode 100644
index 2c7e3886..00000000
--- a/regress/mdoc/Fo/fo0.in
+++ /dev/null
@@ -1,32 +0,0 @@
-.Dd $Mdocdate: June 6 2010 $
-.Dt FOO 1
-.Os
-.Sh NAME
-.Nm foo
-.Nd bar
-.Sh SYNOPSIS
-.Fn b
-a
-.Fo b
-.Fc
-.Fo "a b c"
-.Fc
-.Ft "a"
-.Fo "b c"
-.Fc
-.Ft "a b"
-.Fo "b c" "d e"
-.Fc
-.Sh DESCRIPTION
-.Fn b
-a
-.Fo b
-.Fc
-.Fo "a b c"
-.Fc
-.Ft "a"
-.Fo "b c"
-.Fc
-.Ft "a b"
-.Fo "b c" "d e"
-.Fc
diff --git a/regress/mdoc/Ft/ft0.in b/regress/mdoc/Ft/ft0.in
deleted file mode 100644
index b805127c..00000000
--- a/regress/mdoc/Ft/ft0.in
+++ /dev/null
@@ -1,25 +0,0 @@
-.Dd $Mdocdate: June 6 2010 $
-.Dt FOO 1
-.Os
-.Sh NAME
-.Nm foo
-.Nd bar
-.Sh SYNOPSIS
-.Fn b \" Get this out of the way.
-.Ft a
-.Ft b
-a
-.Ft "c d"
-b
-.Ar foo
-.Ft "c d"
-.Ar bar
-.Sh DESCRIPTION
-.Ft a
-.Ft b
-a
-.Ft "c d"
-b
-.Ar foo
-.Ft "c d"
-.Ar bar
diff --git a/regress/mdoc/In/in.in b/regress/mdoc/In/in.in
deleted file mode 100644
index ed89f0b4..00000000
--- a/regress/mdoc/In/in.in
+++ /dev/null
@@ -1,24 +0,0 @@
-.\" THIS WILL PUKE HORRIBLY ON OLD GROFF, WHICH HAS COMPLETELY
-.\" DIFFERENT ("BAD") BEHAVIOUR.
-.Dd $Mdocdate: June 4 2010 $
-.Dt FOO 1
-.Os
-.Sh NAME
-.Nm foo
-.Nd bar
-.Sh SYNOPSIS
-1
-.In 2 3
-6
-.In 2 3
-.Qq In 2
-.Fd a
-6
-.In 4
-5
-.Sh DESCRIPTION
-1
-.In 2 3
-6
-.In 4
-5