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 | 15f1b4eb016473ee28ed3c95a14bc28cee720539 (patch) | |
tree | 40334dac5331eff921e0c9288216b76ed69952f5 /eqn.c | |
parent | 1483ee71a601bb06cccc078404ee60754e17b0fd (diff) | |
download | mandoc-15f1b4eb016473ee28ed3c95a14bc28cee720539.tar.gz mandoc-15f1b4eb016473ee28ed3c95a14bc28cee720539.tar.zst mandoc-15f1b4eb016473ee28ed3c95a14bc28cee720539.zip |
splitting a text box sometimes requires wrapping it in a list
Diffstat (limited to 'eqn.c')
-rw-r--r-- | eqn.c | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: eqn.c,v 1.68 2017/06/23 00:30:38 schwarze Exp $ +/* $Id: eqn.c,v 1.69 2017/06/23 21:04:57 schwarze Exp $ /* * Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -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); |