* mdocml: Made `Dt' default to LOCAL and UNKNOWN instead of local and
@ 2010-05-30 11:00 kristaps
2010-05-30 11:03 ` Joerg Sonnenberger
0 siblings, 1 reply; 4+ messages in thread
From: kristaps @ 2010-05-30 11:00 UTC (permalink / raw)
To: source
Log Message:
-----------
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.
Modified Files:
--------------
mdocml:
mdoc.7
mdoc.c
mdoc_action.c
mdoc_validate.c
Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.84 -r1.85
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -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,
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;
+ }
+
+ return(1);
+}
+
- /* FIXME: make sure is capitalised. */
+static int
+pre_dt(PRE_ARGS)
+{
if (0 == mdoc->meta.date || mdoc->meta.os)
if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_PROLOGOOO))
Index: mdoc_action.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_action.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -Lmdoc_action.c -Lmdoc_action.c -u -p -r1.62 -r1.63
--- mdoc_action.c
+++ mdoc_action.c
@@ -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));
}
Index: mdoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.c,v
retrieving revision 1.139
retrieving revision 1.140
diff -Lmdoc.c -Lmdoc.c -u -p -r1.139 -r1.140
--- mdoc.c
+++ mdoc.c
@@ -276,11 +276,11 @@ mdoc_macro(struct mdoc *m, enum mdoct to
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;
Index: mdoc.7
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.7,v
retrieving revision 1.110
retrieving revision 1.111
diff -Lmdoc.7 -Lmdoc.7 -u -p -r1.110 -r1.111
--- mdoc.7
+++ mdoc.7
@@ -1408,13 +1408,15 @@ This is the mandatory second macro of an
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
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mdocml: Made `Dt' default to LOCAL and UNKNOWN instead of local and
2010-05-30 11:00 mdocml: Made `Dt' default to LOCAL and UNKNOWN instead of local and kristaps
@ 2010-05-30 11:03 ` Joerg Sonnenberger
2010-05-30 11:13 ` Kristaps Dzonsons
0 siblings, 1 reply; 4+ messages in thread
From: Joerg Sonnenberger @ 2010-05-30 11:03 UTC (permalink / raw)
To: source
On Sun, May 30, 2010 at 07:00:53AM -0400, kristaps@mdocml.bsd.lv wrote:
> 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 (toupper((u_char)*p) != *p)
should do the same and make it easier to just enforce it automatically?
Joerg
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mdocml: Made `Dt' default to LOCAL and UNKNOWN instead of local and
2010-05-30 11:03 ` Joerg Sonnenberger
@ 2010-05-30 11:13 ` Kristaps Dzonsons
2010-05-30 11:43 ` Joerg Sonnenberger
0 siblings, 1 reply; 4+ messages in thread
From: Kristaps Dzonsons @ 2010-05-30 11:13 UTC (permalink / raw)
To: source
>> 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 (toupper((u_char)*p) != *p)
>
> should do the same and make it easier to just enforce it automatically?
Is this guaranteed behaviour for toupper() across the melange of systems
we're supposed to support?
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mdocml: Made `Dt' default to LOCAL and UNKNOWN instead of local and
2010-05-30 11:13 ` Kristaps Dzonsons
@ 2010-05-30 11:43 ` Joerg Sonnenberger
0 siblings, 0 replies; 4+ messages in thread
From: Joerg Sonnenberger @ 2010-05-30 11:43 UTC (permalink / raw)
To: source
On Sun, May 30, 2010 at 01:13:35PM +0200, Kristaps Dzonsons wrote:
> >> 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 (toupper((u_char)*p) != *p)
> >
> >should do the same and make it easier to just enforce it automatically?
>
> Is this guaranteed behaviour for toupper() across the melange of
> systems we're supposed to support?
It is ISO C90 behavior. I expect platforms to have bigger issues if they
break this.
Joerg
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-30 11:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-30 11:00 mdocml: Made `Dt' default to LOCAL and UNKNOWN instead of local and kristaps
2010-05-30 11:03 ` Joerg Sonnenberger
2010-05-30 11:13 ` Kristaps Dzonsons
2010-05-30 11:43 ` Joerg Sonnenberger
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).