version 1.11, 2009/09/25 12:43:05 |
version 1.21, 2009/10/04 09:00:40 |
|
|
#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, \ |
struct html *h |
struct html *h |
#define MAN_ARGS const struct man_meta *m, \ |
|
const struct man_node *n, \ |
|
struct html *h |
|
|
|
struct htmlmdoc { |
struct htmlmdoc { |
int (*pre)(MDOC_ARGS); |
int (*pre)(MDOC_ARGS); |
Line 255 static const struct htmlmdoc mdocs[MDOC_MAX] = { |
|
Line 252 static const struct htmlmdoc mdocs[MDOC_MAX] = { |
|
{mdoc_sp_pre, NULL}, /* sp */ |
{mdoc_sp_pre, NULL}, /* sp */ |
}; |
}; |
|
|
static char buf[BUFSIZ]; /* XXX */ |
|
|
|
#define bufcat(x) (void)strlcat(buf, (x), BUFSIZ) |
|
#define bufinit() buf[0] = 0 |
|
#define buffmt(...) (void)snprintf(buf, BUFSIZ - 1, __VA_ARGS__) |
|
|
|
void |
void |
html_mdoc(void *arg, const struct mdoc *m) |
html_mdoc(void *arg, const struct mdoc *m) |
{ |
{ |
Line 390 print_mdoc(MDOC_ARGS) |
|
Line 382 print_mdoc(MDOC_ARGS) |
|
static void |
static void |
print_mdoc_head(MDOC_ARGS) |
print_mdoc_head(MDOC_ARGS) |
{ |
{ |
char b[BUFSIZ]; |
|
|
|
print_gen_head(h); |
print_gen_head(h); |
|
bufinit(h); |
|
buffmt(h, "%s(%d)", m->title, m->msec); |
|
|
(void)snprintf(b, BUFSIZ - 1, |
|
"%s(%d)", m->title, m->msec); |
|
|
|
if (m->arch) { |
if (m->arch) { |
(void)strlcat(b, " (", BUFSIZ); |
bufcat(h, " ("); |
(void)strlcat(b, m->arch, BUFSIZ); |
bufcat(h, m->arch); |
(void)strlcat(b, ")", BUFSIZ); |
bufcat(h, ")"); |
} |
} |
|
|
print_otag(h, TAG_TITLE, 0, NULL); |
print_otag(h, TAG_TITLE, 0, NULL); |
print_text(h, b); |
print_text(h, h->buf); |
} |
} |
|
|
|
|
Line 427 print_mdoc_node(MDOC_ARGS) |
|
Line 417 print_mdoc_node(MDOC_ARGS) |
|
child = 1; |
child = 1; |
t = SLIST_FIRST(&h->tags); |
t = SLIST_FIRST(&h->tags); |
|
|
bufinit(); |
bufinit(h); |
|
|
switch (n->type) { |
switch (n->type) { |
case (MDOC_ROOT): |
case (MDOC_ROOT): |
Line 447 print_mdoc_node(MDOC_ARGS) |
|
Line 437 print_mdoc_node(MDOC_ARGS) |
|
|
|
print_stagq(h, t); |
print_stagq(h, t); |
|
|
bufinit(); |
bufinit(h); |
|
|
switch (n->type) { |
switch (n->type) { |
case (MDOC_ROOT): |
case (MDOC_ROOT): |
Line 552 mdoc_sh_pre(MDOC_ARGS) |
|
Line 542 mdoc_sh_pre(MDOC_ARGS) |
|
{ |
{ |
struct htmlpair tag[2]; |
struct htmlpair tag[2]; |
const struct mdoc_node *nn; |
const struct mdoc_node *nn; |
|
char link[BUFSIZ]; |
|
|
if (MDOC_HEAD == n->type) { |
if (MDOC_BODY == n->type) { |
|
buffmt(h, "margin-left: %dem;", INDENT); |
|
|
tag[0].key = ATTR_CLASS; |
tag[0].key = ATTR_CLASS; |
tag[0].val = "sec-head"; |
tag[0].val = "sec-body"; |
print_otag(h, TAG_DIV, 1, tag); |
tag[1].key = ATTR_STYLE; |
print_otag(h, TAG_SPAN, 1, tag); |
tag[1].val = h->buf; |
|
|
for (nn = n->child; nn; nn = nn->next) { |
print_otag(h, TAG_DIV, 2, tag); |
bufcat(nn->string); |
|
if (nn->next) |
|
bufcat(" "); |
|
} |
|
tag[0].key = ATTR_NAME; |
|
tag[0].val = buf; |
|
print_otag(h, TAG_A, 1, tag); |
|
return(1); |
return(1); |
} else if (MDOC_BLOCK == n->type) { |
} else if (MDOC_BLOCK == n->type) { |
tag[0].key = ATTR_CLASS; |
tag[0].key = ATTR_CLASS; |
Line 577 mdoc_sh_pre(MDOC_ARGS) |
|
Line 563 mdoc_sh_pre(MDOC_ARGS) |
|
return(1); |
return(1); |
} |
} |
|
|
bufcat("margin-top: 1em;"); |
bufcat(h, "margin-top: 1em;"); |
if (NULL == n->next) |
if (NULL == n->next) |
bufcat("margin-bottom: 1em;"); |
bufcat(h, "margin-bottom: 1em;"); |
|
|
tag[1].key = ATTR_STYLE; |
tag[1].key = ATTR_STYLE; |
tag[1].val = buf; |
tag[1].val = h->buf; |
|
|
print_otag(h, TAG_DIV, 2, tag); |
print_otag(h, TAG_DIV, 2, tag); |
return(1); |
return(1); |
} |
} |
|
|
buffmt("margin-left: %dem;", INDENT); |
link[0] = 0; |
|
for (nn = n->child; nn; nn = nn->next) { |
|
(void)strlcat(link, nn->string, BUFSIZ); |
|
if (nn->next) |
|
(void)strlcat(link, "_", BUFSIZ); |
|
} |
|
|
tag[0].key = ATTR_CLASS; |
tag[0].key = ATTR_CLASS; |
tag[0].val = "sec-body"; |
tag[0].val = "sec-head"; |
tag[1].key = ATTR_STYLE; |
tag[1].key = ATTR_ID; |
tag[1].val = buf; |
tag[1].val = link; |
|
|
print_otag(h, TAG_DIV, 2, tag); |
print_otag(h, TAG_DIV, 2, tag); |
return(1); |
return(1); |
Line 604 mdoc_sh_pre(MDOC_ARGS) |
|
Line 594 mdoc_sh_pre(MDOC_ARGS) |
|
static int |
static int |
mdoc_ss_pre(MDOC_ARGS) |
mdoc_ss_pre(MDOC_ARGS) |
{ |
{ |
struct htmlpair tag[2]; |
struct htmlpair tag[3]; |
int i; |
int i; |
const struct mdoc_node *nn; |
const struct mdoc_node *nn; |
|
char link[BUFSIZ]; |
|
|
i = 0; |
i = 0; |
|
|
if (MDOC_BODY == n->type) { |
if (MDOC_BODY == n->type) { |
tag[i].key = ATTR_CLASS; |
tag[i].key = ATTR_CLASS; |
tag[i++].val = "ssec-body"; |
tag[i++].val = "ssec-body"; |
|
|
if (n->parent->next && n->child) { |
if (n->parent->next && n->child) { |
bufcat("margin-bottom: 1em;"); |
bufcat(h, "margin-bottom: 1em;"); |
tag[i].key = ATTR_STYLE; |
tag[i].key = ATTR_STYLE; |
tag[i++].val = buf; |
tag[i++].val = h->buf; |
} |
} |
|
|
print_otag(h, TAG_DIV, i, tag); |
print_otag(h, TAG_DIV, i, tag); |
return(1); |
return(1); |
} else if (MDOC_BLOCK == n->type) { |
} else if (MDOC_BLOCK == n->type) { |
tag[i].key = ATTR_CLASS; |
tag[i].key = ATTR_CLASS; |
tag[i++].val = "ssec-block"; |
tag[i++].val = "ssec-block"; |
|
|
if (n->prev) { |
if (n->prev) { |
bufcat("margin-top: 1em;"); |
bufcat(h, "margin-top: 1em;"); |
tag[i].key = ATTR_STYLE; |
tag[i].key = ATTR_STYLE; |
tag[i++].val = buf; |
tag[i++].val = h->buf; |
} |
} |
|
|
print_otag(h, TAG_DIV, i, tag); |
print_otag(h, TAG_DIV, i, tag); |
return(1); |
return(1); |
} |
} |
|
|
buffmt("margin-left: -%dem;", INDENT - HALFINDENT); |
link[0] = 0; |
|
for (nn = n->child; nn; nn = nn->next) { |
|
(void)strlcat(link, nn->string, BUFSIZ); |
|
if (nn->next) |
|
(void)strlcat(link, "_", BUFSIZ); |
|
} |
|
|
|
buffmt(h, "margin-left: -%dem;", INDENT - HALFINDENT); |
|
|
tag[0].key = ATTR_CLASS; |
tag[0].key = ATTR_CLASS; |
tag[0].val = "ssec-head"; |
tag[0].val = "ssec-head"; |
tag[1].key = ATTR_STYLE; |
tag[1].key = ATTR_STYLE; |
tag[1].val = buf; |
tag[1].val = h->buf; |
|
tag[2].key = ATTR_ID; |
|
tag[2].val = link; |
|
|
print_otag(h, TAG_DIV, 2, tag); |
print_otag(h, TAG_DIV, 3, tag); |
print_otag(h, TAG_SPAN, 1, tag); |
|
|
|
bufinit(); |
|
for (nn = n->child; nn; nn = nn->next) { |
|
bufcat(nn->string); |
|
if (nn->next) |
|
bufcat(" "); |
|
} |
|
tag[0].key = ATTR_NAME; |
|
tag[0].val = buf; |
|
print_otag(h, TAG_A, 1, tag); |
|
|
|
return(1); |
return(1); |
} |
} |
|
|
|
|
mdoc_xr_pre(MDOC_ARGS) |
mdoc_xr_pre(MDOC_ARGS) |
{ |
{ |
struct htmlpair tag[2]; |
struct htmlpair tag[2]; |
const char *name, *sec; |
|
const struct mdoc_node *nn; |
const struct mdoc_node *nn; |
|
int i; |
|
|
nn = n->child; |
i = 0; |
name = nn && nn->string ? nn->string : ""; |
tag[i].key = ATTR_CLASS; |
nn = nn ? nn->next : NULL; |
tag[i++].val = "link-man"; |
sec = nn && nn->string ? nn->string : ""; |
|
|
|
buffmt("%s%s%s.html", name, name && sec ? "." : "", sec); |
if (h->base_man) { |
|
buffmt_man(h, n->child->string, n->child->next ? |
|
n->child->next->string : NULL); |
|
tag[i].key = ATTR_HREF; |
|
tag[i++].val = h->buf; |
|
} |
|
|
tag[0].key = ATTR_CLASS; |
print_otag(h, TAG_A, i, tag); |
tag[0].val = "link-man"; |
|
tag[1].key = ATTR_HREF; |
|
tag[1].val = buf; |
|
print_otag(h, TAG_A, 2, tag); |
|
|
|
nn = n->child; |
nn = n->child; |
print_text(h, nn->string); |
print_text(h, nn->string); |
|
|
if (NULL == (nn = nn->next)) |
if (NULL == (nn = nn->next)) |
return(0); |
return(0); |
|
|
Line 873 mdoc_bx_pre(MDOC_ARGS) |
|
Line 866 mdoc_bx_pre(MDOC_ARGS) |
|
static int |
static int |
mdoc_tbl_block_pre(MDOC_ARGS, int t, int w, int o, int c) |
mdoc_tbl_block_pre(MDOC_ARGS, int t, int w, int o, int c) |
{ |
{ |
struct htmlpair tag; |
struct htmlpair tag; |
|
const struct mdoc_node *nn; |
|
|
switch (t) { |
switch (t) { |
case (MDOC_Column): |
case (MDOC_Column): |
Line 881 mdoc_tbl_block_pre(MDOC_ARGS, int t, int w, int o, int |
|
Line 875 mdoc_tbl_block_pre(MDOC_ARGS, int t, int w, int o, int |
|
case (MDOC_Item): |
case (MDOC_Item): |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case (MDOC_Ohang): |
case (MDOC_Ohang): |
buffmt("margin-left: %dem; clear: both;", o); |
buffmt(h, "margin-left: %dem; clear: both;", o); |
break; |
break; |
default: |
default: |
buffmt("margin-left: %dem; clear: both;", w + o); |
buffmt(h, "margin-left: %dem; clear: both;", w + o); |
break; |
break; |
} |
} |
|
|
if ( ! c && MDOC_Column != t) { |
if ( ! c && MDOC_Column != t) { |
if (n->prev && n->prev->body->child) |
for (nn = n; nn; nn = nn->parent) { |
bufcat("padding-top: 1em;"); |
if (MDOC_BLOCK != nn->type) |
else if (NULL == n->prev) |
continue; |
bufcat("padding-top: 1em;"); |
switch (nn->tok) { |
|
case (MDOC_Ss): |
|
/* FALLTHROUGH */ |
|
case (MDOC_Sh): |
|
c = 1; |
|
break; |
|
default: |
|
break; |
|
} |
|
if (nn->prev) |
|
break; |
|
} |
|
if (MDOC_Diag == t && n->prev) |
|
if (NULL == n->prev->body->child) |
|
c = 1; |
|
if ( ! c) |
|
bufcat(h, "padding-top: 1em;"); |
} |
} |
|
|
tag.key = ATTR_STYLE; |
tag.key = ATTR_STYLE; |
tag.val = buf; |
tag.val = h->buf; |
print_otag(h, TAG_DIV, 1, &tag); |
print_otag(h, TAG_DIV, 1, &tag); |
return(1); |
return(1); |
} |
} |
Line 927 mdoc_tbl_head_pre(MDOC_ARGS, int t, int w) |
|
Line 937 mdoc_tbl_head_pre(MDOC_ARGS, int t, int w) |
|
print_otag(h, TAG_DIV, 0, NULL); |
print_otag(h, TAG_DIV, 0, NULL); |
break; |
break; |
case (MDOC_Column): |
case (MDOC_Column): |
buffmt("min-width: %dem;", w); |
buffmt(h, "min-width: %dem;", w); |
bufcat("clear: none;"); |
bufcat(h, "clear: none;"); |
if (n->next && MDOC_HEAD == n->next->type) |
if (n->next && MDOC_HEAD == n->next->type) |
bufcat("float: left;"); |
bufcat(h, "float: left;"); |
tag.key = ATTR_STYLE; |
tag.key = ATTR_STYLE; |
tag.val = buf; |
tag.val = h->buf; |
print_otag(h, TAG_DIV, 1, &tag); |
print_otag(h, TAG_DIV, 1, &tag); |
break; |
break; |
default: |
default: |
buffmt("margin-left: -%dem; min-width: %dem;", |
buffmt(h, "margin-left: -%dem; min-width: %dem;", |
w, w ? w - 1 : 0); |
w, w ? w - 1 : 0); |
bufcat("clear: left;"); |
bufcat(h, "clear: left;"); |
if (n->next && n->next->child) |
if (n->next && n->next->child) |
bufcat("float: left;"); |
bufcat(h, "float: left;"); |
bufcat("padding-right: 1em;"); |
bufcat(h, "padding-right: 1em;"); |
tag.key = ATTR_STYLE; |
tag.key = ATTR_STYLE; |
tag.val = buf; |
tag.val = h->buf; |
print_otag(h, TAG_DIV, 1, &tag); |
print_otag(h, TAG_DIV, 1, &tag); |
break; |
break; |
} |
} |
Line 988 mdoc_tbl_pre(MDOC_ARGS, int type) |
|
Line 998 mdoc_tbl_pre(MDOC_ARGS, int type) |
|
if (MDOC_BLOCK != n->type) |
if (MDOC_BLOCK != n->type) |
bl = bl->parent; |
bl = bl->parent; |
|
|
/* FIXME: fmt_vspace() equivalent. */ |
|
|
|
assert(bl->args); |
assert(bl->args); |
|
|
w = o = c = 0; |
w = o = c = 0; |
Line 1065 mdoc_bl_pre(MDOC_ARGS) |
|
Line 1073 mdoc_bl_pre(MDOC_ARGS) |
|
if (MDOC_Enum != a2list(n)) |
if (MDOC_Enum != a2list(n)) |
return(1); |
return(1); |
|
|
|
/* Allocate an -enum on the stack of indices. */ |
|
|
ord = malloc(sizeof(struct ord)); |
ord = malloc(sizeof(struct ord)); |
if (NULL == ord) |
if (NULL == ord) |
err(EXIT_FAILURE, "malloc"); |
err(EXIT_FAILURE, "malloc"); |
Line 1243 mdoc_d1_pre(MDOC_ARGS) |
|
Line 1253 mdoc_d1_pre(MDOC_ARGS) |
|
if (MDOC_BLOCK != n->type) |
if (MDOC_BLOCK != n->type) |
return(1); |
return(1); |
|
|
buffmt("margin-left: %dem;", INDENT); |
buffmt(h, "margin-left: %dem;", INDENT); |
|
|
tag[0].key = ATTR_CLASS; |
tag[0].key = ATTR_CLASS; |
tag[0].val = "lit"; |
tag[0].val = "lit"; |
tag[1].key = ATTR_STYLE; |
tag[1].key = ATTR_STYLE; |
tag[1].val = buf; |
tag[1].val = h->buf; |
|
|
print_otag(h, TAG_DIV, 2, tag); |
print_otag(h, TAG_DIV, 2, tag); |
return(1); |
return(1); |
Line 1261 mdoc_sx_pre(MDOC_ARGS) |
|
Line 1271 mdoc_sx_pre(MDOC_ARGS) |
|
{ |
{ |
struct htmlpair tag[2]; |
struct htmlpair tag[2]; |
const struct mdoc_node *nn; |
const struct mdoc_node *nn; |
|
char link[BUFSIZ]; |
|
|
bufcat("#"); |
(void)strlcpy(link, "#", BUFSIZ); |
for (nn = n->child; nn; nn = nn->next) { |
for (nn = n->child; nn; nn = nn->next) { |
bufcat(nn->string); |
(void)strlcat(link, nn->string, BUFSIZ); |
if (nn->next) |
if (nn->next) |
bufcat(" "); |
(void)strlcat(link, "_", BUFSIZ); |
} |
} |
|
|
tag[0].key = ATTR_HREF; |
tag[0].key = ATTR_CLASS; |
tag[0].val = buf; |
tag[0].val = "link-sec"; |
tag[1].key = ATTR_CLASS; |
tag[1].key = ATTR_HREF; |
tag[1].val = "link-sec"; |
tag[1].val = link; |
|
|
print_otag(h, TAG_A, 2, tag); |
print_otag(h, TAG_A, 2, tag); |
return(1); |
return(1); |
Line 1310 mdoc_bd_pre(MDOC_ARGS) |
|
Line 1321 mdoc_bd_pre(MDOC_ARGS) |
|
{ |
{ |
struct htmlpair tag[2]; |
struct htmlpair tag[2]; |
int t, c, o, i; |
int t, c, o, i; |
const struct mdoc_node *bl; |
const struct mdoc_node *bl, *nn; |
|
|
/* FIXME: fmt_vspace() shit. */ |
|
|
|
if (MDOC_BLOCK == n->type) |
if (MDOC_BLOCK == n->type) |
bl = n; |
bl = n; |
else if (MDOC_HEAD == n->type) |
else if (MDOC_HEAD == n->type) |
Line 1327 mdoc_bd_pre(MDOC_ARGS) |
|
Line 1336 mdoc_bd_pre(MDOC_ARGS) |
|
switch (bl->args->argv[i].arg) { |
switch (bl->args->argv[i].arg) { |
case (MDOC_Offset): |
case (MDOC_Offset): |
assert(bl->args->argv[i].sz); |
assert(bl->args->argv[i].sz); |
o = a2offs (bl->args->argv[i].value[0]); |
o = a2offs(bl->args->argv[i].value[0]); |
break; |
break; |
case (MDOC_Compact): |
case (MDOC_Compact): |
c = 1; |
c = 1; |
Line 1345 mdoc_bd_pre(MDOC_ARGS) |
|
Line 1354 mdoc_bd_pre(MDOC_ARGS) |
|
|
|
if (MDOC_BLOCK == n->type) { |
if (MDOC_BLOCK == n->type) { |
if (o) |
if (o) |
buffmt("margin-left: %dem;", o); |
buffmt(h, "margin-left: %dem;", o); |
bufcat("margin-top: 1em;"); |
if ( ! c) { |
|
for (nn = n; nn; nn = nn->parent) { |
|
if (MDOC_BLOCK != nn->type) |
|
continue; |
|
switch (nn->tok) { |
|
case (MDOC_Ss): |
|
/* FALLTHROUGH */ |
|
case (MDOC_Sh): |
|
c = 1; |
|
break; |
|
default: |
|
break; |
|
} |
|
if (nn->prev) |
|
break; |
|
} |
|
if ( ! c) |
|
bufcat(h, "margin-top: 1em;"); |
|
} |
tag[0].key = ATTR_STYLE; |
tag[0].key = ATTR_STYLE; |
tag[0].val = buf; |
tag[0].val = h->buf; |
print_otag(h, TAG_DIV, 1, tag); |
print_otag(h, TAG_DIV, 1, tag); |
return(1); |
return(1); |
} |
} |
|
|
switch (t) { |
if (MDOC_Unfilled != t && MDOC_Literal != t) |
case (MDOC_Unfilled): |
|
case (MDOC_Literal): |
|
break; |
|
default: |
|
return(1); |
return(1); |
} |
|
|
|
bufcat("white-space: pre;"); |
bufcat(h, "white-space: pre;"); |
tag[0].key = ATTR_STYLE; |
tag[0].key = ATTR_STYLE; |
tag[0].val = buf; |
tag[0].val = h->buf; |
tag[1].key = ATTR_CLASS; |
tag[1].key = ATTR_CLASS; |
tag[1].val = "lit"; |
tag[1].val = "lit"; |
|
|
print_otag(h, TAG_DIV, 2, tag); |
print_otag(h, TAG_DIV, 2, tag); |
|
|
for (n = n->child; n; n = n->next) { |
for (nn = n->child; nn; nn = nn->next) { |
h->flags |= HTML_NOSPACE; |
print_mdoc_node(m, nn, h); |
print_mdoc_node(m, n, h); |
if (NULL == nn->next) |
if (n->next) |
continue; |
|
if (nn->prev && nn->prev->line < nn->line) |
print_text(h, "\n"); |
print_text(h, "\n"); |
} |
} |
|
|
Line 1413 mdoc_an_pre(MDOC_ARGS) |
|
Line 1436 mdoc_an_pre(MDOC_ARGS) |
|
{ |
{ |
struct htmlpair tag; |
struct htmlpair tag; |
|
|
|
/* TODO: -split and -nosplit (see termp_an_pre()). */ |
|
|
tag.key = ATTR_CLASS; |
tag.key = ATTR_CLASS; |
tag.val = "author"; |
tag.val = "author"; |
print_otag(h, TAG_SPAN, 1, &tag); |
print_otag(h, TAG_SPAN, 1, &tag); |
|
|
mdoc_fn_pre(MDOC_ARGS) |
mdoc_fn_pre(MDOC_ARGS) |
{ |
{ |
struct tag *t; |
struct tag *t; |
struct htmlpair tag; |
struct htmlpair tag[2]; |
const struct mdoc_node *nn; |
const struct mdoc_node *nn; |
char nbuf[BUFSIZ]; |
char nbuf[BUFSIZ]; |
const char *sp, *ep; |
const char *sp, *ep; |
int sz; |
int sz, i; |
|
|
if (SEC_SYNOPSIS == n->sec) { |
if (SEC_SYNOPSIS == n->sec) { |
if (n->next) { |
bufcat(h, "margin-left: 6em;"); |
tag.key = ATTR_STYLE; |
bufcat(h, "text-indent: -6em;"); |
tag.val = "margin-bottom: 1em"; |
if (n->next) |
print_otag(h, TAG_DIV, 1, &tag); |
bufcat(h, "margin-bottom: 1em;"); |
} else |
tag[0].key = ATTR_STYLE; |
print_otag(h, TAG_DIV, 0, NULL); |
tag[0].val = h->buf; |
|
print_otag(h, TAG_DIV, 1, tag); |
} |
} |
|
|
/* Split apart into type and name. */ |
/* Split apart into type and name. */ |
|
|
tag.key = ATTR_CLASS; |
|
tag.val = "ftype"; |
|
t = print_otag(h, TAG_SPAN, 1, &tag); |
|
|
|
assert(n->child->string); |
assert(n->child->string); |
sp = n->child->string; |
sp = n->child->string; |
while ((ep = strchr(sp, ' '))) { |
|
sz = MIN((int)(ep - sp), BUFSIZ - 1); |
if ((ep = strchr(sp, ' '))) { |
(void)memcpy(nbuf, sp, (size_t)sz); |
tag[0].key = ATTR_CLASS; |
nbuf[sz] = '\0'; |
tag[0].val = "ftype"; |
print_text(h, nbuf); |
|
sp = ++ep; |
t = print_otag(h, TAG_SPAN, 1, tag); |
|
|
|
while (ep) { |
|
sz = MIN((int)(ep - sp), BUFSIZ - 1); |
|
(void)memcpy(nbuf, sp, (size_t)sz); |
|
nbuf[sz] = '\0'; |
|
print_text(h, nbuf); |
|
sp = ++ep; |
|
ep = strchr(sp, ' '); |
|
} |
|
print_tagq(h, t); |
} |
} |
|
|
print_tagq(h, t); |
tag[0].key = ATTR_CLASS; |
|
tag[0].val = "fname"; |
|
t = print_otag(h, TAG_SPAN, 1, tag); |
|
|
tag.key = ATTR_CLASS; |
|
tag.val = "fname"; |
|
t = print_otag(h, TAG_SPAN, 1, &tag); |
|
|
|
if (sp) { |
if (sp) { |
(void)strlcpy(nbuf, sp, BUFSIZ); |
(void)strlcpy(nbuf, sp, BUFSIZ); |
print_text(h, nbuf); |
print_text(h, nbuf); |
Line 1622 mdoc_fn_pre(MDOC_ARGS) |
|
Line 1651 mdoc_fn_pre(MDOC_ARGS) |
|
print_text(h, "("); |
print_text(h, "("); |
|
|
for (nn = n->child->next; nn; nn = nn->next) { |
for (nn = n->child->next; nn; nn = nn->next) { |
tag.key = ATTR_CLASS; |
i = 0; |
tag.val = "farg"; |
tag[i].key = ATTR_CLASS; |
t = print_otag(h, TAG_SPAN, 1, &tag); |
tag[i++].val = "farg"; |
|
if (SEC_SYNOPSIS == n->sec) { |
|
tag[i].key = ATTR_STYLE; |
|
tag[i++].val = "white-space: nowrap;"; |
|
} |
|
|
|
t = print_otag(h, TAG_SPAN, i, tag); |
print_text(h, nn->string); |
print_text(h, nn->string); |
print_tagq(h, t); |
print_tagq(h, t); |
if (nn->next) |
if (nn->next) |
Line 1659 mdoc_sp_pre(MDOC_ARGS) |
|
Line 1694 mdoc_sp_pre(MDOC_ARGS) |
|
break; |
break; |
} |
} |
|
|
buffmt("height: %dem", len); |
buffmt(h, "height: %dem;", len); |
tag.key = ATTR_STYLE; |
tag.key = ATTR_STYLE; |
tag.val = buf; |
tag.val = h->buf; |
print_otag(h, TAG_DIV, 1, &tag); |
print_otag(h, TAG_DIV, 1, &tag); |
return(1); |
return(1); |
|
|
Line 1731 mdoc_mt_pre(MDOC_ARGS) |
|
Line 1766 mdoc_mt_pre(MDOC_ARGS) |
|
tag[0].val = "link-mail"; |
tag[0].val = "link-mail"; |
|
|
for (nn = n->child; nn; nn = nn->next) { |
for (nn = n->child; nn; nn = nn->next) { |
bufinit(); |
bufinit(h); |
bufcat("mailto:"); |
bufcat(h, "mailto:"); |
bufcat(nn->string); |
bufcat(h, nn->string); |
|
|
tag[1].key = ATTR_HREF; |
tag[1].key = ATTR_HREF; |
tag[1].val = buf; |
tag[1].val = h->buf; |
|
|
t = print_otag(h, TAG_A, 2, tag); |
t = print_otag(h, TAG_A, 2, tag); |
print_text(h, nn->string); |
print_text(h, nn->string); |
|
|
mdoc_in_pre(MDOC_ARGS) |
mdoc_in_pre(MDOC_ARGS) |
{ |
{ |
const struct mdoc_node *nn; |
const struct mdoc_node *nn; |
struct htmlpair tag; |
struct htmlpair tag[2]; |
|
struct tag *t; |
|
int i; |
|
|
if (SEC_SYNOPSIS == n->sec) { |
if (SEC_SYNOPSIS == n->sec) { |
if (n->next && MDOC_In != n->next->tok) { |
if (n->next && MDOC_In != n->next->tok) { |
tag.key = ATTR_STYLE; |
tag[0].key = ATTR_STYLE; |
tag.val = "margin-bottom: 1em;"; |
tag[0].val = "margin-bottom: 1em;"; |
print_otag(h, TAG_DIV, 1, &tag); |
print_otag(h, TAG_DIV, 1, tag); |
} else |
} else |
print_otag(h, TAG_DIV, 0, NULL); |
print_otag(h, TAG_DIV, 0, NULL); |
} |
} |
|
|
tag.key = ATTR_CLASS; |
tag[0].key = ATTR_CLASS; |
tag.val = "includes"; |
tag[0].val = "includes"; |
|
|
print_otag(h, TAG_SPAN, 1, &tag); |
print_otag(h, TAG_SPAN, 1, tag); |
|
|
if (SEC_SYNOPSIS == n->sec) |
if (SEC_SYNOPSIS == n->sec) |
print_text(h, "#include"); |
print_text(h, "#include"); |
Line 1810 mdoc_in_pre(MDOC_ARGS) |
|
Line 1847 mdoc_in_pre(MDOC_ARGS) |
|
|
|
/* XXX -- see warning in termp_in_post(). */ |
/* XXX -- see warning in termp_in_post(). */ |
|
|
for (nn = n->child; nn; nn = nn->next) |
for (nn = n->child; nn; nn = nn->next) { |
|
assert(MDOC_TEXT == nn->type); |
|
i = 0; |
|
tag[i].key = ATTR_CLASS; |
|
tag[i++].val = "link-includes"; |
|
if (h->base_includes) { |
|
buffmt_includes(h, nn->string); |
|
tag[i].key = ATTR_HREF; |
|
tag[i++].val = h->buf; |
|
} |
|
t = print_otag(h, TAG_A, i, tag); |
print_mdoc_node(m, nn, h); |
print_mdoc_node(m, nn, h); |
|
print_tagq(h, t); |
|
} |
|
|
h->flags |= HTML_NOSPACE; |
h->flags |= HTML_NOSPACE; |
print_text(h, ">"); |
print_text(h, ">"); |