Annotation of mandoc/eqn_html.c, Revision 1.1
1.1 ! kristaps 1: /* $Id: eqn_term.c,v 1.2 2011/07/23 12:01:54 kristaps Exp $ */
! 2: /*
! 3: * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
! 4: *
! 5: * Permission to use, copy, modify, and distribute this software for any
! 6: * purpose with or without fee is hereby granted, provided that the above
! 7: * copyright notice and this permission notice appear in all copies.
! 8: *
! 9: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
! 10: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
! 11: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
! 12: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
! 13: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
! 14: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
! 15: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
! 16: */
! 17: #ifdef HAVE_CONFIG_H
! 18: #include "config.h"
! 19: #endif
! 20:
! 21: #include <assert.h>
! 22: #include <stdio.h>
! 23: #include <stdlib.h>
! 24: #include <string.h>
! 25:
! 26: #include "mandoc.h"
! 27: #include "out.h"
! 28: #include "html.h"
! 29:
! 30: static void eqn_box(struct html *, const struct eqn_box *);
! 31: static void eqn_box_post(struct html *, const struct eqn_box *);
! 32: static void eqn_box_pre(struct html *, const struct eqn_box *);
! 33: static void eqn_text(struct html *, const struct eqn_box *);
! 34:
! 35: void
! 36: print_eqn(struct html *p, const struct eqn *ep)
! 37: {
! 38: struct htmlpair tag;
! 39: struct tag *t;
! 40:
! 41: PAIR_CLASS_INIT(&tag, "eqn");
! 42: t = print_otag(p, TAG_SPAN, 1, &tag);
! 43:
! 44: p->flags |= HTML_NONOSPACE;
! 45: eqn_box(p, ep->root);
! 46: p->flags &= ~HTML_NONOSPACE;
! 47:
! 48: print_tagq(p, t);
! 49: }
! 50:
! 51: static void
! 52: eqn_box(struct html *p, const struct eqn_box *bp)
! 53: {
! 54:
! 55: eqn_box_pre(p, bp);
! 56: eqn_text(p, bp);
! 57:
! 58: if (bp->first)
! 59: eqn_box(p, bp->first);
! 60:
! 61: eqn_box_post(p, bp);
! 62:
! 63: if (bp->next)
! 64: eqn_box(p, bp->next);
! 65: }
! 66:
! 67: static void
! 68: eqn_box_pre(struct html *p, const struct eqn_box *bp)
! 69: {
! 70:
! 71: if (bp->left)
! 72: print_text(p, bp->left);
! 73: }
! 74:
! 75: static void
! 76: eqn_box_post(struct html *p, const struct eqn_box *bp)
! 77: {
! 78:
! 79: if (bp->right)
! 80: print_text(p, bp->right);
! 81: }
! 82:
! 83: static void
! 84: eqn_text(struct html *p, const struct eqn_box *bp)
! 85: {
! 86:
! 87: if (bp->text)
! 88: print_text(p, bp->text);
! 89: }
CVSweb