Skip to content

Commit

Permalink
Rewrite section for SVG/HTML:
Browse files Browse the repository at this point in the history
- convert it to examples and referring to HTML/SVG spec instead.
- `requiredExtension` is preserved, as that's in browsers/tests but not in the SVG spec yet.
- extend the annotation-xml example to show one can embed SVG/HTML too.

Closes #195
  • Loading branch information
fred-wang committed Nov 22, 2023
1 parent ee46e5b commit 6d393b5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 53 deletions.
27 changes: 27 additions & 0 deletions examples/example-semantics.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,32 @@
<cn>2</cn>
</apply>
</annotation-xml>
<annotation-xml>
<svg width="25" height="75" xmlns="http://www.w3.org/2000/svg">
<path stroke-width="5.8743"
d="m5.9157 27.415h6.601v-22.783l-7.1813 1.4402v-3.6805l7.1408
-1.4402h4.0406v26.464h6.601v3.4005h-17.203z"/>
<path stroke="#000000" stroke-width="2.3409"
d="m0.83496 39.228h23.327"/>
<path stroke-width="5.8743"
d="m8.696 70.638h14.102v3.4005h-18.963v-3.4005q2.3004-2.3804
6.2608-6.3813 3.9806-4.0206 5.0007-5.1808 1.9403-2.1803
2.7004-3.6805 0.78011-1.5202 0.78011-2.9804 0-2.3804
-1.6802-3.8806-1.6603-1.5002-4.3406-1.5002-1.9003 0-4.0206
0.6601-2.1003 0.6601-4.5007 2.0003v-4.0806q2.4404-0.98013
4.5607-1.4802 2.1203-0.50007 3.8806-0.50007 4.6407 0 7.401
2.3203 2.7604 2.3203 2.7604 6.2009 0 1.8403-0.7001 3.5006
-0.68013 1.6402-2.5004 3.8806-0.50007 0.58009-3.1805 3.3605
-2.6804 2.7604-7.5614 7.7412z"/>
</svg>
</annotation-xml>
<annotation-xml encoding="application/xhtml+xml">
<div style="display: inline-flex;
flex-direction: column; align-items: center;">
<div>1</div>
<div></div>
<div>2</div>
</div>
</annotation-xml>
</semantics>
</math>
61 changes: 8 additions & 53 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -576,22 +576,8 @@ <h3>Integration in the Web Platform</h3>
<section id="html-and-svg">
<h4>HTML and SVG</h4>
<p>
When
<a data-cite="HTML/../#parsing">parsing HTML documents</a>
user agents must treat any tag name corresponding to a
<a>MathML Core Element</a> as belonging to the
<a>MathML namespace</a>.
</p>
<p>
Users agents must allow mixing HTML, SVG and MathML elements
as allowed by sections
<a data-cite="HTML/../#html-integration-point">HTML integration point</a>,
<a data-cite="HTML/../#mathml-text-integration-point">MathML integration point</a>,
<a data-cite="HTML/../#tree-construction-dispatcher">tree construction
dispatcher</a>,
<a data-cite="HTML/../#mathml">MathML</a> and
<a data-cite="HTML/../#svg-0">SVG</a>
from [[HTML]].
MathML can be mixed with HTML and SVG as described in the relevant
specifications [[HTML]] [[SVG]].
</p>
<p>
When evaluating the SVG [^svg/requiredExtensions^]
Expand All @@ -609,46 +595,14 @@ <h4>HTML and SVG</h4>
HTML <code>input</code> element is used within the
[^mtext^]
to include an interactive input field inside a mathematical
formula.
formula. See also <a href="#semantics-and-presentation"></a>
for an example of SVG and HTML inside an [^annotation-xml^]
element.
</p>
<pre data-include="examples/example-html-svg.html"
data-include-format="text"></pre>
<img src="examples/example-html-svg.png" alt="html-svg example">
</div>
<div class="note">
<ul>
<li>
The <code>&lt;math&gt;</code> element can be used at
position permitted for
<a>flow content</a>
(e.g. a
<a data-cite="SVG/embedded.html#ForeignObjectElement"><code>&lt;foreignObject&gt;</code></a> element)
or <a>phrasing content</a>.
</li>
<li>
Any
<a>phrasing content</a>
can be used inside
[^mi^],
[^mo^],
[^mn^],
[^ms^] and
[^mtext^]
elements.
</li>
<li>
The <code>&lt;svg&gt;</code> element can be used inside
[^annotation-xml^] elements.
</li>
<li>
Any <a>flow content</a>
can be used inside
[^annotation-xml^] elements with
encoding
<code>application/xhtml+xml</code> or <code>text/html</code>.
</li>
</ul>
</div>
</section>
<section id="css-styling">
<h4>CSS styling</h4>
Expand Down Expand Up @@ -4677,8 +4631,9 @@ <h3>Semantics and Presentation</h3>
<p>
The following example shows how the fraction "one half" can be
annotated with a textual annotation (LaTeX) or an XML annotation
(content MathML). These annotations are not intended to be rendered
by the user agent.
(content MathML), which are not intended to be rendered
by the user agent. This fraction is also annotated with equivalent
SVG and HTML markup.
</p>
<pre data-include="examples/example-semantics.html"
data-include-format="text"></pre>
Expand Down

0 comments on commit 6d393b5

Please sign in to comment.