Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If an mfenced element contains line breaks, the delimiters and separators are lost #255

Closed
dpvc opened this issue Jun 8, 2012 · 9 comments

Comments

@dpvc
Copy link
Member

dpvc commented Jun 8, 2012

If an <mfenced> element contains a line break, the delimiters and separators are lost. Also, the separators and delimiters are not used as possible breakpoints.

@fred-wang
Copy link
Contributor

These != reftests verify that the delimiters and separators are not lost:

MathMLToDisplay/Presentation/GeneralLayout/mfenced/issue255-1a.html
MathMLToDisplay/Presentation/GeneralLayout/mfenced/issue255-1b.html
MathMLToDisplay/Presentation/GeneralLayout/mfenced/issue255-1c.html
MathMLToDisplay/Presentation/GeneralLayout/mfenced/issue255-1d.html

This != reftest verifies that delimiters or separators are used as possible breakpoints:

MathMLToDisplay/Presentation/GeneralLayout/mfenced/issue255-2.html

=> In testsuite (see my MathJax-test fork)

@ghost ghost assigned dpvc Aug 13, 2012
dpvc added a commit to dpvc/MathJax that referenced this issue Aug 30, 2012
…separators are not lost. Resolves issue mathjax#255 (but separators currently aren't able to be breakpoints, so more needs to be done).
@dpvc
Copy link
Member Author

dpvc commented Aug 30, 2012

The issue255 branch of my fork of MathJax should handle your first four test cases. I don't yet have the delimiters and separators being valid breakpoints, so more work needs to be done, but that may not happen in this release, so I've marked it as ready for release plus to be addressed later.

@fred-wang
Copy link
Contributor

OK, I verified the first four tests in Chrome, Opera and Firefox.

The fifth test case seems to pass for me too, although the break always happen after a demiliter/separator not after the <mspace>'s of the test page. Perhaps that's what is supposed to be fixed?

@fred-wang
Copy link
Contributor

=> Ready for Release

@dpvc
Copy link
Member Author

dpvc commented Aug 30, 2012

The current implementation of linebreaking in mfenced elements doesn't consider the delimiters or separators as potential breakpoints (that needs to be fixed). So any breaks occur because of the children in the mfenced. Since mspace is a valid breakpoint, you can still break before that, and so that is the linebreaking you are seeing in your test. Had you used something like <mi>x</mi> instead of mspace's, you would not have gotten any breaking.

I'm wondering if a better test for this would be to compare the <mfenced> to the corresponding <mrow> with <mo> elements in the right places. E.g., compare

<math>
  <mfenced open="(" separators="+" close=")">
    <!-- ( -->
    <mi>x</mi>
    <!-- + -->
    <mi>x</mi>
    <!-- + -->
    <mi>x</mi>
    <!-- + -->
    <mi>x</mi>
    <!-- + -->
    <mi>x</mi>
    <!-- + -->
    <mi>x</mi>
    <!-- ) -->
  </mfenced>
</math>

to

<math>
  <mrow>
    <mo>(</mo>
    <mi>x</mi>
    <mo>+</mo>
    <mi>x</mi>
    <mo>+</mo>
    <mi>x</mi>
    <mo>+</mo>
    <mi>x</mi>
    <mo>+</mo>
    <mi>x</mi>
    <mo>+</mo>
    <mi>x</mi>
    <mo>)</mo>
  </mrow>
</math>

which should be rendered the same.

dpvc added a commit to dpvc/MathJax that referenced this issue Aug 30, 2012
…nd fix up some issues with lines going over the maximum width (due to forgetting to add width of first element after a split). Resolves issue mathjax#255.
@dpvc
Copy link
Member Author

dpvc commented Aug 30, 2012

OK, I've added code to allow line breaks at the delimiters and separators (I thought of a straight-forward way to do it so decided to go ahead with it now rather than wait until later).

@fred-wang
Copy link
Contributor

OK, I've added your testcase and the files seem to match by eye.

MathMLToDisplay/Presentation/GeneralLayout/mfenced/issue255-3.html

I've also modified issue255-2.html to use mpadded instead of mspace.

I will upload these tests after my next commit.

=> Ready for release.

dpvc added a commit to dpvc/MathJax that referenced this issue Aug 30, 2012
…rns out to be needed after all, as info.scanW is changed in the recursive calls). Issue mathjax#255.
@dpvc
Copy link
Member Author

dpvc commented Aug 30, 2012

Note that my second code block above had a </mfenced> that should have been an </mrow>. I've edited it here, but if you just copy and pasted, you will want to make the change. Sorry about that.

I've also updated issue255 to fix a problem that caused lines to be too short (due to edits I made in the earlier commit, which I have rolled back).

@fred-wang
Copy link
Contributor

Note that my second code block above had an </mfenced> that should have been an </mrow>. I've edited it here, but if you just copy and pasted, you will want to make the change. Sorry about that.

Yes, don't worry I noticed that when I asked emacs to indent the code.

I've also updates issue255 to fix a problem that caused lines to be too short (due to edits I made in the earlier commit, which I have rolled back).

OK. I think you can merge it to develop, anyway.

@dpvc dpvc closed this as completed Nov 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants