diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-06-23 21:04:57 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-06-23 21:04:57 +0000 |
commit | ff08e5bbabfad213d18e8a8c062831f5b6899416 (patch) | |
tree | 3ea3826f26330f9f55391371c1fd63464e078462 /eqn.c | |
parent | 38fad5b1a4ec80f602c048a8b7b61ece72e73833 (diff) | |
download | mandoc-ff08e5bbabfad213d18e8a8c062831f5b6899416.tar.gz |
splitting a text box sometimes requires wrapping it in a list
Diffstat (limited to 'eqn.c')
-rw-r--r-- | eqn.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -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); |