-
Notifications
You must be signed in to change notification settings - Fork 19
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
Remove/deprecate/simplify the ms element #120
Comments
it essentially displays the same as mtext, but defaulting to a monospace
font and surrounded by quotes. so it could in theory be dropped from core
but it is a useful distinction especially when using math layout for
computer code rather than "pure math" to maintain a distinction between
strings which are values and text which is part of the surrounding sentence
structure so
<math><mi>str1</mi><mo>=</mo><ms>foo</ms> <mtext>  or  </mtext>
<mi>str1</mi><mo>=</mo><ms>bar</ms></math>
so the ms foo and bar are values in the expression but <mtext> is just part
of the sentence inlined into the display for layout reasons.
the justification is actually very similar to that of <mn> which also
displays pretty much as mtext, but numeric values, like string values often
have a special role.
…On Wed, 17 Jul 2019 at 14:57, Brian Kardell ***@***.***> wrote:
I've been googling for some time this morning, looking for some example of
<ms> use that is somehow not just effectively <math><ms>hello
world</ms></math>. For most elements I've looked up, I can find some
reasonably simple examples of something that is recognizable as "mathy"
content and helps me understand what it does, and what it is for. But, for
<ms>, I can't.
Can someone please provide an example demonstrating a real (simple,
hopefully) use of this element and why it is useful/necessary to have this
particular distinction? If not, can we just drop it from core?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#120>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJVYAWFP2X7RJO7524DH5LP74QMDANCNFSM4IEQVNMA>
.
|
Thanks David. I'm wondering still though: can you provide an example demonstrating an actual/real (simple, hopefully) use of this element? In other words, not a thing that is showing what it does with foos and bars, but - some actual math content that helps me (or someone else) understand how it serves an actually useful purpose? |
here at work we generate a lot of code from mathml and
<ms>123</ms><mo>=</mo><ms>123.0</ms> is string comparison and false, and
<mn>123><mo>=</mo><mn>123.0</mn> is numeric comparison and probably true,
if you didn't have <ms>123</ms> you would presumably use
<mtext>"123"</mtext> which displays the same but is harder to use for code
generation as it mixes the actual string value of 123 with the string
literal syntax, so for example you'd have to work harder for it to be equal
to <mtext>'123'</mtext> or <mtext>"123'</mtext> to be an error.
One could argue that core is only focussed on presentation in a browser in
which case ms and mn are both pretty much replaceable by mtext, but there
are many benefits to having the math in the browser page also be
processable as math, and distinguishing numeric and string literals is a
more or less universal feature of any programming language that you want to
use to process the expressions.
…On Wed, 31 Jul 2019 at 14:53, Brian Kardell ***@***.***> wrote:
Thanks David. I'm wondering still though: can you provide an example
demonstrating an actual/real (simple, hopefully) use of this element? In
other words, not a thing that is showing what it does with foos and bars,
but - some actual math content that helps me (or someone else) understand
how it serves an actually useful purpose?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#120>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJVYAWCYFKKW7OKYVG7ZPDQCGKN7ANCNFSM4IEQVNMA>
.
|
Some arguments against ms:
That said, I understand the argument that people would like to keep some kind of "semantic" for string literals. One possibility is to keep ms in Core but says that it does not add automatic quotes (i.e. behave like mtext). People could write a CSS polyfill for non-RTL mode using the :before/:after rules or a JS polyfill that actually change the text content of ms. |
I doubt ms is used much in "classical" mathematical texts but it is very natural when documenting programs or pseudocode etc where a "string" is usually just as primitive datatype as a "number" but... I understand the concerns re picking up attributes.
To make this slightly more distinguished from mtext it could default to monospace? Also would the css concerns be as great if you dropped support for the attributes and always used a straight double quote " at each end? (I suspect it wouldn't help as much as I'd like as you would still be inserting text but I thought it worth asking...) |
Adding default rule font-family: monospace; or text-transform: math-monospace; would work and not cause any issue.
Supporting only the default value still require to modify the tree which is not great for text selection, copy & paste, search or accessibily (I suspect Firefox's implementation is broken with that regard). However, it's true it allows to fix #126 since both quotes are the same. |
I think I am coming round to the idea of dropping ms, Dropping the element entirely is easy to understand (and document) but if we put in a cut down ms that doesn't add text then
will or will not add quotes depending on whether it is interpreted by a full mathml system or mathml core. So while given a choice I'd rather have ms, if it is causing you issues and time that would be better spent elsewhere, then this is a battle I don't want to fight:-) |
This is the same for all elements removed from Core. The idea is that someone would write a CSS or JS polyfill to add quotes in the browser. It can even do feature detection to check if the CSS/JS has to be added.
I think the CSS-implementation is simple and more secure/cleaner than direct C++ implementation so not a big burden for maintenance. However, it does not work in RTL mode and has all the bugs already mentioned for mfenced and it's not clear how we would fix them. So it personally does not really make sense to me to keep such a broken implementation. I'd prefer to get rid of ms if the element is not fundamental. |
Consensus from 2019/11/11: Keep ms in MathML Core but make it behave like mn and add a note to tell people to either put the quotes in the contents or add CSS to style it via before/after. |
…legacy lquote/rquote, a=testonly Automatic update from web-platform-tests Remove test for RTL ms and add test for legacy lquote/rquote (#20426) w3c/mathml#120 -- wpt-commits: cce5582adbd6218dc617052fb3a609667b8faf49 wpt-pr: 20426
…legacy lquote/rquote, a=testonly Automatic update from web-platform-tests Remove test for RTL ms and add test for legacy lquote/rquote (#20426) w3c/mathml#120 -- wpt-commits: cce5582adbd6218dc617052fb3a609667b8faf49 wpt-pr: 20426
…legacy lquote/rquote, a=testonly Automatic update from web-platform-tests Remove test for RTL ms and add test for legacy lquote/rquote (#20426) w3c/mathml#120 -- wpt-commits: cce5582adbd6218dc617052fb3a609667b8faf49 wpt-pr: 20426 UltraBlame original commit: 05152abc3ef5f9f87278c47ea9bccd2f771e15be
…legacy lquote/rquote, a=testonly Automatic update from web-platform-tests Remove test for RTL ms and add test for legacy lquote/rquote (#20426) w3c/mathml#120 -- wpt-commits: cce5582adbd6218dc617052fb3a609667b8faf49 wpt-pr: 20426 UltraBlame original commit: 05152abc3ef5f9f87278c47ea9bccd2f771e15be
…legacy lquote/rquote, a=testonly Automatic update from web-platform-tests Remove test for RTL ms and add test for legacy lquote/rquote (#20426) w3c/mathml#120 -- wpt-commits: cce5582adbd6218dc617052fb3a609667b8faf49 wpt-pr: 20426 UltraBlame original commit: 05152abc3ef5f9f87278c47ea9bccd2f771e15be
Consensus from 2019/11/11 was to keep it in core as a mn-like element. Which is what the spec currently says. w3c/mathml#120
@fred-wang : seems like all but "needs polyfill" can be removed. The CG seems to have resolved this, and there are commits wrt to the spec and testing. Is there more that needs to be done in those areas? |
We can close this but a polyfill is still needed at https://github.com/mathml-refresh/mathml-polyfills/ if this feature is keep in MathML Full too. https://mathml-refresh.github.io/mathml-core/#string-literal-ms has a CSS suggestion in a non-normative note, but it is known to be limited and cause issues, as discussed above. A JS polyfill that generates mo (similar to the mfenced one) would be more appropriate. |
sorry, I misread this. polyfill should be keep indeed. |
Reopened because we still need a polyfil.. I'll write one this weekend and then close it. |
Adding this from the spec for ms to the issue because no one mentioned this difference (and I didn't remember it):
So the polyfill needs add escaping also. |
I've written a polyfills for this: https://github.com/mathml-refresh/mathml-polyfills/tree/master/ms |
https://w3c.github.io/mathml/#presm_ms I think the Full spec should highlight here that this won't work in core. If the css suggested in the core spec is available, quotes will be added, but otherwise not, and escaping would require a javascript polyfill. I fear we have to say that if you are only generating the mathml, and not in control of doucument level polyfills you may prefer to use |
Question: I experimented with relying on quotes in CSS via
<html>
<body>
<style>
mtext.string-literal::before {
content: open-quote;
}
mtext.string-literal::after {
content: close-quote;
}
</style>
<math>
<mtext class="string-literal">123</mtext>
<mo>=</mo>
<mtext class="string-literal">123.0</mtext>
</math>
</body>
</html> I see that the content inserted |
@dginev Chrome blockifies the children of elements with math display ( https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/style/computed_style.h;l=1681;drc=c48b366d76685c392ee294e74f46462de08697bd ) so that suggestion is not going to work (I guess it worked in the past before we fully implemented token elements). A workaround is to normal fallback to display block with |
@fred-wang thank you for clarifying the display details, I hadn't yet learned this. Good to keep in mind. A javascript polyfill is certainly always an option. But since we're talking about mtext and HTML, I also have an alternative in mind that works in both browsers using only CSS. It's via the usual trick of adding an extra snippet: <html>
<body>
<style>
span.string-literal::before {
content: open-quote;
}
span.string-literal::after {
content: close-quote;
}
</style>
<math>
<mtext><span class="string-literal">123</span></mtext>
<mo>=</mo>
<mtext><span class="string-literal">123.0</span></mtext>
</math>
</body>
</html> try live at https://jsfiddle.net/eauv6qxm/ |
I'm not sure it really meets the use case though. ms is usable in non css environments (pdf tagging, Office, ...) If you are transforming to the restricted version in Core you may as well simply add the quotes. The version with embedded html and relying on css doesn't seem to gain anything: It can't be the original form used in the full version, and seems to be a more complicated target than needed for a polyfill compared to a polyfill that simply adds the quotes to the content. |
@davidcarlisle Certainly. But my own usual setting is one where I have a non-javascript polyfill-like application at hand (say latexml), so a declarative alternative in HTML5+CSS is often more tempting than carrying around additional javascript assets. As to why I appear zeroed in on the CSS I wouldn't have gone out of my way to suggest introducing such capabilities, but I had used them in CSS in the past, so it looked like a nice feature to bring into the |
the original motivation for ms was exactly to stop such localisation and make it explicit that this was a string literal (as in programming languages) so typesetting and language specific quotes not wanted. There are of course use cases for having language sensitive quotes within a natural language string in mtext as you show, but I don't think that is related to ms. |
Interesting distinction. Is it really that easy? Some examples that come to mind:
So - to me - localization considerations could be relevant to both natural and programming languages. Of course, one may want to avoid the question entirely, but isn't that the conceptual domain of |
yes sure, all of those can be marked up as ms with suitable lquote and rquote, and all of them require that that quote choice is not subject to the natural language used in the host document. No markup perfectly catches every nuance, but this is why ms was added. |
Right, if that was supported by the renderer. And actually a simple extension to I was trying to find out if the CSS |
Just a note that the current draft description of https://w3c.github.io/mathml/#contm_cs_sec we could use It still seems that it should be possible to use the above CSS in the user agent stylesheet and overcome accessibility issues somehow? |
I've been googling for some time this morning, looking for some example of
<ms>
use that is somehow not just effectively<math><ms>hello world</ms></math>
. For most elements I've looked up, I can find some reasonably simple examples of something that is recognizable as "mathy" content and helps me understand what it does, and what it is for. But, for<ms>
, I can't.Can someone please provide an example demonstrating a real (simple, hopefully) use of this element and why it is useful/necessary to have this particular distinction? If not, can we just drop it from core?
The text was updated successfully, but these errors were encountered: