Have `Dt' default to UNKNOWN if it's an empty string.
Raise a warning if `Dt' title isn't capitalised.
Sync'd `Dt' documentation with reality.
-.\" $Id: mdoc.7,v 1.110 2010/05/26 10:39:35 kristaps Exp $
+.\" $Id: mdoc.7,v 1.111 2010/05/30 11:00:53 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: May 26 2010 $
+.Dd $Mdocdate: May 30 2010 $
.Dt MDOC 7
.Os
.Sh NAME
file.
Its calling syntax is as follows:
.Pp
-.D1 \. Ns Sx \&Dt Cm title section Op Cm volume | arch
+.D1 \. Ns Sx \&Dt Op Cm title Op Cm section Op Cm volume | arch
.Pp
Its arguments are as follows:
.Bl -tag -width Ds -offset Ds
.It Cm title
-The document's title (name).
-This should be capitalised and is required.
+The document's title (name), defaulting to
+.Qq UNKNOWN
+if unspecified.
+It should be capitalised.
.It Cm section
The manual section.
This may be one of
or
.Ar paper
.Pq paper .
-It is also required and should correspond to the manual's filename
-suffix.
+It should correspond to the manual's filename suffix and defaults to
+.Qq 1
+if unspecified.
.It Cm volume
This overrides the volume inferred from
.Ar section .
.D1 \&.Dt FOO 1
.D1 \&.Dt FOO 4 KM
.D1 \&.Dt FOO 9 i386
-.D1 \&.Dt FOO 9 KM i386
.Pp
See also
.Sx \&Dd
-/* $Id: mdoc.c,v 1.139 2010/05/26 09:35:35 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.140 2010/05/30 11:00:53 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
if ( ! mdoc_pmsg(m, ln, pp, MANDOCERR_BADPROLOG))
return(0);
if (NULL == m->meta.title)
- m->meta.title = mandoc_strdup("unknown");
+ m->meta.title = mandoc_strdup("UNKNOWN");
if (NULL == m->meta.vol)
- m->meta.vol = mandoc_strdup("local");
+ m->meta.vol = mandoc_strdup("LOCAL");
if (NULL == m->meta.os)
- m->meta.os = mandoc_strdup("local");
+ m->meta.os = mandoc_strdup("LOCAL");
if (0 == m->meta.date)
m->meta.date = time(NULL);
m->flags |= MDOC_PBODY;
-/* $Id: mdoc_action.c,v 1.62 2010/05/29 18:58:52 kristaps Exp $ */
+/* $Id: mdoc_action.c,v 1.63 2010/05/30 11:00:53 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
if (NULL == (nn = n->child)) {
/* XXX: make these macro values. */
/* FIXME: warn about missing values. */
- m->meta.title = mandoc_strdup("unknown");
- m->meta.vol = mandoc_strdup("local");
+ m->meta.title = mandoc_strdup("UNKNOWN");
+ m->meta.vol = mandoc_strdup("LOCAL");
m->meta.msec = mandoc_strdup("1");
return(post_prol(m, n));
}
* --> title = TITLE, volume = local, msec = 0, arch = NULL
*/
- m->meta.title = mandoc_strdup(nn->string);
+ m->meta.title = mandoc_strdup
+ ('\0' == nn->string[0] ? "UNKNOWN" : nn->string);
if (NULL == (nn = nn->next)) {
/* FIXME: warn about missing msec. */
/* XXX: make this a macro value. */
- m->meta.vol = mandoc_strdup("local");
+ m->meta.vol = mandoc_strdup("LOCAL");
m->meta.msec = mandoc_strdup("1");
return(post_prol(m, n));
}
-/* $Id: mdoc_validate.c,v 1.84 2010/05/26 10:39:35 kristaps Exp $ */
+/* $Id: mdoc_validate.c,v 1.85 2010/05/30 11:00:53 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
static int post_bf(POST_ARGS);
static int post_bl(POST_ARGS);
static int post_bl_head(POST_ARGS);
+static int post_dt(POST_ARGS);
static int post_it(POST_ARGS);
static int post_lb(POST_ARGS);
static int post_nm(POST_ARGS);
static v_post posts_bl[] = { bwarn_ge1, post_bl, NULL };
static v_post posts_bool[] = { eerr_eq1, ebool, NULL };
static v_post posts_eoln[] = { post_eoln, NULL };
+static v_post posts_dt[] = { post_dt, NULL };
static v_post posts_fo[] = { hwarn_eq1, bwarn_ge1, NULL };
static v_post posts_it[] = { post_it, NULL };
static v_post posts_lb[] = { eerr_eq1, post_lb, NULL };
const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, NULL }, /* Ap */
{ pres_dd, posts_text }, /* Dd */
- { pres_dt, NULL }, /* Dt */
+ { pres_dt, posts_dt }, /* Dt */
{ pres_os, NULL }, /* Os */
{ pres_sh, posts_sh }, /* Sh */
{ pres_ss, posts_ss }, /* Ss */
static int
-pre_dt(PRE_ARGS)
+post_dt(POST_ARGS)
{
+ const struct mdoc_node *nn;
+ const char *p;
+
+ if (NULL != (nn = mdoc->last->child))
+ for (p = nn->string; *p; p++) {
+ if ( ! isalpha((u_char)*p))
+ continue;
+ if (isupper((u_char)*p))
+ continue;
+ if ( ! mdoc_nmsg(mdoc, nn, MANDOCERR_UPPERCASE))
+ return(0);
+ break;
+ }
- /* FIXME: make sure is capitalised. */
+ return(1);
+}
+
+
+static int
+pre_dt(PRE_ARGS)
+{
if (0 == mdoc->meta.date || mdoc->meta.os)
if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_PROLOGOOO))