source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: In man(7), when no explicit volume name is given, use the
Date: Thu, 1 Dec 2011 20:37:15 -0500 (EST)	[thread overview]
Message-ID: <201112020137.pB21bFNL019657@krisdoz.my.domain> (raw)

Log Message:
-----------
In man(7), when no explicit volume name is given, use the default
volume name for the respective manual section, just like in mdoc(7).
This gives us nicer page headers for cvs(1), lynx(1), tic(1),
mkhybrid(8), and many curses(3) manuals.

ok kristaps@

To not break compatibility, i wrote a corresponding patch for GNU troff
which Werner Lemberg accepted upstream at rev. 1.65 of:
http://cvs.savannah.gnu.org/viewvc/groff/tmac/an-old.tmac?root=groff

Modified Files:
--------------
    mdocml:
        Makefile
        libmandoc.h
        libmdoc.h
        man.7
        man_validate.c
        mdoc_validate.c
        msec.c

Revision Data
-------------
Index: man.7
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.7,v
retrieving revision 1.111
retrieving revision 1.112
diff -Lman.7 -Lman.7 -u -p -r1.111 -r1.112
--- man.7
+++ man.7
@@ -840,6 +840,19 @@ The
 .Sx \&sp
 macro does not accept negative values in mandoc.
 In GNU troff, this would result in strange behaviour.
+.It
+In page header lines, GNU troff versions up to and including 1.21
+only print
+.Ar volume
+names explicitly specified in the
+.Sx \&TH
+macro; mandoc and newer groff print the default volume name
+corresponding to the
+.Ar section
+number when no
+.Ar volume
+is given, like in
+.Xr mdoc 7 .
 .El
 .Sh SEE ALSO
 .Xr man 1 ,
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.179 -r1.180
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -2084,7 +2084,7 @@ post_dt(POST_ARGS)
 	 *       arch = NULL
 	 */
 
-	cp = mdoc_a2msec(nn->string);
+	cp = mandoc_a2msec(nn->string);
 	if (cp) {
 		mdoc->meta.vol = mandoc_strdup(cp);
 		mdoc->meta.msec = mandoc_strdup(nn->string);
Index: libmdoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/libmdoc.h,v
retrieving revision 1.77
retrieving revision 1.78
diff -Llibmdoc.h -Llibmdoc.h -u -p -r1.77 -r1.78
--- libmdoc.h
+++ libmdoc.h
@@ -124,7 +124,6 @@ const char	 *mdoc_a2lib(const char *);
 const char	 *mdoc_a2st(const char *);
 const char	 *mdoc_a2arch(const char *);
 const char	 *mdoc_a2vol(const char *);
-const char	 *mdoc_a2msec(const char *);
 int		  mdoc_valid_pre(struct mdoc *, struct mdoc_node *);
 int		  mdoc_valid_post(struct mdoc *);
 enum margverr	  mdoc_argv(struct mdoc *, int, enum mdoct,
Index: msec.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/msec.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lmsec.c -Lmsec.c -u -p -r1.9 -r1.10
--- msec.c
+++ msec.c
@@ -21,15 +21,14 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "mdoc.h"
 #include "mandoc.h"
-#include "libmdoc.h"
+#include "libmandoc.h"
 
 #define LINE(x, y) \
 	if (0 == strcmp(p, x)) return(y);
 
 const char *
-mdoc_a2msec(const char *p)
+mandoc_a2msec(const char *p)
 {
 
 #include "msec.in"
Index: Makefile
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/Makefile,v
retrieving revision 1.384
retrieving revision 1.385
diff -LMakefile -LMakefile -u -p -r1.384 -r1.385
--- Makefile
+++ Makefile
@@ -173,7 +173,6 @@ LIBMDOC_OBJS	 = arch.o \
 		   mdoc_hash.o \
 		   mdoc_macro.o \
 		   mdoc_validate.o \
-		   msec.o \
 		   st.o \
 		   vol.o
 LIBMDOC_LNS	 = arch.ln \
@@ -184,7 +183,6 @@ LIBMDOC_LNS	 = arch.ln \
 		   mdoc_hash.ln \
 		   mdoc_macro.ln \
 		   mdoc_validate.ln \
-		   msec.ln \
 		   st.ln \
 		   vol.ln
 
@@ -206,12 +204,14 @@ LIBMANDOC_OBJS	 = $(LIBMAN_OBJS) \
 		   $(LIBROFF_OBJS) \
 		   chars.o \
 		   mandoc.o \
+		   msec.o \
 		   read.o
 LIBMANDOC_LNS	 = $(LIBMAN_LNS) \
 		   $(LIBMDOC_LNS) \
 		   $(LIBROFF_LNS) \
 		   chars.ln \
 		   mandoc.ln \
+		   msec.ln \
 		   read.ln
 
 COMPAT_OBJS	 = compat_getsubopt.o \
Index: man_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_validate.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -Lman_validate.c -Lman_validate.c -u -p -r1.78 -r1.79
--- man_validate.c
+++ man_validate.c
@@ -413,9 +413,13 @@ post_TH(CHKARGS)
 		m->meta.source = mandoc_strdup(n->string);
 
 	/* TITLE MSEC DATE SOURCE ->VOL<- */
+	/* If missing, use the default VOL name for MSEC. */
 
 	if (n && (n = n->next))
 		m->meta.vol = mandoc_strdup(n->string);
+	else if ('\0' != m->meta.msec[0] &&
+	    (NULL != (p = mandoc_a2msec(m->meta.msec))))
+		m->meta.vol = mandoc_strdup(p);
 
 	/*
 	 * Remove the `TH' node after we've processed it for our
Index: libmandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/libmandoc.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -Llibmandoc.h -Llibmandoc.h -u -p -r1.28 -r1.29
--- libmandoc.h
+++ libmandoc.h
@@ -49,6 +49,7 @@ char		*mandoc_normdate(struct mparse *, 
 int		 mandoc_eos(const char *, size_t, int);
 int		 mandoc_getcontrol(const char *, int *);
 int		 mandoc_strntoi(const char *, size_t, int);
+const char	*mandoc_a2msec(const char*);
 
 void	 	 mdoc_free(struct mdoc *);
 struct	mdoc	*mdoc_alloc(struct roff *, struct mparse *);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2011-12-02  1:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=201112020137.pB21bFNL019657@krisdoz.my.domain \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@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).