tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Kristaps Dzonsons <kristaps@bsd.lv>
To: tech@mdocml.bsd.lv, Joel Dahl <joel@vnode.se>,
	Jason McIntyre <jmc@cava.myzen.co.uk>
Subject: `Cd' and non-pairwise-breaking in SYNOPSIS.
Date: Tue, 27 Mar 2012 15:54:59 +0200	[thread overview]
Message-ID: <4F71C6B3.9080302@bsd.lv> (raw)

[-- Attachment #1: Type: text/plain, Size: 1317 bytes --]

Hi,

Joel (CC'd) had asked off-list about manuals in .4 that have the 
following syntax:

SYNOPSIS
      options BLAH

      #include <sys/blah.h>
      #include <sys/foo.h>

      int
      foo(int bar);

In the mdoc(7) manpage, we specify

        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 pairwise 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.

But this is a lie for `Cd', which does not emit a newline as would `In' 
or the others.  OpenBSD's manuals, for example, use a `Pp' separating 
the elements.  Examples:

http://www.openbsd.org/cgi-bin/man.cgi?query=multicast
http://www.openbsd.org/cgi-bin/man.cgi?query=pim

groff(1) requires the `Pp'.

Basically, I think this breaks the consistency of other SYNOPSIS macros, 
which do not require `Pp'.  In the following patch, mandoc(1) puts in 
the necessary space automatically.  This has no effect on manuals that 
already use `Pp' but for a warning.  I tried to patch groff's doc.tmac 
for the same effect, but failed.

Thoughts?

Kristaps

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1025 bytes --]

Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.182
diff -u -p -r1.182 mdoc_html.c
--- mdoc_html.c	3 Nov 2011 20:37:00 -0000	1.182
+++ mdoc_html.c	27 Mar 2012 13:53:49 -0000
@@ -303,6 +303,8 @@ synopsis_pre(struct html *h, const struc
 	}
 
 	switch (n->prev->tok) {
+	case (MDOC_Cd):
+		/* FALLTHROUGH */
 	case (MDOC_Fd):
 		/* FALLTHROUGH */
 	case (MDOC_Fn):
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.238
diff -u -p -r1.238 mdoc_term.c
--- mdoc_term.c	13 Nov 2011 13:15:14 -0000	1.238
+++ mdoc_term.c	27 Mar 2012 13:53:50 -0000
@@ -1345,6 +1345,8 @@ synopsis_pre(struct termp *p, const stru
 	 * vertical space, else only newline and move on.
 	 */
 	switch (n->prev->tok) {
+	case (MDOC_Cd):
+		/* FALLTHROUGH */
 	case (MDOC_Fd):
 		/* FALLTHROUGH */
 	case (MDOC_Fn):

             reply	other threads:[~2012-03-27 13:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27 13:54 Kristaps Dzonsons [this message]
     [not found] ` <20120327141931.GB8234@harkle.home.gateway>
2012-03-27 14:42   ` Kristaps Dzonsons
2012-04-15 21:15 ` Ingo Schwarze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F71C6B3.9080302@bsd.lv \
    --to=kristaps@bsd.lv \
    --cc=jmc@cava.myzen.co.uk \
    --cc=joel@vnode.se \
    --cc=tech@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).