version 1.122, 2017/01/17 01:47:51 |
version 1.128, 2017/01/20 23:51:00 |
Line 148 html_man(void *arg, const struct roff_man *man) |
|
Line 148 html_man(void *arg, const struct roff_man *man) |
|
{ |
{ |
struct mhtml mh; |
struct mhtml mh; |
struct html *h; |
struct html *h; |
struct tag *t, *tt; |
struct tag *t; |
|
|
memset(&mh, 0, sizeof(mh)); |
memset(&mh, 0, sizeof(mh)); |
h = (struct html *)arg; |
h = (struct html *)arg; |
|
|
if ( ! (HTML_FRAGMENT & h->oflags)) { |
if ((h->oflags & HTML_FRAGMENT) == 0) { |
print_gen_decls(h); |
print_gen_decls(h); |
t = print_otag(h, TAG_HTML, ""); |
print_otag(h, TAG_HTML, ""); |
tt = print_otag(h, TAG_HEAD, ""); |
t = print_otag(h, TAG_HEAD, ""); |
print_man_head(&man->meta, man->first, &mh, h); |
print_man_head(&man->meta, man->first, &mh, h); |
print_tagq(h, tt); |
print_tagq(h, t); |
print_otag(h, TAG_BODY, ""); |
print_otag(h, TAG_BODY, ""); |
print_otag(h, TAG_DIV, "c", "mandoc"); |
} |
} else |
|
t = print_otag(h, TAG_DIV, "c", "mandoc"); |
|
|
|
print_man_nodelist(&man->meta, man->first, &mh, h); |
man_root_pre(&man->meta, man->first, &mh, h); |
|
t = print_otag(h, TAG_DIV, "c", "manual-text"); |
|
print_man_nodelist(&man->meta, man->first->child, &mh, h); |
print_tagq(h, t); |
print_tagq(h, t); |
putchar('\n'); |
man_root_post(&man->meta, man->first, &mh, h); |
|
print_tagq(h, NULL); |
} |
} |
|
|
static void |
static void |
print_man_head(MAN_ARGS) |
print_man_head(MAN_ARGS) |
{ |
{ |
|
char *cp; |
|
|
print_gen_head(h); |
print_gen_head(h); |
assert(man->title); |
mandoc_asprintf(&cp, "%s(%s)", man->title, man->msec); |
assert(man->msec); |
|
bufinit(h); |
|
bufcat_fmt(h, "%s(%s)", man->title, man->msec); |
|
print_otag(h, TAG_TITLE, ""); |
print_otag(h, TAG_TITLE, ""); |
print_text(h, h->buf); |
print_text(h, cp); |
|
free(cp); |
} |
} |
|
|
static void |
static void |
Line 202 print_man_node(MAN_ARGS) |
|
Line 202 print_man_node(MAN_ARGS) |
|
t = h->tags.head; |
t = h->tags.head; |
|
|
switch (n->type) { |
switch (n->type) { |
case ROFFT_ROOT: |
|
man_root_pre(man, n, mh, h); |
|
break; |
|
case ROFFT_TEXT: |
case ROFFT_TEXT: |
if ('\0' == *n->string) { |
if ('\0' == *n->string) { |
print_paragraph(h); |
print_paragraph(h); |
Line 217 print_man_node(MAN_ARGS) |
|
Line 214 print_man_node(MAN_ARGS) |
|
print_text(h, n->string); |
print_text(h, n->string); |
return; |
return; |
case ROFFT_EQN: |
case ROFFT_EQN: |
if (n->flags & NODE_LINE) |
|
putchar('\n'); |
|
print_eqn(h, n->eqn); |
print_eqn(h, n->eqn); |
break; |
break; |
case ROFFT_TBL: |
case ROFFT_TBL: |
Line 260 print_man_node(MAN_ARGS) |
|
Line 255 print_man_node(MAN_ARGS) |
|
print_stagq(h, t); |
print_stagq(h, t); |
|
|
switch (n->type) { |
switch (n->type) { |
case ROFFT_ROOT: |
|
man_root_post(man, n, mh, h); |
|
break; |
|
case ROFFT_EQN: |
case ROFFT_EQN: |
break; |
break; |
default: |
default: |
Line 359 man_SH_pre(MAN_ARGS) |
|
Line 351 man_SH_pre(MAN_ARGS) |
|
{ |
{ |
if (n->type == ROFFT_BLOCK) { |
if (n->type == ROFFT_BLOCK) { |
mh->fl &= ~MANH_LITERAL; |
mh->fl &= ~MANH_LITERAL; |
print_otag(h, TAG_DIV, "c", "section"); |
|
return 1; |
return 1; |
} else if (n->type == ROFFT_BODY) |
} else if (n->type == ROFFT_BODY) |
return 1; |
return 1; |
|
|
print_otag(h, TAG_H1, ""); |
print_otag(h, TAG_H1, "c", "Sh"); |
return 1; |
return 1; |
} |
} |
|
|
Line 438 man_SS_pre(MAN_ARGS) |
|
Line 429 man_SS_pre(MAN_ARGS) |
|
{ |
{ |
if (n->type == ROFFT_BLOCK) { |
if (n->type == ROFFT_BLOCK) { |
mh->fl &= ~MANH_LITERAL; |
mh->fl &= ~MANH_LITERAL; |
print_otag(h, TAG_DIV, "c", "subsection"); |
|
return 1; |
return 1; |
} else if (n->type == ROFFT_BODY) |
} else if (n->type == ROFFT_BODY) |
return 1; |
return 1; |
|
|
print_otag(h, TAG_H2, ""); |
print_otag(h, TAG_H2, "c", "Ss"); |
return 1; |
return 1; |
} |
} |
|
|
Line 516 man_HP_pre(MAN_ARGS) |
|
Line 506 man_HP_pre(MAN_ARGS) |
|
sui.scale = -sum.scale; |
sui.scale = -sum.scale; |
|
|
print_bvspace(h, n); |
print_bvspace(h, n); |
print_otag(h, TAG_DIV, "csului", "spacer", &sum, &sui); |
print_otag(h, TAG_DIV, "csului", "Pp", &sum, &sui); |
return 1; |
return 1; |
} |
} |
|
|
Line 527 man_OP_pre(MAN_ARGS) |
|
Line 517 man_OP_pre(MAN_ARGS) |
|
|
|
print_text(h, "["); |
print_text(h, "["); |
h->flags |= HTML_NOSPACE; |
h->flags |= HTML_NOSPACE; |
tt = print_otag(h, TAG_SPAN, "c", "opt"); |
tt = print_otag(h, TAG_SPAN, "c", "Op"); |
|
|
if (NULL != (n = n->child)) { |
if (NULL != (n = n->child)) { |
print_otag(h, TAG_B, ""); |
print_otag(h, TAG_B, ""); |
Line 613 man_UR_pre(MAN_ARGS) |
|
Line 603 man_UR_pre(MAN_ARGS) |
|
assert(n->type == ROFFT_HEAD); |
assert(n->type == ROFFT_HEAD); |
if (n->child != NULL) { |
if (n->child != NULL) { |
assert(n->child->type == ROFFT_TEXT); |
assert(n->child->type == ROFFT_TEXT); |
print_otag(h, TAG_A, "ch", "link-ext", n->child->string); |
print_otag(h, TAG_A, "ch", "Lk", n->child->string); |
} |
} |
|
|
assert(n->next->type == ROFFT_BODY); |
assert(n->next->type == ROFFT_BODY); |