tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: "Anthony J. Bentley" <anthony@anjbe.name>, tech@mdocml.bsd.lv
Subject: Re: MathML and <mo>, <mi>, <mn>
Date: Fri, 23 Jun 2017 23:24:09 +0200	[thread overview]
Message-ID: <20170623212409.GB33360@athene.usta.de> (raw)
In-Reply-To: <20170623025712.GE77030@athene.usta.de>

Hi Anthony,

Ingo Schwarze wrote on Fri, Jun 23, 2017 at 04:57:12AM +0200:
> Anthony J. Bentley wrote on Tue, Jun 20, 2017 at 02:04:29AM -0600:

>> Consider the quadratic formula:
>> x={-b +- sqrt{b sup 2 - 4ac}} over 2a

> After committing the patch appended below, mandoc now renders
> as follows:
> 
>   <mrow>
>     <mi>x</mi>  <!-- new identifier/operator splitting -->
>     <mo>=</mo>  <!-- new operator element -->
>     <mfrac>
>       <mrow>
[...]
>       </mrow>
>       <mn>2</mn>  <!-- XXX oops, do we need a row here? -->
>       <mi>a</mi>
>     </mfrac>
>   </mrow>

I just fixed this with the following commit, to render as:

        </mrow>
        <mrow>
          <mn>2</mn>
          <mi>a</mi>
        </mrow>
      </mfrac>

Yours,
  Ingo


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 tech+unsubscribe@mdocml.bsd.lv

      parent reply	other threads:[~2017-06-23 21:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20  8:04 Anthony J. Bentley
2017-06-21 20:59 ` Ingo Schwarze
2017-06-23  2:57 ` Ingo Schwarze
2017-06-23  3:22   ` Anthony J. Bentley
2017-06-23 21:24   ` Ingo Schwarze [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170623212409.GB33360@athene.usta.de \
    --to=schwarze@usta.de \
    --cc=anthony@anjbe.name \
    --cc=tech@mdocml.bsd.lv \
    --subject='Re: MathML and <mo>, <mi>, <mn>' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).