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

MathML defaults #250

Merged
merged 6 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
266 changes: 266 additions & 0 deletions builtins/safe-default-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,248 @@
"namespace": null
}
]
},
{
"name": "math",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "merror",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "mfrac",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "mi",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "mmultiscripts",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "mn",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "mo",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": [
{
"name": "form",
"namespace": null
},
{
"name": "fence",
"namespace": null
},
{
"name": "separator",
"namespace": null
},
{
"name": "lspace",
"namespace": null
},
{
"name": "rspace",
"namespace": null
},
{
"name": "stretchy",
"namespace": null
},
{
"name": "symmetric",
"namespace": null
},
{
"name": "maxsize",
"namespace": null
},
{
"name": "minsize",
"namespace": null
},
{
"name": "largeop",
"namespace": null
},
{
"name": "movablelimits",
"namespace": null
}
]
},
{
"name": "mover",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": [
{
"name": "accent",
"namespace": null
}
]
},
{
"name": "mpadded",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": [
{
"name": "width",
"namespace": null
},
{
"name": "height",
"namespace": null
},
{
"name": "depth",
"namespace": null
},
{
"name": "lspace",
"namespace": null
},
{
"name": "voffset",
"namespace": null
}
]
},
{
"name": "mphantom",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "mprescripts",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "mroot",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "mrow",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "ms",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "mspace",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": [
{
"name": "width",
"namespace": null
},
{
"name": "height",
"namespace": null
},
{
"name": "depth",
"namespace": null
}
]
},
{
"name": "msqrt",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "mstyle",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "msub",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "msubsup",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "msup",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "mtable",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "mtd",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": [
{
"name": "columnspan",
"namespace": null
},
{
"name": "rowspan",
"namespace": null
}
]
},
{
"name": "mtext",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "mtr",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
},
{
"name": "munder",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": [
{
"name": "accentunder",
"namespace": null
}
]
},
{
"name": "munderover",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": [
{
"name": "accent",
"namespace": null
},
{
"name": "accentunder",
"namespace": null
}
]
},
{
"name": "semantics",
"namespace": "http://www.w3.org/1998/Math/MathML",
"attributes": []
}
],
"attributes": [
Expand All @@ -520,6 +762,30 @@
{
"name": "title",
"namespace": null
},
{
"name": "dir",
"namespace": null
},
{
"name": "displaystyle",
"namespace": null
},
{
"name": "mathbackground",
"namespace": null
},
{
"name": "mathcolor",
"namespace": null
},
{
"name": "mathsize",
"namespace": null
},
{
"name": "scriptlevel",
"namespace": null
}
]
}
12 changes: 9 additions & 3 deletions builtins/safe-default-configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,17 @@ def main():
pass
elif line.startswith("- "):
current.append({ "name": line[2:], "namespace": None })
elif line == "[HTML Global]":
elif line.startswith("[") and line.endswith("Global]"):
current = result["attributes"]
else:
elem = { "name": line, "namespace": "http://www.w3.org/1999/xhtml",
"attributes": [] }
if line.startswith("math "):
elem = {"name": line[5:],
"namespace": "http://www.w3.org/1998/Math/MathML"}
elif line.startswith("svg "):
elem = {"name": line[4:], "namespace": "http://www.w3.org/2000/svg"}
else:
elem = {"name": line, "namespace": "http://www.w3.org/1999/xhtml"}
elem["attributes"] = []
result["elements"].append(elem)
current = elem["attributes"]

Expand Down
76 changes: 75 additions & 1 deletion builtins/safe-default-configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ th
// Purposely omitted.

// SVG: TBD
// MathML: TDB

// HTML global attributes
//
Expand All @@ -169,3 +168,78 @@ th
- lang
- title

otherdaniel marked this conversation as resolved.
Show resolved Hide resolved
// MathML
// https://w3c.github.io/mathml-core/#mathml-elements-and-attributes
//
// See also: https://w3c.github.io/mathml-docs/mathml-safe-list

math math
math merror
math mfrac
math mi
math mmultiscripts
math mn
math mo
- form
- fence
- separator
- lspace
- rspace
- stretchy
- symmetric
- maxsize
- minsize
- largeop
- movablelimits
math mover
- accent
math mpadded
- width
- height
- depth
- lspace
- voffset
math mphantom
math mprescripts
math mroot
math mrow
math ms
math mspace
- width
- height
- depth
math msqrt
math mstyle
math msub
math msubsup
math msup
math mtable
math mtd
- columnspan
- rowspan
math mtext
math mtr
math munder
- accentunder
math munderover
- accent
- accentunder
math semantics

// Purposely omitted:
// - math annotation
// - math annotation-xml
// - math maction

// MathML global attributes
// https://w3c.github.io/mathml-core/#global-attributes
//
// Most are purposely omitted.
[MathML Global]
otherdaniel marked this conversation as resolved.
Show resolved Hide resolved
- dir
- displaystyle
- mathbackground
- mathcolor
- mathsize
- scriptlevel

Loading
Loading