version 1.280, 2015/02/16 19:02:48 |
version 1.283, 2015/02/23 13:55:55 |
Line 839 post_lb(POST_ARGS) |
|
Line 839 post_lb(POST_ARGS) |
|
|
|
if (NULL == (stdlibname = mdoc_a2lib(n->string))) |
if (NULL == (stdlibname = mdoc_a2lib(n->string))) |
mandoc_asprintf(&libname, |
mandoc_asprintf(&libname, |
"library \\(lq%s\\(rq", n->string); |
"library \\(Lq%s\\(Rq", n->string); |
else |
else |
libname = mandoc_strdup(stdlibname); |
libname = mandoc_strdup(stdlibname); |
|
|
|
|
post_sh_name(POST_ARGS) |
post_sh_name(POST_ARGS) |
{ |
{ |
struct mdoc_node *n; |
struct mdoc_node *n; |
|
int hasnm, hasnd; |
|
|
/* |
hasnm = hasnd = 0; |
* Warn if the NAME section doesn't contain the `Nm' and `Nd' |
|
* macros (can have multiple `Nm' and one `Nd'). Note that the |
|
* children of the BODY declaration can also be "text". |
|
*/ |
|
|
|
if (NULL == (n = mdoc->last->child)) { |
for (n = mdoc->last->child; n != NULL; n = n->next) { |
mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse, |
switch (n->tok) { |
mdoc->last->line, mdoc->last->pos, "empty"); |
case MDOC_Nm: |
return; |
hasnm = 1; |
|
break; |
|
case MDOC_Nd: |
|
hasnd = 1; |
|
if (n->next != NULL) |
|
mandoc_msg(MANDOCERR_NAMESEC_ND, |
|
mdoc->parse, n->line, n->pos, NULL); |
|
break; |
|
case MDOC_MAX: |
|
if (hasnm) |
|
break; |
|
/* FALLTHROUGH */ |
|
default: |
|
mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse, |
|
n->line, n->pos, mdoc_macronames[n->tok]); |
|
break; |
|
} |
} |
} |
|
|
for ( ; n && n->next; n = n->next) { |
if ( ! hasnm) |
if (MDOC_ELEM == n->type && MDOC_Nm == n->tok) |
mandoc_msg(MANDOCERR_NAMESEC_NONM, mdoc->parse, |
continue; |
mdoc->last->line, mdoc->last->pos, NULL); |
if (MDOC_TEXT == n->type) |
if ( ! hasnd) |
continue; |
mandoc_msg(MANDOCERR_NAMESEC_NOND, mdoc->parse, |
mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse, |
mdoc->last->line, mdoc->last->pos, NULL); |
n->line, n->pos, mdoc_macronames[n->tok]); |
|
} |
|
|
|
assert(n); |
|
if (MDOC_BLOCK == n->type && MDOC_Nd == n->tok) |
|
return; |
|
|
|
mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse, |
|
n->line, n->pos, mdoc_macronames[n->tok]); |
|
} |
} |
|
|
static void |
static void |