source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: splitting a text box sometimes requires wrapping it in a list
@ 2017-06-23 21:05 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-06-23 21:05 UTC (permalink / raw)
  To: source

Log Message:
-----------
splitting a text box sometimes requires wrapping it in a list

Modified Files:
--------------
    mandoc:
        eqn.c

Revision Data
-------------
Index: eqn.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/eqn.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -Leqn.c -Leqn.c -u -p -r1.68 -r1.69
--- eqn.c
+++ 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);
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-23 21:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-23 21:05 mandoc: splitting a text box sometimes requires wrapping it in a list schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).