source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Fixed `Fn' newline behaviour and added some regression tests to
@ 2010-06-04 22:16 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-06-04 22:16 UTC (permalink / raw)
  To: source

Log Message:
-----------
Fixed `Fn' newline behaviour and added some regression tests to this
extent.

Documented `Fn'.  Please note the COMPATIBILITY note regarding historic
groff.

Modified Files:
--------------
    mdocml:
        mdoc.7
        mdoc_html.c
        mdoc_term.c

Added Files:
-----------
    mdocml/regress/mdoc/Fn:
        fn1.in
        fn2.in

Revision Data
-------------
--- /dev/null
+++ 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
--- /dev/null
+++ 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"
Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.74 -r1.75
--- mdoc_html.c
+++ mdoc_html.c
@@ -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;
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.138
retrieving revision 1.139
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.138 -r1.139
--- mdoc_term.c
+++ mdoc_term.c
@@ -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);
 }
 
 
Index: mdoc.7
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.7,v
retrieving revision 1.118
retrieving revision 1.119
diff -Lmdoc.7 -Lmdoc.7 -u -p -r1.118 -r1.119
--- mdoc.7
+++ mdoc.7
@@ -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
@@ -2047,6 +2074,12 @@ Heirloom troff, the other significant tr
 \-mdoc, is similar to historic groff.
 .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
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-06-04 22:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-04 22:16 mdocml: Fixed `Fn' newline behaviour and added some regression tests to kristaps

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).