version 1.380, 2020/03/13 15:32:28 |
version 1.382, 2020/04/02 15:04:36 |
Line 96 static void post_fn(POST_ARGS); |
|
Line 96 static void post_fn(POST_ARGS); |
|
static void post_fname(POST_ARGS); |
static void post_fname(POST_ARGS); |
static void post_fo(POST_ARGS); |
static void post_fo(POST_ARGS); |
static void post_hyph(POST_ARGS); |
static void post_hyph(POST_ARGS); |
static void post_ignpar(POST_ARGS); |
|
static void post_it(POST_ARGS); |
static void post_it(POST_ARGS); |
static void post_lb(POST_ARGS); |
static void post_lb(POST_ARGS); |
static void post_nd(POST_ARGS); |
static void post_nd(POST_ARGS); |
Line 109 static void post_prevpar(POST_ARGS); |
|
Line 108 static void post_prevpar(POST_ARGS); |
|
static void post_root(POST_ARGS); |
static void post_root(POST_ARGS); |
static void post_rs(POST_ARGS); |
static void post_rs(POST_ARGS); |
static void post_rv(POST_ARGS); |
static void post_rv(POST_ARGS); |
|
static void post_section(POST_ARGS); |
static void post_sh(POST_ARGS); |
static void post_sh(POST_ARGS); |
static void post_sh_head(POST_ARGS); |
static void post_sh_head(POST_ARGS); |
static void post_sh_name(POST_ARGS); |
static void post_sh_name(POST_ARGS); |
Line 129 static const v_post mdoc_valids[MDOC_MAX - MDOC_Dd] = |
|
Line 129 static const v_post mdoc_valids[MDOC_MAX - MDOC_Dd] = |
|
post_dt, /* Dt */ |
post_dt, /* Dt */ |
post_os, /* Os */ |
post_os, /* Os */ |
post_sh, /* Sh */ |
post_sh, /* Sh */ |
post_ignpar, /* Ss */ |
post_section, /* Ss */ |
post_par, /* Pp */ |
post_par, /* Pp */ |
post_display, /* D1 */ |
post_display, /* D1 */ |
post_display, /* Dl */ |
post_display, /* Dl */ |
Line 2164 post_rs(POST_ARGS) |
|
Line 2164 post_rs(POST_ARGS) |
|
static void |
static void |
post_hyph(POST_ARGS) |
post_hyph(POST_ARGS) |
{ |
{ |
struct roff_node *nch; |
struct roff_node *n, *nch; |
char *cp; |
char *cp; |
|
|
for (nch = mdoc->last->child; nch != NULL; nch = nch->next) { |
n = mdoc->last; |
|
for (nch = n->child; nch != NULL; nch = nch->next) { |
if (nch->type != ROFFT_TEXT) |
if (nch->type != ROFFT_TEXT) |
continue; |
continue; |
cp = nch->string; |
cp = nch->string; |
Line 2176 post_hyph(POST_ARGS) |
|
Line 2177 post_hyph(POST_ARGS) |
|
while (*(++cp) != '\0') |
while (*(++cp) != '\0') |
if (*cp == '-' && |
if (*cp == '-' && |
isalpha((unsigned char)cp[-1]) && |
isalpha((unsigned char)cp[-1]) && |
isalpha((unsigned char)cp[1])) |
isalpha((unsigned char)cp[1])) { |
|
if (n->string == NULL && n->flags & NODE_ID) |
|
n->string = mandoc_strdup(nch->string); |
*cp = ASCII_HYPH; |
*cp = ASCII_HYPH; |
|
} |
} |
} |
} |
} |
|
|
Line 2202 post_sx(POST_ARGS) |
|
Line 2206 post_sx(POST_ARGS) |
|
static void |
static void |
post_sh(POST_ARGS) |
post_sh(POST_ARGS) |
{ |
{ |
post_ignpar(mdoc); |
post_section(mdoc); |
|
|
switch (mdoc->last->type) { |
switch (mdoc->last->type) { |
case ROFFT_HEAD: |
case ROFFT_HEAD: |
Line 2535 post_xr(POST_ARGS) |
|
Line 2539 post_xr(POST_ARGS) |
|
} |
} |
|
|
static void |
static void |
post_ignpar(POST_ARGS) |
post_section(POST_ARGS) |
{ |
{ |
struct roff_node *np; |
struct roff_node *n, *nch; |
|
char *cp, *tag; |
|
|
switch (mdoc->last->type) { |
n = mdoc->last; |
|
switch (n->type) { |
case ROFFT_BLOCK: |
case ROFFT_BLOCK: |
post_prevpar(mdoc); |
post_prevpar(mdoc); |
return; |
return; |
case ROFFT_HEAD: |
case ROFFT_HEAD: |
|
tag = NULL; |
|
deroff(&tag, n); |
|
if (tag != NULL) { |
|
for (cp = tag; *cp != '\0'; cp++) |
|
if (*cp == ' ') |
|
*cp = '_'; |
|
if ((nch = n->child) != NULL && |
|
nch->type == ROFFT_TEXT && |
|
strcmp(nch->string, tag) == 0) |
|
tag_put(NULL, TAG_WEAK, n); |
|
else |
|
tag_put(tag, TAG_FALLBACK, n); |
|
free(tag); |
|
} |
post_delim(mdoc); |
post_delim(mdoc); |
post_hyph(mdoc); |
post_hyph(mdoc); |
return; |
return; |
Line 2552 post_ignpar(POST_ARGS) |
|
Line 2572 post_ignpar(POST_ARGS) |
|
default: |
default: |
return; |
return; |
} |
} |
|
if ((nch = n->child) != NULL && |
if ((np = mdoc->last->child) != NULL) |
(nch->tok == MDOC_Pp || nch->tok == ROFF_br || |
if (np->tok == MDOC_Pp || |
nch->tok == ROFF_sp)) { |
np->tok == ROFF_br || np->tok == ROFF_sp) { |
mandoc_msg(MANDOCERR_PAR_SKIP, nch->line, nch->pos, |
mandoc_msg(MANDOCERR_PAR_SKIP, np->line, np->pos, |
"%s after %s", roff_name[nch->tok], |
"%s after %s", roff_name[np->tok], |
roff_name[n->tok]); |
roff_name[mdoc->last->tok]); |
roff_node_delete(mdoc, nch); |
roff_node_delete(mdoc, np); |
} |
} |
if ((nch = n->last) != NULL && |
|
(nch->tok == MDOC_Pp || nch->tok == ROFF_br)) { |
if ((np = mdoc->last->last) != NULL) |
mandoc_msg(MANDOCERR_PAR_SKIP, nch->line, nch->pos, |
if (np->tok == MDOC_Pp || np->tok == ROFF_br) { |
"%s at the end of %s", roff_name[nch->tok], |
mandoc_msg(MANDOCERR_PAR_SKIP, np->line, np->pos, |
roff_name[n->tok]); |
"%s at the end of %s", roff_name[np->tok], |
roff_node_delete(mdoc, nch); |
roff_name[mdoc->last->tok]); |
} |
roff_node_delete(mdoc, np); |
|
} |
|
} |
} |
|
|
static void |
static void |