aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/eqn_html.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-07-24 10:09:03 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-07-24 10:09:03 +0000
commitdf50b5d64e0d28bd648ff97b998eced503c945fc (patch)
treed9ad05ade4dcf6795aab4da47c7035e27f2f7b7b /eqn_html.c
parent234884d113221f817102fb404dadd44b4e860fb9 (diff)
downloadmandoc-df50b5d64e0d28bd648ff97b998eced503c945fc.tar.gz
mandoc-df50b5d64e0d28bd648ff97b998eced503c945fc.tar.zst
mandoc-df50b5d64e0d28bd648ff97b998eced503c945fc.zip
Tuned the initial eqn output, making it completely simple. This
completes a full initial eqn system, so I'm tagging a release on it.
Diffstat (limited to 'eqn_html.c')
-rw-r--r--eqn_html.c52
1 files changed, 22 insertions, 30 deletions
diff --git a/eqn_html.c b/eqn_html.c
index 78e11d43..80c82f1d 100644
--- a/eqn_html.c
+++ b/eqn_html.c
@@ -1,4 +1,4 @@
-/* $Id: eqn_html.c,v 1.1 2011/07/23 22:57:13 kristaps Exp $ */
+/* $Id: eqn_html.c,v 1.2 2011/07/24 10:09:03 kristaps Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -27,10 +27,16 @@
#include "out.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_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
print_eqn(struct html *p, const struct eqn *ep)
@@ -51,39 +57,25 @@ print_eqn(struct html *p, const struct eqn *ep)
static void
eqn_box(struct html *p, const struct eqn_box *bp)
{
+ struct tag *t;
- eqn_box_pre(p, bp);
- eqn_text(p, bp);
-
- 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)
-{
+ t = EQNFONT_NONE == bp->font ? NULL :
+ print_otag(p, fontmap[(int)bp->font], 0, NULL);
if (bp->left)
print_text(p, bp->left);
-}
+
+ if (bp->text)
+ print_text(p, bp->text);
-static void
-eqn_box_post(struct html *p, const struct eqn_box *bp)
-{
+ if (bp->first)
+ eqn_box(p, bp->first);
+ if (NULL != t)
+ print_tagq(p, t);
if (bp->right)
print_text(p, bp->right);
-}
-static void
-eqn_text(struct html *p, const struct eqn_box *bp)
-{
-
- if (bp->text)
- print_text(p, bp->text);
+ if (bp->next)
+ eqn_box(p, bp->next);
}