version 1.310, 2018/07/27 17:49:31 |
version 1.313, 2018/10/02 14:56:47 |
|
|
#define MIN(a,b) ((/*CONSTCOND*/(a)<(b))?(a):(b)) |
#define MIN(a,b) ((/*CONSTCOND*/(a)<(b))?(a):(b)) |
#endif |
#endif |
|
|
struct htmlmdoc { |
struct mdoc_html_act { |
int (*pre)(MDOC_ARGS); |
int (*pre)(MDOC_ARGS); |
void (*post)(MDOC_ARGS); |
void (*post)(MDOC_ARGS); |
}; |
}; |
Line 119 static int mdoc_vt_pre(MDOC_ARGS); |
|
Line 119 static int mdoc_vt_pre(MDOC_ARGS); |
|
static int mdoc_xr_pre(MDOC_ARGS); |
static int mdoc_xr_pre(MDOC_ARGS); |
static int mdoc_xx_pre(MDOC_ARGS); |
static int mdoc_xx_pre(MDOC_ARGS); |
|
|
static const struct htmlmdoc __mdocs[MDOC_MAX - MDOC_Dd] = { |
static const struct mdoc_html_act mdoc_html_acts[MDOC_MAX - MDOC_Dd] = { |
{NULL, NULL}, /* Dd */ |
{NULL, NULL}, /* Dd */ |
{NULL, NULL}, /* Dt */ |
{NULL, NULL}, /* Dt */ |
{NULL, NULL}, /* Os */ |
{NULL, NULL}, /* Os */ |
Line 241 static const struct htmlmdoc __mdocs[MDOC_MAX - MDOC_D |
|
Line 241 static const struct htmlmdoc __mdocs[MDOC_MAX - MDOC_D |
|
{mdoc__x_pre, mdoc__x_post}, /* %U */ |
{mdoc__x_pre, mdoc__x_post}, /* %U */ |
{NULL, NULL}, /* Ta */ |
{NULL, NULL}, /* Ta */ |
}; |
}; |
static const struct htmlmdoc *const mdocs = __mdocs - MDOC_Dd; |
|
|
|
|
|
/* |
/* |
Line 402 print_mdoc_node(MDOC_ARGS) |
|
Line 401 print_mdoc_node(MDOC_ARGS) |
|
break; |
break; |
} |
} |
assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX); |
assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX); |
if (mdocs[n->tok].pre != NULL && |
if (mdoc_html_acts[n->tok - MDOC_Dd].pre != NULL && |
(n->end == ENDBODY_NOT || n->child != NULL)) |
(n->end == ENDBODY_NOT || n->child != NULL)) |
child = (*mdocs[n->tok].pre)(meta, n, h); |
child = (*mdoc_html_acts[n->tok - MDOC_Dd].pre)(meta, |
|
n, h); |
break; |
break; |
} |
} |
|
|
Line 423 print_mdoc_node(MDOC_ARGS) |
|
Line 423 print_mdoc_node(MDOC_ARGS) |
|
break; |
break; |
default: |
default: |
if (n->tok < ROFF_MAX || |
if (n->tok < ROFF_MAX || |
mdocs[n->tok].post == NULL || |
mdoc_html_acts[n->tok - MDOC_Dd].post == NULL || |
n->flags & NODE_ENDED) |
n->flags & NODE_ENDED) |
break; |
break; |
(*mdocs[n->tok].post)(meta, n, h); |
(*mdoc_html_acts[n->tok - MDOC_Dd].post)(meta, n, h); |
if (n->end != ENDBODY_NOT) |
if (n->end != ENDBODY_NOT) |
n->body->flags |= NODE_ENDED; |
n->body->flags |= NODE_ENDED; |
break; |
break; |
Line 507 cond_id(const struct roff_node *n) |
|
Line 507 cond_id(const struct roff_node *n) |
|
static int |
static int |
mdoc_sh_pre(MDOC_ARGS) |
mdoc_sh_pre(MDOC_ARGS) |
{ |
{ |
char *id; |
struct roff_node *sn; |
|
struct tag *t, *tt; |
|
char *id; |
|
int sc; |
|
|
switch (n->type) { |
switch (n->type) { |
|
case ROFFT_BLOCK: |
|
if ((h->oflags & HTML_TOC) == 0 || |
|
h->flags & HTML_TOCDONE || |
|
n->sec <= SEC_SYNOPSIS) |
|
break; |
|
h->flags |= HTML_TOCDONE; |
|
sc = 0; |
|
for (sn = n->next; sn != NULL; sn = sn->next) |
|
if (sn->sec == SEC_CUSTOM) |
|
if (++sc == 2) |
|
break; |
|
if (sc < 2) |
|
break; |
|
t = print_otag(h, TAG_H1, "c", "Sh"); |
|
print_text(h, "TABLE OF CONTENTS"); |
|
print_tagq(h, t); |
|
t = print_otag(h, TAG_UL, "c", "Bl-compact"); |
|
for (sn = n->next; sn != NULL; sn = sn->next) { |
|
id = html_make_id(sn->head, 0); |
|
tt = print_otag(h, TAG_LI, ""); |
|
print_otag(h, TAG_A, "hR", id); |
|
print_mdoc_nodelist(meta, sn->head->child, h); |
|
print_tagq(h, tt); |
|
free(id); |
|
} |
|
print_tagq(h, t); |
|
break; |
case ROFFT_HEAD: |
case ROFFT_HEAD: |
id = html_make_id(n, 1); |
id = html_make_id(n, 1); |
print_otag(h, TAG_H1, "cTi", "Sh", id); |
print_otag(h, TAG_H1, "cTi", "Sh", id); |
Line 611 mdoc_xr_pre(MDOC_ARGS) |
|
Line 641 mdoc_xr_pre(MDOC_ARGS) |
|
if (NULL == n->child) |
if (NULL == n->child) |
return 0; |
return 0; |
|
|
if (h->base_man) |
if (h->base_man1) |
print_otag(h, TAG_A, "cThM", "Xr", |
print_otag(h, TAG_A, "cThM", "Xr", |
n->child->string, n->child->next == NULL ? |
n->child->string, n->child->next == NULL ? |
NULL : n->child->next->string); |
NULL : n->child->next->string); |