version 1.1, 2011/07/23 22:57:13 |
version 1.3, 2014/04/20 16:46:04 |
|
|
#include "out.h" |
#include "out.h" |
#include "html.h" |
#include "html.h" |
|
|
|
static const enum htmltag fontmap[EQNFONT__MAX] = { |
|
TAG_SPAN, /* EQNFONT_NONE */ |
|
TAG_SPAN, /* EQNFONT_ROMAN */ |
|
TAG_B, /* EQNFONT_BOLD */ |
|
TAG_B, /* EQNFONT_FAT */ |
|
TAG_I /* EQNFONT_ITALIC */ |
|
}; |
|
|
static void eqn_box(struct html *, const struct eqn_box *); |
static void eqn_box(struct html *, const struct eqn_box *); |
static void eqn_box_post(struct html *, const struct eqn_box *); |
|
static void eqn_box_pre(struct html *, const struct eqn_box *); |
|
static void eqn_text(struct html *, const struct eqn_box *); |
|
|
|
|
|
void |
void |
print_eqn(struct html *p, const struct eqn *ep) |
print_eqn(struct html *p, const struct eqn *ep) |
{ |
{ |
Line 51 print_eqn(struct html *p, const struct eqn *ep) |
|
Line 57 print_eqn(struct html *p, const struct eqn *ep) |
|
static void |
static void |
eqn_box(struct html *p, const struct eqn_box *bp) |
eqn_box(struct html *p, const struct eqn_box *bp) |
{ |
{ |
|
struct tag *t; |
|
|
eqn_box_pre(p, bp); |
t = EQNFONT_NONE == bp->font ? NULL : |
eqn_text(p, bp); |
print_otag(p, fontmap[(int)bp->font], 0, NULL); |
|
|
if (bp->first) |
|
eqn_box(p, bp->first); |
|
|
|
eqn_box_post(p, bp); |
|
|
|
if (bp->next) |
|
eqn_box(p, bp->next); |
|
} |
|
|
|
static void |
|
eqn_box_pre(struct html *p, const struct eqn_box *bp) |
|
{ |
|
|
|
if (bp->left) |
if (bp->left) |
print_text(p, bp->left); |
print_text(p, bp->left); |
} |
|
|
|
static void |
if (bp->text) |
eqn_box_post(struct html *p, const struct eqn_box *bp) |
print_text(p, bp->text); |
{ |
|
|
|
|
if (bp->first) |
|
eqn_box(p, bp->first); |
|
|
|
if (NULL != t) |
|
print_tagq(p, t); |
if (bp->right) |
if (bp->right) |
print_text(p, bp->right); |
print_text(p, bp->right); |
} |
|
|
|
static void |
if (bp->next) |
eqn_text(struct html *p, const struct eqn_box *bp) |
eqn_box(p, bp->next); |
{ |
|
|
|
if (bp->text) |
|
print_text(p, bp->text); |
|
} |
} |