diff options
-rw-r--r-- | mdoc.7 | 35 | ||||
-rw-r--r-- | mdoc_html.c | 5 | ||||
-rw-r--r-- | mdoc_term.c | 13 | ||||
-rw-r--r-- | regress/mdoc/Fn/fn1.in | 21 | ||||
-rw-r--r-- | regress/mdoc/Fn/fn2.in | 16 |
5 files changed, 84 insertions, 6 deletions
@@ -1,4 +1,4 @@ -.\" $Id: mdoc.7,v 1.118 2010/06/04 21:49:39 kristaps Exp $ +.\" $Id: mdoc.7,v 1.119 2010/06/04 22:16:27 kristaps Exp $ .\" .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv> .\" @@ -1656,6 +1656,33 @@ Examples: See also .Sx \&Cm . .Ss \&Fn +A function name. +Its calling syntax is as follows: +.Bd -ragged -offset indent +.Pf \. Ns Sx \&Fn +.Op Cm functype +.Cm funcname +.Op Oo Cm argtype Oc Cm argname +.Ed +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 +are delimited by commas. +If no arguments are specified, blank parenthesis are output. +.Pp +Examples: +.D1 \&.Fn "int funcname" "int arg0" "int arg1" +.D1 \&.Fn funcname +.D1 \&.Fn funcname "int arg0" +.D1 \&.Fn funcname arg0 +.Pp +See also +.Sx \&Fa , +.Sx \&Fo , +.Sx \&Fc , +and +.Sx \&Ft . .Ss \&Fo .Ss \&Fr .Ss \&Ft @@ -2048,6 +2075,12 @@ Heirloom troff, the other significant troff implementation accepting .Pp .Bl -dash -compact .It +Historic groff does not break before an +.Sx \&Fn +when not invoked as the line macro in the +.Em SYNOPSIS +section. +.It Historic groff formats the .Sx \&In badly: trailing arguments are trashed and diff --git a/mdoc_html.c b/mdoc_html.c index e3ae9d9a..41f7000d 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.74 2010/06/04 21:49:39 kristaps Exp $ */ +/* $Id: mdoc_html.c,v 1.75 2010/06/04 22:16:27 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -1584,7 +1584,8 @@ mdoc_fn_pre(MDOC_ARGS) int sz, i; struct roffsu su; - if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) { + /* 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; diff --git a/mdoc_term.c b/mdoc_term.c index 2c161d65..567d9aad 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.138 2010/06/04 21:49:39 kristaps Exp $ */ +/* $Id: mdoc_term.c,v 1.139 2010/06/04 22:16:27 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -1536,6 +1536,12 @@ 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) + term_vspace(p); + } + term_fontpush(p, TERMFONT_BOLD); term_word(p, n->child->string); term_fontpop(p); @@ -1566,8 +1572,9 @@ static void termp_fn_post(DECL_ARGS) { - if (n->sec == SEC_SYNOPSIS && n->next && MDOC_LINE & n->flags) - term_vspace(p); + /* NB: MDOC_LINE has no effect on this macro! */ + if (SEC_SYNOPSIS == n->sec) + term_newln(p); } diff --git a/regress/mdoc/Fn/fn1.in b/regress/mdoc/Fn/fn1.in new file mode 100644 index 00000000..7d7f9757 --- /dev/null +++ b/regress/mdoc/Fn/fn1.in @@ -0,0 +1,21 @@ +.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/Fn/fn2.in b/regress/mdoc/Fn/fn2.in new file mode 100644 index 00000000..d09ede7d --- /dev/null +++ b/regress/mdoc/Fn/fn2.in @@ -0,0 +1,16 @@ +.Dd $Mdocdate: June 4 2010 $ +.Dt FOO 1 +.Os +.Sh NAME +.Nm foo +.Nd bar +.Sh SYNOPSIS +.Fn 1 +.Fn "1 2" +.Fn "1 2" "3 4" +.Fn "1 2" "4" +.Sh DESCRIPTION +.Fn 1 +.Fn "1 2" +.Fn "1 2" "3 4" +.Fn "1 2" "4" |