version 1.3, 2009/02/21 14:56:58 |
version 1.4, 2009/02/21 15:34:46 |
Line 91 decl_pre(termp_ns); |
|
Line 91 decl_pre(termp_ns); |
|
decl_pre(termp_op); |
decl_pre(termp_op); |
decl_pre(termp_pp); |
decl_pre(termp_pp); |
decl_pre(termp_sh); |
decl_pre(termp_sh); |
|
decl_pre(termp_xr); |
|
|
decl_post(termp_bl); |
decl_post(termp_bl); |
decl_post(termp_it); |
decl_post(termp_it); |
Line 144 const struct termact termacts[MDOC_MAX] = { |
|
Line 145 const struct termact termacts[MDOC_MAX] = { |
|
{ NULL, NULL }, /* St */ |
{ NULL, NULL }, /* St */ |
{ NULL, NULL }, /* Va */ |
{ NULL, NULL }, /* Va */ |
{ NULL, NULL }, /* Vt */ |
{ NULL, NULL }, /* Vt */ |
{ NULL, NULL }, /* Xr */ |
{ termp_xr_pre, NULL }, /* Xr */ |
{ NULL, NULL }, /* %A */ |
{ NULL, NULL }, /* %A */ |
{ NULL, NULL }, /* %B */ |
{ NULL, NULL }, /* %B */ |
{ NULL, NULL }, /* %D */ |
{ NULL, NULL }, /* %D */ |
Line 682 termp_op_post(struct termp *p, const struct mdoc_meta |
|
Line 683 termp_op_post(struct termp *p, const struct mdoc_meta |
|
switch (node->type) { |
switch (node->type) { |
case (MDOC_BODY): |
case (MDOC_BODY): |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
word(p, "\\(rB"); |
word(p, "\\]"); |
break; |
break; |
default: |
default: |
break; |
break; |
Line 715 termp_sh_post(struct termp *p, const struct mdoc_meta |
|
Line 716 termp_sh_post(struct termp *p, const struct mdoc_meta |
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
static int |
static int |
|
termp_xr_pre(struct termp *p, const struct mdoc_meta *meta, |
|
const struct mdoc_node *node) |
|
{ |
|
const struct mdoc_node *n; |
|
|
|
n = node->child; |
|
assert(n); |
|
|
|
assert(MDOC_TEXT == n->type); |
|
word(p, n->data.text.string); |
|
|
|
if (NULL == (n = n->next)) |
|
return(0); |
|
|
|
assert(MDOC_TEXT == n->type); |
|
p->flags |= TERMP_NOSPACE; |
|
word(p, "\\("); |
|
p->flags |= TERMP_NOSPACE; |
|
word(p, n->data.text.string); |
|
p->flags |= TERMP_NOSPACE; |
|
word(p, "\\)"); |
|
|
|
return(0); |
|
} |
|
|
|
|
|
/* ARGSUSED */ |
|
static int |
termp_sh_pre(struct termp *p, const struct mdoc_meta *meta, |
termp_sh_pre(struct termp *p, const struct mdoc_meta *meta, |
const struct mdoc_node *node) |
const struct mdoc_node *node) |
{ |
{ |
Line 742 termp_op_pre(struct termp *p, const struct mdoc_meta * |
|
Line 771 termp_op_pre(struct termp *p, const struct mdoc_meta * |
|
|
|
switch (node->type) { |
switch (node->type) { |
case (MDOC_BODY): |
case (MDOC_BODY): |
word(p, "\\(lB"); |
word(p, "\\["); |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
break; |
break; |
default: |
default: |
|
|
termprint_r(struct termp *p, const struct mdoc_meta *meta, |
termprint_r(struct termp *p, const struct mdoc_meta *meta, |
const struct mdoc_node *node) |
const struct mdoc_node *node) |
{ |
{ |
|
int dochild; |
|
|
/* Pre-processing ----------------- */ |
/* Pre-processing ----------------- */ |
|
|
|
dochild = 1; |
|
|
if (MDOC_TEXT != node->type) { |
if (MDOC_TEXT != node->type) { |
if (termacts[node->tok].pre) |
if (termacts[node->tok].pre) |
if ( ! (*termacts[node->tok].pre)(p, meta, node)) |
if ( ! (*termacts[node->tok].pre)(p, meta, node)) |
return; |
dochild = 0; |
} else /* MDOC_TEXT == node->type */ |
} else /* MDOC_TEXT == node->type */ |
word(p, node->data.text.string); |
word(p, node->data.text.string); |
|
|
/* Children ---------------------- */ |
/* Children ---------------------- */ |
|
|
if (NULL == node->child) { |
if (dochild && NULL == node->child) { |
/* No-child processing. */ |
/* No-child processing. */ |
switch (node->type) { |
switch (node->type) { |
case (MDOC_ELEM): |
case (MDOC_ELEM): |
Line 799 termprint_r(struct termp *p, const struct mdoc_meta *m |
|
Line 831 termprint_r(struct termp *p, const struct mdoc_meta *m |
|
default: |
default: |
break; |
break; |
} |
} |
} else |
} else if (dochild) |
termprint_r(p, meta, node->child); |
termprint_r(p, meta, node->child); |
|
|
/* Post-processing --------------- */ |
/* Post-processing --------------- */ |