summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eqn.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/eqn.c b/eqn.c
index cfac9210..5d4e727b 100644
--- a/eqn.c
+++ b/eqn.c
@@ -1139,7 +1139,25 @@ this_tok:
break;
if (ccln == ccl)
continue;
- /* Boundary found, add a new box. */
+ /* Boundary found, split the text. */
+ if (parent->args == parent->expectargs) {
+ /* Remove the text from the tree. */
+ if (cur->prev == NULL)
+ parent->first = cur->next;
+ else
+ cur->prev->next = NULL;
+ parent->last = cur->prev;
+ parent->args--;
+ /* Set up a list instead. */
+ nbox = eqn_box_alloc(ep, parent);
+ nbox->type = EQN_LIST;
+ /* Insert the word into the list. */
+ nbox->first = nbox->last = cur;
+ cur->parent = nbox;
+ cur->prev = NULL;
+ parent = nbox;
+ }
+ /* Append a new text box. */
nbox = eqn_box_alloc(ep, parent);
nbox->type = EQN_TEXT;
nbox->text = mandoc_strdup(cpn);