version 1.40, 2014/10/12 15:08:45 |
version 1.41, 2014/10/12 15:34:44 |
|
|
|
|
static const char *attrkeys[ATTRKEY__MAX] = { |
static const char *attrkeys[ATTRKEY__MAX] = { |
"choice", |
"choice", |
|
"close", |
"id", |
"id", |
|
"open", |
"rep" |
"rep" |
}; |
}; |
|
|
Line 863 pnode_printparamdef(struct parse *p, struct pnode *pn) |
|
Line 865 pnode_printparamdef(struct parse *p, struct pnode *pn) |
|
} |
} |
|
|
/* |
/* |
|
* The <mml:mfenced> node is a little peculiar. |
|
* First, it can have arbitrary open and closing tokens, which default |
|
* to parentheses. |
|
* Second, >1 arguments are separated by commas. |
|
*/ |
|
static void |
|
pnode_printmathfenced(struct parse *p, struct pnode *pn) |
|
{ |
|
struct pnode *pp; |
|
struct pattr *ap; |
|
|
|
TAILQ_FOREACH(ap, &pn->attrq, child) |
|
if (ATTRKEY_OPEN == ap->key) { |
|
printf("left %s ", ap->rawval); |
|
break; |
|
} |
|
if (NULL == ap) |
|
printf("left ( "); |
|
|
|
pp = TAILQ_FIRST(&pn->childq); |
|
pnode_print(p, pp); |
|
|
|
while (NULL != (pp = TAILQ_NEXT(pp, child))) { |
|
putchar(','); |
|
pnode_print(p, pp); |
|
} |
|
|
|
TAILQ_FOREACH(ap, &pn->attrq, child) |
|
if (ATTRKEY_CLOSE == ap->key) { |
|
printf("right %s ", ap->rawval); |
|
break; |
|
} |
|
if (NULL == ap) |
|
printf("right ) "); |
|
} |
|
|
|
/* |
* These math nodes require special handling because they have infix |
* These math nodes require special handling because they have infix |
* syntax, instead of the usual prefix or prefix. |
* syntax, instead of the usual prefix or prefix. |
* So we need to break up the first and second child node with a |
* So we need to break up the first and second child node with a |
Line 1241 pnode_print(struct parse *p, struct pnode *pn) |
|
Line 1280 pnode_print(struct parse *p, struct pnode *pn) |
|
p->newln = 0; |
p->newln = 0; |
break; |
break; |
case (NODE_MML_MFENCED): |
case (NODE_MML_MFENCED): |
printf("left {"); |
pnode_printmathfenced(p, pn); |
|
pnode_unlinksub(pn); |
break; |
break; |
case (NODE_MML_MROW): |
case (NODE_MML_MROW): |
case (NODE_MML_MI): |
case (NODE_MML_MI): |
Line 1440 pnode_print(struct parse *p, struct pnode *pn) |
|
Line 1480 pnode_print(struct parse *p, struct pnode *pn) |
|
putchar('\n'); |
putchar('\n'); |
puts(".EN"); |
puts(".EN"); |
p->newln = 1; |
p->newln = 1; |
break; |
|
case (NODE_MML_MFENCED): |
|
printf("right }"); |
|
break; |
break; |
case (NODE_MML_MROW): |
case (NODE_MML_MROW): |
case (NODE_MML_MI): |
case (NODE_MML_MI): |