version 1.169, 2011/05/17 11:38:18 |
version 1.177, 2011/08/18 09:16:01 |
|
|
#include "main.h" |
#include "main.h" |
|
|
#define INDENT 5 |
#define INDENT 5 |
#define HALFINDENT 3 |
|
|
|
#define MDOC_ARGS const struct mdoc_meta *m, \ |
#define MDOC_ARGS const struct mdoc_meta *m, \ |
const struct mdoc_node *n, \ |
const struct mdoc_node *n, \ |
Line 353 a2offs(const char *p, struct roffsu *su) |
|
Line 352 a2offs(const char *p, struct roffsu *su) |
|
SCALE_HS_INIT(su, INDENT); |
SCALE_HS_INIT(su, INDENT); |
else if (0 == strcmp(p, "indent-two")) |
else if (0 == strcmp(p, "indent-two")) |
SCALE_HS_INIT(su, INDENT * 2); |
SCALE_HS_INIT(su, INDENT * 2); |
else if ( ! a2roffsu(p, su, SCALE_MAX)) { |
else if ( ! a2roffsu(p, su, SCALE_MAX)) |
su->unit = SCALE_BU; |
SCALE_HS_INIT(su, html_strlen(p)); |
su->scale = html_strlen(p); |
|
} |
|
} |
} |
|
|
|
|
Line 407 print_mdoc_node(MDOC_ARGS) |
|
Line 404 print_mdoc_node(MDOC_ARGS) |
|
{ |
{ |
int child; |
int child; |
struct tag *t; |
struct tag *t; |
struct htmlpair tag; |
|
|
|
child = 1; |
child = 1; |
t = h->tags.head; |
t = h->tags.head; |
Line 434 print_mdoc_node(MDOC_ARGS) |
|
Line 430 print_mdoc_node(MDOC_ARGS) |
|
h->flags |= HTML_NOSPACE; |
h->flags |= HTML_NOSPACE; |
return; |
return; |
case (MDOC_EQN): |
case (MDOC_EQN): |
PAIR_CLASS_INIT(&tag, "eqn"); |
print_eqn(h, n->eqn); |
print_otag(h, TAG_SPAN, 1, &tag); |
|
print_text(h, n->eqn->data); |
|
break; |
break; |
case (MDOC_TBL): |
case (MDOC_TBL): |
/* |
/* |
Line 610 mdoc_sh_pre(MDOC_ARGS) |
|
Line 604 mdoc_sh_pre(MDOC_ARGS) |
|
return(1); |
return(1); |
|
|
bufinit(h); |
bufinit(h); |
for (n = n->child; n; n = n->next) { |
bufcat(h, "x"); |
|
|
|
for (n = n->child; n && MDOC_TEXT == n->type; ) { |
bufcat_id(h, n->string); |
bufcat_id(h, n->string); |
if (n->next) |
if (NULL != (n = n->next)) |
bufcat_id(h, " "); |
bufcat_id(h, " "); |
} |
} |
|
|
PAIR_ID_INIT(&tag, h->buf); |
if (NULL == n) { |
print_otag(h, TAG_H1, 1, &tag); |
PAIR_ID_INIT(&tag, h->buf); |
|
print_otag(h, TAG_H1, 1, &tag); |
|
} else |
|
print_otag(h, TAG_H1, 0, NULL); |
|
|
return(1); |
return(1); |
} |
} |
|
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
static int |
static int |
mdoc_ss_pre(MDOC_ARGS) |
mdoc_ss_pre(MDOC_ARGS) |
Line 636 mdoc_ss_pre(MDOC_ARGS) |
|
Line 635 mdoc_ss_pre(MDOC_ARGS) |
|
return(1); |
return(1); |
|
|
bufinit(h); |
bufinit(h); |
for (n = n->child; n; n = n->next) { |
bufcat(h, "x"); |
|
|
|
for (n = n->child; n && MDOC_TEXT == n->type; ) { |
bufcat_id(h, n->string); |
bufcat_id(h, n->string); |
if (n->next) |
if (NULL != (n = n->next)) |
bufcat_id(h, " "); |
bufcat_id(h, " "); |
} |
} |
|
|
PAIR_ID_INIT(&tag, h->buf); |
if (NULL == n) { |
print_otag(h, TAG_H2, 1, &tag); |
PAIR_ID_INIT(&tag, h->buf); |
|
print_otag(h, TAG_H2, 1, &tag); |
|
} else |
|
print_otag(h, TAG_H2, 0, NULL); |
|
|
return(1); |
return(1); |
} |
} |
|
|
Line 1172 mdoc_sx_pre(MDOC_ARGS) |
|
Line 1177 mdoc_sx_pre(MDOC_ARGS) |
|
|
|
bufinit(h); |
bufinit(h); |
bufcat(h, "#x"); |
bufcat(h, "#x"); |
for (n = n->child; n; n = n->next) { |
|
|
for (n = n->child; n; ) { |
bufcat_id(h, n->string); |
bufcat_id(h, n->string); |
if (n->next) |
if (NULL != (n = n->next)) |
bufcat_id(h, " "); |
bufcat_id(h, " "); |
} |
} |
|
|
Line 1633 mdoc_sp_pre(MDOC_ARGS) |
|
Line 1639 mdoc_sp_pre(MDOC_ARGS) |
|
SCALE_VS_INIT(&su, 1); |
SCALE_VS_INIT(&su, 1); |
|
|
if (MDOC_sp == n->tok) { |
if (MDOC_sp == n->tok) { |
if (n->child) |
if (NULL != (n = n->child)) |
a2roffsu(n->child->string, &su, SCALE_VS); |
if ( ! a2roffsu(n->string, &su, SCALE_VS)) |
|
SCALE_VS_INIT(&su, atoi(n->string)); |
} else |
} else |
su.scale = 0; |
su.scale = 0; |
|
|
Line 1666 mdoc_lk_pre(MDOC_ARGS) |
|
Line 1673 mdoc_lk_pre(MDOC_ARGS) |
|
|
|
print_otag(h, TAG_A, 2, tag); |
print_otag(h, TAG_A, 2, tag); |
|
|
for (n = n->next; n; n = n->next) { |
if (NULL == n->next) |
assert(MDOC_TEXT == n->type); |
|
print_text(h, n->string); |
print_text(h, n->string); |
} |
|
|
|
|
for (n = n->next; n; n = n->next) |
|
print_text(h, n->string); |
|
|
return(0); |
return(0); |
} |
} |
|
|
Line 1983 mdoc_li_pre(MDOC_ARGS) |
|
Line 1991 mdoc_li_pre(MDOC_ARGS) |
|
struct htmlpair tag; |
struct htmlpair tag; |
|
|
PAIR_CLASS_INIT(&tag, "lit"); |
PAIR_CLASS_INIT(&tag, "lit"); |
print_otag(h, TAG_SPAN, 1, &tag); |
print_otag(h, TAG_CODE, 1, &tag); |
return(1); |
return(1); |
} |
} |
|
|