A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on Chat (such as one of these permanent autoconfirmed members).

New Vocabularies Solution: Difference between revisions

From WHATWG Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 17: Line 17:


resetting appropriately:
resetting appropriately:
* if current node is in the mathml namespace and is one of <mi>, <mo>, <mn>, <ms>, <mtext>, "in math content"
* if current node is in the mathml namespace and is one of <mi>, <mo>, <mn>, <ms>, <mtext>, "in namespace content"
* if current node is in the mathml namespace, "in math"
* if current node is in a namespace other than html, "in namespace"
* if current node is in the svg namespace and is one of <foreignObject>, <title>, <desc> "in svg content"
* if current node is in the svg namespace, "in svg"


tokeniser:
tokeniser:
* tokeniser changes so that when insertion mode is "in math" or "in svg", support CDATA blocks.
* tokeniser changes so that when insertion mode is "in namespace", support CDATA blocks.
* tokeniser keeps track of /> endings.
* tokeniser keeps track of /> endings.
* we add all the MathML entities to the entity list.
* we add all the MathML entities to the entity list.
Line 29: Line 27:


'''"in body":'''
'''"in body":'''
* "math" element - switch to "in math"
* "math" element:
* "svg" element - switch to "in svg"
*# insert math element in mathml namespace
 
*# switch to "in namespace", with secondary mode set to whatever insertion mode used to be
'''"in math":'''
 
* comment
*# insert comment
 
* text:
*# insert text
 
* doctype
*# parse error
 
* start tag for: <mi>, <mo>, <mn>, <ms>, <mtext>
*# insert element for token
*# switch to "in math content"
*# if the tag had a closing slash, imply a closing tag with the same tag name
*# if the tag had a closing slash, imply a closing tag with the same tag name
 
* "svg" element
* start tag for one of: maction maligngroup malignmark menclose merror mfenced mfrac mglyph mlabeledtr mmultiscripts mover mpadded mphantom mprescripts mroot mrow mspace msqrt mstyle msub msubsup msup mtable mtd mtr munder munderover none
*# insert svg element in svg namespace
*# insert element for token
*# switch to "in namespace", with secondary mode set to whatever insertion mode used to be
*# if the tag had a closing slash, imply a closing tag with the same tag name
*# if the tag had a closing slash, imply a closing tag with the same tag name


* other start tag:
'''"in namespace":'''
* end tag: </p> or </br>:
*# parse error
*# pop until <math> element is popped
*# reset insertion mode
*# reprocess
 
* other end tag
*# if current element has the tag name of the token: pop it
*# otherwise: if there is a matching element in scope and it has the mathml namespace: parse error, ignore token
*# otherwise:
*## parse error
*## pop until <math> element is popped
*## reset insertion mode
*## reprocess
 
 
'''"in math content":'''
 
* start tag for one of: mglyph malignmark
*# insert element for token, treat as void
 
* end tag:
*# if the bottommost node on the stack, ignoring those whose end tags can be implied, is in the mathml namespace and, ignoring case, has the same tag name as the token, imply end tags, pop the current node, and switch to "in math"
*# otherwise, treat as "in body"
 
* otherwise
*# treat as "in body"
 
 
 
'''"in svg":'''
 
First, perform tagname and attribute name fixup as follows: ...


* comment
* comment
Line 96: Line 47:
*# parse error
*# parse error


* start tag for: <foreignObject>, <desc>, <title>
* if current node namespace is mathml and token is start tag for: <mi>, <mo>, <mn>, <ms>, <mtext>
* if current node namespace is svg and token is start tag for: <foreignobject>, <desc>, <title>
*# if namespace is svg, apply case fixups
*# insert element for token
*# insert element for token
*# switch to "in svg content"
*# switch to "in namespace content"
*# if the tag had a closing slash, imply a closing tag with the same tag name
*# if the tag had a closing slash, imply a closing tag with the same tag name


* start tag for one of: a altGlyph altGlyphDef altGlyphItem animate animateColor animateMotion animateTransform circle clipPath color-profile cursor definition-src defs desc ellipse feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence filter font font-face font-face-format font-face-name font-face-src font-face-uri foreignObject g glyph glyphRef hkern image line linearGradient marker mask metadata missing-glyph mpath path pattern polygon polyline radialGradient rect script set stop style svg switch symbol text textPath title tref tspan use view vkern
* start tag for one of: (html elements)
*# insert element for token
* end tag for one of: </p>, </br>
*# pop nodes until the current node is in the html namespace
*# switch to the secondary mode
*# reprocess token
 
* other start tag
*# if namespace is svg, apply case fixups
*# insert element for token, in same namespace as current node
*# if the tag had a closing slash, imply a closing tag with the same tag name
*# if the tag had a closing slash, imply a closing tag with the same tag name


* other start tag:
* end tag
* end tag: </p> or </br>:
*# let n be current node
*# parse error
*# if n is the top of the stack, parse error (fragment case)
*# pop until <svg> element is popped
*# if lowercase(n.tagName) matches token's tag name:
*# reset insertion mode
*## if n is not the current node, this is a parse error
*# reprocess
*## if n's namespace is the html namespace:
*### pop current node until current node is an html namespace element
*### switch to the secondary mode
*### reprocess token
*### abort
*## otherwise, n is not in the html namespace:
*### pop current node until n is popped
*### abort
*# let n be the node above n in the stack
*# if n is not in scope, parse error, abort
*# return to step 2.


* other end tag
*# if current element has the tag name of the token: pop it
*# otherwise: if there is a matching element in scope and it has the svg namespace: parse error, ignore token
*# otherwise:
*## parse error
*## pop until <svg> element is popped
*## reset insertion mode
*## reprocess


'''"in namespace content":'''


* if currentnode is mathml and start tag for one of: mglyph malignmark
*# insert element for token, treat as void


'''"in svg content":'''
* other start tag
 
*# treat as in the secondary mode
* end tag:
*# if the bottommost node on the stack, ignoring those whose end tags can be implied, is in the svg namespace and, ignoring case, has the same tag name as the token, imply end tags, pop the current node, and switch to "in svg"
*# otherwise, treat as "in body"


* otherwise
* end tag
*# treat as "in body"
*# ???





Revision as of 20:04, 3 April 2008

this doesn't handle these cases well:

<table><math></html><!-- x --> (</html> should be ignored)
<table><td><math></html><!-- x --> (ditto)
<table><caption><math></html><!-- x --> (ditto)
<table><caption><math><mtext><caption>x (<caption> should start new caption)
<em><button><math></em>x (</em> should be ignored)

to fix these we'll need a secondary insertion mode which is set whenever the insertion mode is set to "in math/svg", including in the reset algorithm (just jump down to the secondary steps and continue the walk up until you hit either the root, or a caption, td/th, or table)

what about:

<table><caption><math><mrow><mtext><svg><circle></mrow>
<table><caption><math><mtext><svg><circle><caption>

check that those are handled right. maybe we need a stack for the insertion mode which is "{svg|math}*, {cell|caption|table|body}"

resetting appropriately:

  • if current node is in the mathml namespace and is one of <mi>, <mo>, <mn>, <ms>, <mtext>, "in namespace content"
  • if current node is in a namespace other than html, "in namespace"

tokeniser:

  • tokeniser changes so that when insertion mode is "in namespace", support CDATA blocks.
  • tokeniser keeps track of /> endings.
  • we add all the MathML entities to the entity list.
  • φ works differently when in "in math" or "in math content".

"in body":

  • "math" element:
    1. insert math element in mathml namespace
    2. switch to "in namespace", with secondary mode set to whatever insertion mode used to be
    3. if the tag had a closing slash, imply a closing tag with the same tag name
  • "svg" element
    1. insert svg element in svg namespace
    2. switch to "in namespace", with secondary mode set to whatever insertion mode used to be
    3. if the tag had a closing slash, imply a closing tag with the same tag name

"in namespace":

  • comment
    1. insert comment
  • text:
    1. insert text
  • doctype
    1. parse error
  • if current node namespace is mathml and token is start tag for: <mi>, <mo>, <mn>, <ms>, <mtext>
  • if current node namespace is svg and token is start tag for: <foreignobject>, <desc>, <title>
    1. if namespace is svg, apply case fixups
    2. insert element for token
    3. switch to "in namespace content"
    4. if the tag had a closing slash, imply a closing tag with the same tag name
  • start tag for one of: (html elements)
  • end tag for one of:

    ,
    1. pop nodes until the current node is in the html namespace
    2. switch to the secondary mode
    3. reprocess token
  • other start tag
    1. if namespace is svg, apply case fixups
    2. insert element for token, in same namespace as current node
    3. if the tag had a closing slash, imply a closing tag with the same tag name
  • end tag
    1. let n be current node
    2. if n is the top of the stack, parse error (fragment case)
    3. if lowercase(n.tagName) matches token's tag name:
      1. if n is not the current node, this is a parse error
      2. if n's namespace is the html namespace:
        1. pop current node until current node is an html namespace element
        2. switch to the secondary mode
        3. reprocess token
        4. abort
      3. otherwise, n is not in the html namespace:
        1. pop current node until n is popped
        2. abort
    4. let n be the node above n in the stack
    5. if n is not in scope, parse error, abort
    6. return to step 2.


"in namespace content":

  • if currentnode is mathml and start tag for one of: mglyph malignmark
    1. insert element for token, treat as void
  • other start tag
    1. treat as in the secondary mode
  • end tag
    1. ???


MathML error handling in text/html

Require the following behaviour, since MathML requires the host language to define error handling:

  • An element with the wrong number or type of children must render as an error indicator. (list cases)
  • a sequence of one or more text nodes containing non-inter-element-whitespace must be treated as <mtext>

Interaction of MathML and CSS ('display')

...