diff options
-rw-r--r-- | mdoc_html.c | 2 | ||||
-rw-r--r-- | mdoc_man.c | 6 | ||||
-rw-r--r-- | mdoc_term.c | 4 | ||||
-rw-r--r-- | mdoc_validate.c | 10 |
4 files changed, 13 insertions, 9 deletions
diff --git a/mdoc_html.c b/mdoc_html.c index 26b20ed1..a3c3cced 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -582,8 +582,6 @@ mdoc_nm_pre(MDOC_ARGS) /* FALLTHROUGH */ case ROFFT_ELEM: print_otag(h, TAG_B, "c", "Nm"); - if (n->child == NULL && meta->name != NULL) - print_text(h, meta->name); return 1; case ROFFT_BODY: print_otag(h, TAG_TD, ""); @@ -1518,7 +1518,7 @@ pre_nm(DECL_ARGS) } if (n->type != ROFFT_ELEM && n->type != ROFFT_HEAD) return 1; - name = n->child ? n->child->string : meta->name; + name = n->child == NULL ? NULL : n->child->string; if (NULL == name) return 0; if (n->type == ROFFT_HEAD) { @@ -1529,8 +1529,6 @@ pre_nm(DECL_ARGS) outflags |= MMAN_nl; } font_push('B'); - if (NULL == n->child) - print_word(meta->name); return 1; } @@ -1544,7 +1542,7 @@ post_nm(DECL_ARGS) break; case ROFFT_HEAD: case ROFFT_ELEM: - if (n->child != NULL || meta->name != NULL) + if (n->child != NULL && n->child->string != NULL) font_pop(); break; default: diff --git a/mdoc_term.c b/mdoc_term.c index 1feddb55..b35f951d 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -996,7 +996,7 @@ termp_nm_pre(DECL_ARGS) return 1; } - if (NULL == n->child && NULL == meta->name) + if (n->child == NULL) return 0; if (n->type == ROFFT_HEAD) @@ -1020,8 +1020,6 @@ termp_nm_pre(DECL_ARGS) } term_fontpush(p, TERMFONT_BOLD); - if (NULL == n->child) - term_word(p, meta->name); return 1; } diff --git a/mdoc_validate.c b/mdoc_validate.c index 885d6281..48d4fd31 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1013,6 +1013,16 @@ post_nm(POST_ARGS) (mdoc->lastsec == SEC_NAME && n->child == NULL)) mandoc_msg(MANDOCERR_NM_NONAME, mdoc->parse, n->line, n->pos, "Nm"); + + if ((n->type != ROFFT_ELEM && n->type != ROFFT_HEAD) || + (n->child != NULL && n->child->type == ROFFT_TEXT) || + mdoc->meta.name == NULL) + return; + + mdoc->next = ROFF_NEXT_CHILD; + roff_word_alloc(mdoc, n->line, n->pos, mdoc->meta.name); + mdoc->last->flags |= NODE_NOSRC; + mdoc->last = n; } static void |