- assert(NULL == bp->first);
- /*
- * We have text.
- * This can be a number, a function, a variable, or
- * pretty much anything else.
- * First, check for some known functions.
- * If we're going to create a structural node (e.g.,
- * sqrt), then set the "post" variable only if it's not
- * already set.
- */
- if (0 == strcmp(bp->text, "sqrt")) {
- tmp = print_otag(p, TAG_MSQRT, 0, NULL);
- post = (NULL == post) ? tmp : post;
- } else if (0 == strcmp(bp->text, "+") ||
- 0 == strcmp(bp->text, "-") ||
- 0 == strcmp(bp->text, "=") ||
- 0 == strcmp(bp->text, "(") ||
- 0 == strcmp(bp->text, ")") ||
- 0 == strcmp(bp->text, "/")) {
- tmp = print_otag(p, TAG_MO, 0, NULL);
- print_text(p, bp->text);
- print_tagq(p, tmp);
- } else {
- tmp = print_otag(p, TAG_MI, 0, NULL);
- print_text(p, bp->text);
- print_tagq(p, tmp);
- }
- } else if (NULL != bp->first) {
- assert(NULL == bp->text);
- /*
- * If we're a "fenced" component (i.e., having
- * brackets), then process those brackets now.
- * Otherwise, introduce a dummy row (if we're not
- * already in a table context).
- */
- tmp = NULL;
- if (NULL != bp->left || NULL != bp->right) {
- PAIR_INIT(&tag[0], ATTR_OPEN,
- NULL != bp->left ? bp->left : "");
- PAIR_INIT(&tag[1], ATTR_CLOSE,
- NULL != bp->right ? bp->right : "");
- tmp = print_otag(p, TAG_MFENCED, 2, tag);
- print_otag(p, TAG_MROW, 0, NULL);
- } else if (NULL == pilet)
- tmp = print_otag(p, TAG_MROW, 0, NULL);
- eqn_box(p, bp->first, 1);
- if (NULL != tmp)
- print_tagq(p, tmp);
+ assert(NULL == post);
+ post = print_otag(p, TAG_MI, "");
+ print_text(p, bp->text);
+ } else if (NULL == post) {
+ if (NULL != bp->left || NULL != bp->right)
+ post = print_otag(p, TAG_MFENCED, "??",
+ "open", bp->left == NULL ? "" : bp->left,
+ "close", bp->right == NULL ? "" : bp->right);
+ if (NULL == post)
+ post = print_otag(p, TAG_MROW, "");
+ else
+ print_otag(p, TAG_MROW, "");