version 1.163, 2019/01/05 09:14:44 |
version 1.165, 2019/01/05 21:55:11 |
|
|
#include "html.h" |
#include "html.h" |
#include "main.h" |
#include "main.h" |
|
|
/* FIXME: have PD set the default vspace width. */ |
|
|
|
#define MAN_ARGS const struct roff_meta *man, \ |
#define MAN_ARGS const struct roff_meta *man, \ |
const struct roff_node *n, \ |
const struct roff_node *n, \ |
struct html *h |
struct html *h |
Line 123 static const struct man_html_act man_html_acts[MAN_MAX |
|
Line 121 static const struct man_html_act man_html_acts[MAN_MAX |
|
static void |
static void |
print_bvspace(struct html *h, const struct roff_node *n) |
print_bvspace(struct html *h, const struct roff_node *n) |
{ |
{ |
|
if (n->body != NULL && n->body->child != NULL && |
|
n->body->child->type == ROFFT_TBL) |
|
return; |
|
|
if (n->body && n->body->child) |
if (n->prev == NULL && n->parent->tok != MAN_RS) |
if (n->body->child->type == ROFFT_TBL) |
return; |
return; |
|
|
|
if (n->parent->type == ROFFT_ROOT || n->parent->tok != MAN_RS) |
|
if (NULL == n->prev) |
|
return; |
|
|
|
print_paragraph(h); |
print_paragraph(h); |
} |
} |
|
|
Line 179 print_man_head(const struct roff_meta *man, struct htm |
|
Line 175 print_man_head(const struct roff_meta *man, struct htm |
|
static void |
static void |
print_man_nodelist(MAN_ARGS) |
print_man_nodelist(MAN_ARGS) |
{ |
{ |
|
|
while (n != NULL) { |
while (n != NULL) { |
print_man_node(man, n, h); |
print_man_node(man, n, h); |
n = n->next; |
n = n->next; |
Line 238 print_man_node(MAN_ARGS) |
|
Line 233 print_man_node(MAN_ARGS) |
|
* the "meta" table state. This will be reopened on the |
* the "meta" table state. This will be reopened on the |
* next table element. |
* next table element. |
*/ |
*/ |
if (h->tblt) |
if (h->tblt != NULL) |
print_tblclose(h); |
print_tblclose(h); |
|
|
t = h->tag; |
t = h->tag; |
Line 255 print_man_node(MAN_ARGS) |
|
Line 250 print_man_node(MAN_ARGS) |
|
break; |
break; |
} |
} |
|
|
if (child && n->child) |
if (child && n->child != NULL) |
print_man_nodelist(man, n->child, h); |
print_man_nodelist(man, n->child, h); |
|
|
/* This will automatically close out any font scope. */ |
/* This will automatically close out any font scope. */ |
print_stagq(h, t); |
print_stagq(h, t); |
|
|
if (n->flags & NODE_NOFILL && |
if (n->flags & NODE_NOFILL && n->tok != MAN_YS && |
(n->next == NULL || n->next->flags & NODE_LINE)) { |
(n->next != NULL && n->next->flags & NODE_LINE)) { |
/* In .nf = <pre>, print even empty lines. */ |
/* In .nf = <pre>, print even empty lines. */ |
h->col++; |
h->col++; |
print_endline(h); |
print_endline(h); |
Line 287 man_root_pre(const struct roff_meta *man, struct html |
|
Line 282 man_root_pre(const struct roff_meta *man, struct html |
|
print_stagq(h, tt); |
print_stagq(h, tt); |
|
|
print_otag(h, TAG_TD, "c", "head-vol"); |
print_otag(h, TAG_TD, "c", "head-vol"); |
if (NULL != man->vol) |
if (man->vol != NULL) |
print_text(h, man->vol); |
print_text(h, man->vol); |
print_stagq(h, tt); |
print_stagq(h, tt); |
|
|
Line 310 man_root_post(const struct roff_meta *man, struct html |
|
Line 305 man_root_post(const struct roff_meta *man, struct html |
|
print_stagq(h, tt); |
print_stagq(h, tt); |
|
|
print_otag(h, TAG_TD, "c", "foot-os"); |
print_otag(h, TAG_TD, "c", "foot-os"); |
if (man->os) |
if (man->os != NULL) |
print_text(h, man->os); |
print_text(h, man->os); |
print_tagq(h, t); |
print_tagq(h, t); |
} |
} |
|
|
man_alt_pre(MAN_ARGS) |
man_alt_pre(MAN_ARGS) |
{ |
{ |
const struct roff_node *nn; |
const struct roff_node *nn; |
|
struct tag *t; |
int i; |
int i; |
enum htmltag fp; |
enum htmltag fp; |
struct tag *t; |
|
|
|
for (i = 0, nn = n->child; nn; nn = nn->next, i++) { |
for (i = 0, nn = n->child; nn != NULL; nn = nn->next, i++) { |
switch (n->tok) { |
switch (n->tok) { |
case MAN_BI: |
case MAN_BI: |
fp = i % 2 ? TAG_I : TAG_B; |
fp = i % 2 ? TAG_I : TAG_B; |
|
|
man_SM_pre(MAN_ARGS) |
man_SM_pre(MAN_ARGS) |
{ |
{ |
print_otag(h, TAG_SMALL, ""); |
print_otag(h, TAG_SMALL, ""); |
if (MAN_SB == n->tok) |
if (n->tok == MAN_SB) |
print_otag(h, TAG_B, ""); |
print_otag(h, TAG_B, ""); |
return 1; |
return 1; |
} |
} |
Line 401 man_SS_pre(MAN_ARGS) |
|
Line 396 man_SS_pre(MAN_ARGS) |
|
static int |
static int |
man_PP_pre(MAN_ARGS) |
man_PP_pre(MAN_ARGS) |
{ |
{ |
|
|
if (n->type == ROFFT_HEAD) |
if (n->type == ROFFT_HEAD) |
return 0; |
return 0; |
else if (n->type == ROFFT_BLOCK) |
else if (n->type == ROFFT_BLOCK) |
Line 443 man_IP_pre(MAN_ARGS) |
|
Line 437 man_IP_pre(MAN_ARGS) |
|
default: |
default: |
abort(); |
abort(); |
} |
} |
|
|
return 0; |
return 0; |
} |
} |
|
|
Line 469 man_OP_pre(MAN_ARGS) |
|
Line 462 man_OP_pre(MAN_ARGS) |
|
h->flags |= HTML_NOSPACE; |
h->flags |= HTML_NOSPACE; |
tt = print_otag(h, TAG_SPAN, "c", "Op"); |
tt = print_otag(h, TAG_SPAN, "c", "Op"); |
|
|
if (NULL != (n = n->child)) { |
if ((n = n->child) != NULL) { |
print_otag(h, TAG_B, ""); |
print_otag(h, TAG_B, ""); |
print_text(h, n->string); |
print_text(h, n->string); |
} |
} |
|
|
print_stagq(h, tt); |
print_stagq(h, tt); |
|
|
if (NULL != n && NULL != n->next) { |
if (n != NULL && n->next != NULL) { |
print_otag(h, TAG_I, ""); |
print_otag(h, TAG_I, ""); |
print_text(h, n->next->string); |
print_text(h, n->next->string); |
} |
} |
Line 511 man_in_pre(MAN_ARGS) |
|
Line 504 man_in_pre(MAN_ARGS) |
|
static int |
static int |
man_ign_pre(MAN_ARGS) |
man_ign_pre(MAN_ARGS) |
{ |
{ |
|
|
return 0; |
return 0; |
} |
} |
|
|
|
|
man_UR_pre(MAN_ARGS) |
man_UR_pre(MAN_ARGS) |
{ |
{ |
char *cp; |
char *cp; |
|
|
n = n->child; |
n = n->child; |
assert(n->type == ROFFT_HEAD); |
assert(n->type == ROFFT_HEAD); |
if (n->child != NULL) { |
if (n->child != NULL) { |
Line 567 man_UR_pre(MAN_ARGS) |
|
Line 560 man_UR_pre(MAN_ARGS) |
|
n = n->next; |
n = n->next; |
|
|
print_man_nodelist(man, n->child, h); |
print_man_nodelist(man, n->child, h); |
|
|
return 0; |
return 0; |
} |
} |
|
|