aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-05-30 11:00:53 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-05-30 11:00:53 +0000
commit00b1408577108687d502b7b56de8e3399986a349 (patch)
treec535af78076f266b280ec03a40300ce7f501a720
parent6183dbfbb27ceb32859b32133331b06f0b3037f4 (diff)
downloadmandoc-00b1408577108687d502b7b56de8e3399986a349.tar.gz
mandoc-00b1408577108687d502b7b56de8e3399986a349.tar.zst
mandoc-00b1408577108687d502b7b56de8e3399986a349.zip
Made `Dt' default to LOCAL and UNKNOWN instead of local and unknown (note case).
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.
-rw-r--r--mdoc.718
-rw-r--r--mdoc.c8
-rw-r--r--mdoc_action.c11
-rw-r--r--mdoc_validate.c29
4 files changed, 45 insertions, 21 deletions
diff --git a/mdoc.7 b/mdoc.7
index 08443bf8..e4ed410d 100644
--- a/mdoc.7
+++ b/mdoc.7
@@ -1,4 +1,4 @@
-.\" $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>
.\"
@@ -14,7 +14,7 @@
.\" 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
@@ -1408,13 +1408,15 @@ This is the mandatory second macro of any
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
@@ -1451,8 +1453,9 @@ 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 .
@@ -1524,7 +1527,6 @@ Examples:
.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
diff --git a/mdoc.c b/mdoc.c
index 46a5ecbe..a1e27576 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $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>
*
@@ -276,11 +276,11 @@ mdoc_macro(struct mdoc *m, enum mdoct tok,
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;
diff --git a/mdoc_action.c b/mdoc_action.c
index 7fa1bf6b..ff1400a3 100644
--- a/mdoc_action.c
+++ b/mdoc_action.c
@@ -1,4 +1,4 @@
-/* $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>
*
@@ -499,8 +499,8 @@ post_dt(POST_ARGS)
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));
}
@@ -509,12 +509,13 @@ post_dt(POST_ARGS)
* --> 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));
}
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 9d2baad7..b5d29271 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $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>
*
@@ -83,6 +83,7 @@ static int post_at(POST_ARGS);
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);
@@ -113,6 +114,7 @@ static v_post posts_bf[] = { hwarn_le1, post_bf, NULL };
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 };
@@ -147,7 +149,7 @@ static v_pre pres_ss[] = { pre_ss, 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 */
@@ -738,10 +740,29 @@ pre_rv(PRE_ARGS)
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))