version 1.231, 2015/04/18 16:06:40 |
version 1.234, 2015/09/26 00:22:07 |
Line 48 struct htmlmdoc { |
|
Line 48 struct htmlmdoc { |
|
void (*post)(MDOC_ARGS); |
void (*post)(MDOC_ARGS); |
}; |
}; |
|
|
static void print_mdoc(MDOC_ARGS); |
|
static void print_mdoc_head(MDOC_ARGS); |
static void print_mdoc_head(MDOC_ARGS); |
static void print_mdoc_node(MDOC_ARGS); |
static void print_mdoc_node(MDOC_ARGS); |
static void print_mdoc_nodelist(MDOC_ARGS); |
static void print_mdoc_nodelist(MDOC_ARGS); |
Line 264 static const char * const lists[LIST_MAX] = { |
|
Line 263 static const char * const lists[LIST_MAX] = { |
|
}; |
}; |
|
|
|
|
void |
|
html_mdoc(void *arg, const struct roff_man *mdoc) |
|
{ |
|
|
|
print_mdoc(mdoc_meta(mdoc), mdoc_node(mdoc)->child, |
|
(struct html *)arg); |
|
putchar('\n'); |
|
} |
|
|
|
/* |
/* |
* Calculate the scaling unit passed in a `-width' argument. This uses |
* Calculate the scaling unit passed in a `-width' argument. This uses |
* either a native scaling unit (e.g., 1i, 2m) or the string length of |
* either a native scaling unit (e.g., 1i, 2m) or the string length of |
Line 331 synopsis_pre(struct html *h, const struct roff_node *n |
|
Line 321 synopsis_pre(struct html *h, const struct roff_node *n |
|
} |
} |
} |
} |
|
|
static void |
void |
print_mdoc(MDOC_ARGS) |
html_mdoc(void *arg, const struct roff_man *mdoc) |
{ |
{ |
struct tag *t, *tt; |
|
struct htmlpair tag; |
struct htmlpair tag; |
|
struct html *h; |
|
struct tag *t, *tt; |
|
|
PAIR_CLASS_INIT(&tag, "mandoc"); |
PAIR_CLASS_INIT(&tag, "mandoc"); |
|
h = (struct html *)arg; |
|
|
if ( ! (HTML_FRAGMENT & h->oflags)) { |
if ( ! (HTML_FRAGMENT & h->oflags)) { |
print_gen_decls(h); |
print_gen_decls(h); |
t = print_otag(h, TAG_HTML, 0, NULL); |
t = print_otag(h, TAG_HTML, 0, NULL); |
tt = print_otag(h, TAG_HEAD, 0, NULL); |
tt = print_otag(h, TAG_HEAD, 0, NULL); |
print_mdoc_head(meta, n, h); |
print_mdoc_head(&mdoc->meta, mdoc->first->child, h); |
print_tagq(h, tt); |
print_tagq(h, tt); |
print_otag(h, TAG_BODY, 0, NULL); |
print_otag(h, TAG_BODY, 0, NULL); |
print_otag(h, TAG_DIV, 1, &tag); |
print_otag(h, TAG_DIV, 1, &tag); |
} else |
} else |
t = print_otag(h, TAG_DIV, 1, &tag); |
t = print_otag(h, TAG_DIV, 1, &tag); |
|
|
mdoc_root_pre(meta, n, h); |
mdoc_root_pre(&mdoc->meta, mdoc->first->child, h); |
print_mdoc_nodelist(meta, n, h); |
print_mdoc_nodelist(&mdoc->meta, mdoc->first->child, h); |
mdoc_root_post(meta, n, h); |
mdoc_root_post(&mdoc->meta, mdoc->first->child, h); |
print_tagq(h, t); |
print_tagq(h, t); |
|
putchar('\n'); |
} |
} |
|
|
static void |
static void |
Line 649 mdoc_nm_pre(MDOC_ARGS) |
|
Line 642 mdoc_nm_pre(MDOC_ARGS) |
|
|
|
switch (n->type) { |
switch (n->type) { |
case ROFFT_ELEM: |
case ROFFT_ELEM: |
synopsis_pre(h, n); |
|
PAIR_CLASS_INIT(&tag, "name"); |
PAIR_CLASS_INIT(&tag, "name"); |
print_otag(h, TAG_B, 1, &tag); |
print_otag(h, TAG_B, 1, &tag); |
if (NULL == n->child && meta->name) |
if (NULL == n->child && meta->name) |
Line 657 mdoc_nm_pre(MDOC_ARGS) |
|
Line 649 mdoc_nm_pre(MDOC_ARGS) |
|
return(1); |
return(1); |
case ROFFT_HEAD: |
case ROFFT_HEAD: |
print_otag(h, TAG_TD, 0, NULL); |
print_otag(h, TAG_TD, 0, NULL); |
|
PAIR_CLASS_INIT(&tag, "name"); |
|
print_otag(h, TAG_B, 1, &tag); |
if (NULL == n->child && meta->name) |
if (NULL == n->child && meta->name) |
print_text(h, meta->name); |
print_text(h, meta->name); |
return(1); |
return(1); |
Line 671 mdoc_nm_pre(MDOC_ARGS) |
|
Line 665 mdoc_nm_pre(MDOC_ARGS) |
|
PAIR_CLASS_INIT(&tag, "synopsis"); |
PAIR_CLASS_INIT(&tag, "synopsis"); |
print_otag(h, TAG_TABLE, 1, &tag); |
print_otag(h, TAG_TABLE, 1, &tag); |
|
|
for (len = 0, n = n->child; n; n = n->next) |
for (len = 0, n = n->head->child; n; n = n->next) |
if (n->type == ROFFT_TEXT) |
if (n->type == ROFFT_TEXT) |
len += html_strlen(n->string); |
len += html_strlen(n->string); |
|
|
Line 1649 mdoc_fo_pre(MDOC_ARGS) |
|
Line 1643 mdoc_fo_pre(MDOC_ARGS) |
|
return(1); |
return(1); |
} |
} |
|
|
/* XXX: we drop non-initial arguments as per groff. */ |
if (n->child == NULL) |
|
return(0); |
|
|
assert(n->child); |
|
assert(n->child->string); |
assert(n->child->string); |
|
|
PAIR_CLASS_INIT(&tag, "fname"); |
PAIR_CLASS_INIT(&tag, "fname"); |
t = print_otag(h, TAG_B, 1, &tag); |
t = print_otag(h, TAG_B, 1, &tag); |
print_text(h, n->child->string); |
print_text(h, n->child->string); |