version 1.307, 2018/06/25 13:45:57 |
version 1.311, 2018/08/17 20:33:37 |
|
|
#include "html.h" |
#include "html.h" |
#include "main.h" |
#include "main.h" |
|
|
#define INDENT 5 |
|
|
|
#define MDOC_ARGS const struct roff_meta *meta, \ |
#define MDOC_ARGS const struct roff_meta *meta, \ |
struct roff_node *n, \ |
struct roff_node *n, \ |
struct html *h |
struct html *h |
|
|
#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 121 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 243 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 404 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 425 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 719 mdoc_it_pre(MDOC_ARGS) |
|
Line 717 mdoc_it_pre(MDOC_ARGS) |
|
break; |
break; |
case ROFFT_BODY: |
case ROFFT_BODY: |
if (n->child == NULL) { |
if (n->child == NULL) { |
print_otag(h, TAG_DD, "ss?", |
print_otag(h, TAG_DD, "s", "width", "auto"); |
"width", "auto"); |
|
print_text(h, "\\ "); |
print_text(h, "\\ "); |
} else |
} else |
print_otag(h, TAG_DD, ""); |
print_otag(h, TAG_DD, ""); |
Line 1175 mdoc_fn_pre(MDOC_ARGS) |
|
Line 1172 mdoc_fn_pre(MDOC_ARGS) |
|
|
|
for (n = n->child->next; n; n = n->next) { |
for (n = n->child->next; n; n = n->next) { |
if (NODE_SYNPRETTY & n->flags) |
if (NODE_SYNPRETTY & n->flags) |
t = print_otag(h, TAG_VAR, "cTss?", "Fa", |
t = print_otag(h, TAG_VAR, "cTs", "Fa", |
"white-space", "nowrap"); |
"white-space", "nowrap"); |
else |
else |
t = print_otag(h, TAG_VAR, "cT", "Fa"); |
t = print_otag(h, TAG_VAR, "cT", "Fa"); |
Line 1416 mdoc_bf_pre(MDOC_ARGS) |
|
Line 1413 mdoc_bf_pre(MDOC_ARGS) |
|
cattr = "Bf No"; |
cattr = "Bf No"; |
|
|
/* Cannot use TAG_SPAN because it may contain blocks. */ |
/* Cannot use TAG_SPAN because it may contain blocks. */ |
print_otag(h, TAG_DIV, "cshl", cattr, 1); |
print_otag(h, TAG_DIV, "c", cattr); |
return 1; |
return 1; |
} |
} |
|
|