diff options
-rw-r--r-- | libmdoc.h | 1 | ||||
-rw-r--r-- | mdoc.h | 1 | ||||
-rw-r--r-- | mdoc_action.c | 19 | ||||
-rw-r--r-- | mdoc_term.c | 15 | ||||
-rw-r--r-- | mdoc_validate.c | 2 |
5 files changed, 21 insertions, 17 deletions
@@ -154,6 +154,7 @@ time_t mdoc_atotime(const char *); size_t mdoc_macro2len(int); const char *mdoc_a2att(const char *); +const char *mdoc_a2st(const char *); const char *mdoc_a2arch(const char *); const char *mdoc_a2vol(const char *); const char *mdoc_a2msec(const char *); @@ -296,7 +296,6 @@ const struct mdoc_meta *mdoc_meta(const struct mdoc *); int mdoc_endparse(struct mdoc *); const char *mdoc_a2lib(const char *); -const char *mdoc_a2st(const char *); __END_DECLS diff --git a/mdoc_action.c b/mdoc_action.c index 5c880e2f..3da58be7 100644 --- a/mdoc_action.c +++ b/mdoc_action.c @@ -46,6 +46,7 @@ static int post_nm(POST_ARGS); static int post_os(POST_ARGS); static int post_prol(POST_ARGS); static int post_sh(POST_ARGS); +static int post_st(POST_ARGS); static int post_std(POST_ARGS); static int pre_bd(PRE_ARGS); @@ -89,7 +90,7 @@ const struct actions mdoc_actions[MDOC_MAX] = { { NULL, NULL }, /* Ot */ { NULL, NULL }, /* Pa */ { NULL, post_std }, /* Rv */ - { NULL, NULL }, /* St */ + { NULL, post_st }, /* St */ { NULL, NULL }, /* Va */ { NULL, NULL }, /* Vt */ { NULL, NULL }, /* Xr */ @@ -290,6 +291,22 @@ post_nm(POST_ARGS) static int +post_st(POST_ARGS) +{ + const char *p; + + assert(MDOC_TEXT == m->last->child->type); + p = mdoc_a2st(m->last->child->string); + assert(p); + free(m->last->child->string); + m->last->child->string = strdup(p); + if (NULL == m->last->child->string) + return(mdoc_nerr(m, m->last, EMALLOC)); + return(1); +} + + +static int post_at(POST_ARGS) { struct mdoc_node *n; diff --git a/mdoc_term.c b/mdoc_term.c index ecc33795..1728400e 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -166,7 +166,6 @@ static int termp_sh_pre(DECL_ARGS); static int termp_sm_pre(DECL_ARGS); static int termp_sq_pre(DECL_ARGS); static int termp_ss_pre(DECL_ARGS); -static int termp_st_pre(DECL_ARGS); static int termp_sx_pre(DECL_ARGS); static int termp_sy_pre(DECL_ARGS); static int termp_ud_pre(DECL_ARGS); @@ -213,7 +212,7 @@ static const struct termact termacts[MDOC_MAX] = { { NULL, NULL }, /* Ot */ { termp_pa_pre, NULL }, /* Pa */ { termp_rv_pre, NULL }, /* Rv */ - { termp_st_pre, NULL }, /* St */ + { NULL, NULL }, /* St */ { termp_va_pre, NULL }, /* Va */ { termp_vt_pre, termp_vt_post }, /* Vt */ { termp_xr_pre, NULL }, /* Xr */ @@ -1042,18 +1041,6 @@ termp_pp_pre(DECL_ARGS) /* ARGSUSED */ static int -termp_st_pre(DECL_ARGS) -{ - const char *cp; - - if (node->child && (cp = mdoc_a2st(node->child->string))) - term_word(p, cp); - return(0); -} - - -/* ARGSUSED */ -static int termp_rs_pre(DECL_ARGS) { diff --git a/mdoc_validate.c b/mdoc_validate.c index 22e88f04..8ac9ba24 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1131,7 +1131,7 @@ post_st(POST_ARGS) if (mdoc_a2st(mdoc->last->child->string)) return(1); - return(mdoc_nwarn(mdoc, mdoc->last, EBADSTAND)); + return(mdoc_nerr(mdoc, mdoc->last, EBADSTAND)); } |