mml 2.2.1 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitmodules +9 -0
- data/.rubocop.yml +4 -0
- data/.rubocop_todo.yml +36 -17
- data/CLAUDE.md +79 -0
- data/Gemfile +0 -2
- data/README.adoc +334 -82
- data/Rakefile +16 -1
- data/lib/mml/base/content/annotation.rb +30 -0
- data/lib/mml/base/content/annotation_xml.rb +31 -0
- data/lib/mml/base/content/apply.rb +27 -0
- data/lib/mml/base/content/arith.rb +243 -0
- data/lib/mml/base/content/bind.rb +27 -0
- data/lib/mml/base/content/bvar.rb +20 -0
- data/lib/mml/base/content/calculus.rb +103 -0
- data/lib/mml/base/content/cbytes.rb +24 -0
- data/lib/mml/base/content/cerror.rb +24 -0
- data/lib/mml/base/content/ci.rb +77 -0
- data/lib/mml/base/content/cn.rb +33 -0
- data/lib/mml/base/content/condition.rb +20 -0
- data/lib/mml/base/content/constants.rb +173 -0
- data/lib/mml/base/content/cs.rb +22 -0
- data/lib/mml/base/content/csymbol.rb +79 -0
- data/lib/mml/base/content/declare.rb +34 -0
- data/lib/mml/base/content/degree.rb +20 -0
- data/lib/mml/base/content/elementary_functions.rb +309 -0
- data/lib/mml/base/content/fn.rb +25 -0
- data/lib/mml/base/content/functions.rb +85 -0
- data/lib/mml/base/content/interval.rb +24 -0
- data/lib/mml/base/content/inverse.rb +25 -0
- data/lib/mml/base/content/lambda.rb +20 -0
- data/lib/mml/base/content/linear_algebra.rb +122 -0
- data/lib/mml/base/content/logic.rb +93 -0
- data/lib/mml/base/content/otherwise.rb +20 -0
- data/lib/mml/base/content/piece.rb +20 -0
- data/lib/mml/base/content/piecewise.rb +20 -0
- data/lib/mml/base/content/relations.rb +113 -0
- data/lib/mml/base/content/reln.rb +19 -0
- data/lib/mml/base/content/semantics.rb +27 -0
- data/lib/mml/base/content/sep.rb +19 -0
- data/lib/mml/base/content/sets.rb +163 -0
- data/lib/mml/base/content/share.rb +24 -0
- data/lib/mml/base/content/statistics.rb +95 -0
- data/lib/mml/base/content/vector_calculus.rb +63 -0
- data/lib/mml/base/content_loader.rb +195 -0
- data/lib/mml/base/deprecated_font_attributes.rb +31 -0
- data/lib/mml/base/maction.rb +29 -0
- data/lib/mml/base/maligngroup.rb +26 -0
- data/lib/mml/base/malignmark.rb +26 -0
- data/lib/mml/base/math.rb +64 -0
- data/lib/mml/base/menclose.rb +27 -0
- data/lib/mml/base/merror.rb +25 -0
- data/lib/mml/base/mfenced.rb +34 -0
- data/lib/mml/base/mfrac.rb +35 -0
- data/lib/mml/base/mfraction.rb +33 -0
- data/lib/mml/base/mglyph.rb +44 -0
- data/lib/mml/base/mi.rb +37 -0
- data/lib/mml/base/mlabeledtr.rb +33 -0
- data/lib/mml/base/mlongdiv.rb +31 -0
- data/lib/mml/base/mmultiscripts.rb +31 -0
- data/lib/mml/base/mn.rb +35 -0
- data/lib/mml/base/mo.rb +74 -0
- data/lib/mml/base/mover.rb +29 -0
- data/lib/mml/base/mpadded.rb +35 -0
- data/lib/mml/base/mphantom.rb +25 -0
- data/lib/mml/base/mprescripts.rb +24 -0
- data/lib/mml/base/mroot.rb +25 -0
- data/lib/mml/base/mrow.rb +27 -0
- data/lib/mml/base/ms.rb +35 -0
- data/lib/mml/base/mscarries.rb +33 -0
- data/lib/mml/base/mscarry.rb +29 -0
- data/lib/mml/base/msgroup.rb +31 -0
- data/lib/mml/base/msline.rb +34 -0
- data/lib/mml/base/mspace.rb +52 -0
- data/lib/mml/base/msqrt.rb +25 -0
- data/lib/mml/base/msrow.rb +27 -0
- data/lib/mml/base/mstack.rb +33 -0
- data/lib/mml/base/mstyle.rb +185 -0
- data/lib/mml/base/msub.rb +27 -0
- data/lib/mml/base/msubsup.rb +29 -0
- data/lib/mml/base/msup.rb +27 -0
- data/lib/mml/base/mtable.rb +65 -0
- data/lib/mml/base/mtd.rb +35 -0
- data/lib/mml/base/mtext.rb +30 -0
- data/lib/mml/base/mtr.rb +35 -0
- data/lib/mml/base/munder.rb +31 -0
- data/lib/mml/base/munderover.rb +31 -0
- data/lib/mml/base/none.rb +24 -0
- data/lib/mml/base/semantics.rb +25 -0
- data/lib/mml/base/universal_presentation_attributes.rb +42 -0
- data/lib/mml/base/v3_common.rb +16 -0
- data/lib/mml/base/v3_only/operator_attrs.rb +24 -0
- data/lib/mml/base/v3_only/style_attrs.rb +31 -0
- data/lib/mml/base/v3_only/table_attrs.rb +28 -0
- data/lib/mml/base/v3_only.rb +11 -0
- data/lib/mml/base/v3_presentation_attributes.rb +15 -0
- data/lib/mml/base/v4_attributes.rb +16 -0
- data/lib/mml/base.rb +61 -0
- data/lib/mml/common_elements.rb +419 -0
- data/lib/mml/context_configuration.rb +147 -0
- data/lib/mml/context_options.rb +64 -0
- data/lib/mml/namespace.rb +10 -0
- data/lib/mml/v2/annotation.rb +9 -0
- data/lib/mml/v2/annotation_xml.rb +9 -0
- data/lib/mml/v2/apply.rb +9 -0
- data/lib/mml/v2/arith.rb +93 -0
- data/lib/mml/v2/bind.rb +9 -0
- data/lib/mml/v2/bvar.rb +9 -0
- data/lib/mml/v2/calculus.rb +33 -0
- data/lib/mml/v2/ci.rb +9 -0
- data/lib/mml/v2/cn.rb +9 -0
- data/lib/mml/v2/common_elements.rb +34 -0
- data/lib/mml/v2/condition.rb +9 -0
- data/lib/mml/v2/configuration.rb +13 -0
- data/lib/mml/v2/constants.rb +65 -0
- data/lib/mml/v2/csymbol.rb +9 -0
- data/lib/mml/v2/degree.rb +9 -0
- data/lib/mml/v2/elementary_functions.rb +121 -0
- data/lib/mml/v2/fn.rb +9 -0
- data/lib/mml/v2/functions.rb +29 -0
- data/lib/mml/v2/interval.rb +9 -0
- data/lib/mml/v2/inverse.rb +9 -0
- data/lib/mml/v2/lambda.rb +9 -0
- data/lib/mml/v2/linear_algebra.rb +41 -0
- data/lib/mml/v2/logic.rb +33 -0
- data/lib/mml/v2/maction.rb +9 -0
- data/lib/mml/v2/maligngroup.rb +9 -0
- data/lib/mml/v2/malignmark.rb +9 -0
- data/lib/mml/v2/math.rb +11 -0
- data/lib/mml/v2/menclose.rb +9 -0
- data/lib/mml/v2/merror.rb +9 -0
- data/lib/mml/v2/mfenced.rb +9 -0
- data/lib/mml/v2/mfrac.rb +9 -0
- data/lib/mml/v2/mfraction.rb +9 -0
- data/lib/mml/v2/mglyph.rb +9 -0
- data/lib/mml/v2/mi.rb +9 -0
- data/lib/mml/v2/mlabeledtr.rb +9 -0
- data/lib/mml/v2/mlongdiv.rb +9 -0
- data/lib/mml/v2/mmultiscripts.rb +9 -0
- data/lib/mml/v2/mn.rb +9 -0
- data/lib/mml/v2/mo.rb +10 -0
- data/lib/mml/v2/mover.rb +9 -0
- data/lib/mml/v2/mpadded.rb +9 -0
- data/lib/mml/v2/mphantom.rb +9 -0
- data/lib/mml/v2/mprescripts.rb +9 -0
- data/lib/mml/v2/mroot.rb +9 -0
- data/lib/mml/v2/mrow.rb +9 -0
- data/lib/mml/v2/ms.rb +9 -0
- data/lib/mml/v2/mscarries.rb +9 -0
- data/lib/mml/v2/mscarry.rb +9 -0
- data/lib/mml/v2/msgroup.rb +9 -0
- data/lib/mml/v2/msline.rb +9 -0
- data/lib/mml/v2/mspace.rb +9 -0
- data/lib/mml/v2/msqrt.rb +9 -0
- data/lib/mml/v2/msrow.rb +9 -0
- data/lib/mml/v2/mstack.rb +9 -0
- data/lib/mml/v2/mstyle.rb +10 -0
- data/lib/mml/v2/msub.rb +9 -0
- data/lib/mml/v2/msubsup.rb +9 -0
- data/lib/mml/v2/msup.rb +9 -0
- data/lib/mml/v2/mtable.rb +9 -0
- data/lib/mml/v2/mtd.rb +9 -0
- data/lib/mml/v2/mtext.rb +9 -0
- data/lib/mml/v2/mtr.rb +9 -0
- data/lib/mml/v2/munder.rb +9 -0
- data/lib/mml/v2/munderover.rb +9 -0
- data/lib/mml/v2/namespace.rb +7 -0
- data/lib/mml/v2/none.rb +9 -0
- data/lib/mml/v2/otherwise.rb +9 -0
- data/lib/mml/v2/piece.rb +9 -0
- data/lib/mml/v2/piecewise.rb +9 -0
- data/lib/mml/v2/relations.rb +41 -0
- data/lib/mml/v2/reln.rb +13 -0
- data/lib/mml/v2/semantics.rb +9 -0
- data/lib/mml/v2/sep.rb +9 -0
- data/lib/mml/v2/sets.rb +57 -0
- data/lib/mml/v2/statistics.rb +33 -0
- data/lib/mml/v2/vector_calculus.rb +21 -0
- data/lib/mml/v2.rb +311 -0
- data/lib/mml/v3/annotation.rb +10 -0
- data/lib/mml/v3/annotation_xml.rb +10 -0
- data/lib/mml/v3/apply.rb +10 -0
- data/lib/mml/v3/arith.rb +115 -0
- data/lib/mml/v3/bind.rb +10 -0
- data/lib/mml/v3/calculus.rb +40 -0
- data/lib/mml/v3/cbytes.rb +10 -0
- data/lib/mml/v3/cerror.rb +10 -0
- data/lib/mml/v3/ci.rb +10 -0
- data/lib/mml/v3/cn.rb +10 -0
- data/lib/mml/v3/common_elements.rb +42 -0
- data/lib/mml/v3/configuration.rb +4 -96
- data/lib/mml/v3/constants.rb +80 -0
- data/lib/mml/v3/constructs.rb +55 -0
- data/lib/mml/v3/cs.rb +10 -0
- data/lib/mml/v3/csymbol.rb +10 -0
- data/lib/mml/v3/deprecated_content.rb +29 -0
- data/lib/mml/v3/elementary_functions.rb +145 -0
- data/lib/mml/v3/functions.rb +35 -0
- data/lib/mml/v3/linear_algebra.rb +50 -0
- data/lib/mml/v3/logic.rb +40 -0
- data/lib/mml/v3/maction.rb +3 -15
- data/lib/mml/v3/maligngroup.rb +2 -12
- data/lib/mml/v3/malignmark.rb +2 -12
- data/lib/mml/v3/math.rb +7 -8
- data/lib/mml/v3/menclose.rb +3 -14
- data/lib/mml/v3/merror.rb +3 -12
- data/lib/mml/v3/mfenced.rb +3 -21
- data/lib/mml/v3/mfrac.rb +3 -20
- data/lib/mml/v3/mfraction.rb +3 -20
- data/lib/mml/v3/mglyph.rb +3 -38
- data/lib/mml/v3/mi.rb +4 -30
- data/lib/mml/v3/mlabeledtr.rb +2 -23
- data/lib/mml/v3/mlongdiv.rb +3 -18
- data/lib/mml/v3/mmultiscripts.rb +3 -20
- data/lib/mml/v3/mn.rb +4 -30
- data/lib/mml/v3/mo.rb +5 -78
- data/lib/mml/v3/mover.rb +3 -16
- data/lib/mml/v3/mpadded.rb +3 -22
- data/lib/mml/v3/mphantom.rb +3 -12
- data/lib/mml/v3/mprescripts.rb +2 -10
- data/lib/mml/v3/mroot.rb +3 -12
- data/lib/mml/v3/mrow.rb +4 -18
- data/lib/mml/v3/ms.rb +5 -36
- data/lib/mml/v3/mscarries.rb +3 -20
- data/lib/mml/v3/mscarry.rb +3 -16
- data/lib/mml/v3/msgroup.rb +3 -18
- data/lib/mml/v3/msline.rb +2 -20
- data/lib/mml/v3/mspace.rb +3 -50
- data/lib/mml/v3/msqrt.rb +3 -12
- data/lib/mml/v3/msrow.rb +3 -14
- data/lib/mml/v3/mstack.rb +3 -20
- data/lib/mml/v3/mstyle.rb +6 -204
- data/lib/mml/v3/msub.rb +3 -14
- data/lib/mml/v3/msubsup.rb +3 -16
- data/lib/mml/v3/msup.rb +3 -14
- data/lib/mml/v3/mtable.rb +3 -53
- data/lib/mml/v3/mtd.rb +3 -16
- data/lib/mml/v3/mtext.rb +4 -30
- data/lib/mml/v3/mtr.rb +2 -21
- data/lib/mml/v3/munder.rb +3 -18
- data/lib/mml/v3/munderover.rb +3 -18
- data/lib/mml/v3/namespace.rb +1 -4
- data/lib/mml/v3/none.rb +2 -10
- data/lib/mml/v3/relations.rb +50 -0
- data/lib/mml/v3/semantics.rb +3 -12
- data/lib/mml/v3/sets.rb +70 -0
- data/lib/mml/v3/statistics.rb +40 -0
- data/lib/mml/v3/vector_calculus.rb +25 -0
- data/lib/mml/v3.rb +74 -75
- data/lib/mml/v4/a.rb +3 -13
- data/lib/mml/v4/annotation.rb +10 -0
- data/lib/mml/v4/annotation_xml.rb +14 -0
- data/lib/mml/v4/apply.rb +9 -0
- data/lib/mml/v4/arith.rb +93 -0
- data/lib/mml/v4/calculus.rb +25 -0
- data/lib/mml/v4/cbytes.rb +9 -0
- data/lib/mml/v4/cerror.rb +9 -0
- data/lib/mml/v4/ci.rb +9 -0
- data/lib/mml/v4/cn.rb +9 -0
- data/lib/mml/v4/common_elements.rb +46 -0
- data/lib/mml/v4/configuration.rb +4 -97
- data/lib/mml/v4/constants.rb +65 -0
- data/lib/mml/v4/constructs.rb +49 -0
- data/lib/mml/v4/cs.rb +9 -0
- data/lib/mml/v4/csymbol.rb +9 -0
- data/lib/mml/v4/deprecated_content.rb +25 -0
- data/lib/mml/v4/elementary_functions.rb +118 -0
- data/lib/mml/v4/factorof.rb +9 -0
- data/lib/mml/v4/functions.rb +30 -0
- data/lib/mml/v4/limit.rb +9 -0
- data/lib/mml/v4/linear_algebra.rb +41 -0
- data/lib/mml/v4/logic.rb +33 -0
- data/lib/mml/v4/maction.rb +3 -19
- data/lib/mml/v4/maligngroup.rb +3 -17
- data/lib/mml/v4/malignmark.rb +3 -17
- data/lib/mml/v4/math.rb +4 -14
- data/lib/mml/v4/menclose.rb +3 -18
- data/lib/mml/v4/merror.rb +3 -16
- data/lib/mml/v4/mfenced.rb +3 -25
- data/lib/mml/v4/mfrac.rb +3 -24
- data/lib/mml/v4/mfraction.rb +3 -20
- data/lib/mml/v4/mglyph.rb +3 -35
- data/lib/mml/v4/mi.rb +4 -30
- data/lib/mml/v4/mlabeledtr.rb +5 -23
- data/lib/mml/v4/mlongdiv.rb +3 -18
- data/lib/mml/v4/mmultiscripts.rb +3 -24
- data/lib/mml/v4/mn.rb +4 -29
- data/lib/mml/v4/mo.rb +4 -75
- data/lib/mml/v4/mover.rb +3 -20
- data/lib/mml/v4/mpadded.rb +3 -26
- data/lib/mml/v4/mphantom.rb +3 -16
- data/lib/mml/v4/mprescripts.rb +3 -11
- data/lib/mml/v4/mroot.rb +3 -16
- data/lib/mml/v4/mrow.rb +4 -20
- data/lib/mml/v4/ms.rb +4 -34
- data/lib/mml/v4/mscarries.rb +3 -20
- data/lib/mml/v4/mscarry.rb +3 -16
- data/lib/mml/v4/msgroup.rb +3 -18
- data/lib/mml/v4/msline.rb +3 -21
- data/lib/mml/v4/mspace.rb +3 -49
- data/lib/mml/v4/msqrt.rb +3 -16
- data/lib/mml/v4/msrow.rb +3 -18
- data/lib/mml/v4/mstack.rb +3 -24
- data/lib/mml/v4/mstyle.rb +4 -186
- data/lib/mml/v4/msub.rb +3 -18
- data/lib/mml/v4/msubsup.rb +3 -20
- data/lib/mml/v4/msup.rb +3 -18
- data/lib/mml/v4/mtable.rb +3 -55
- data/lib/mml/v4/mtd.rb +3 -20
- data/lib/mml/v4/mtext.rb +4 -29
- data/lib/mml/v4/mtr.rb +3 -25
- data/lib/mml/v4/munder.rb +3 -22
- data/lib/mml/v4/munderover.rb +3 -22
- data/lib/mml/v4/namespace.rb +1 -4
- data/lib/mml/v4/none.rb +5 -11
- data/lib/mml/v4/relations.rb +37 -0
- data/lib/mml/v4/semantics.rb +3 -12
- data/lib/mml/v4/sets.rb +57 -0
- data/lib/mml/v4/statistics.rb +33 -0
- data/lib/mml/v4/tendsto.rb +9 -0
- data/lib/mml/v4/vector_calculus.rb +21 -0
- data/lib/mml/v4.rb +426 -71
- data/lib/mml/version.rb +1 -1
- data/lib/mml/versioned_parser.rb +46 -0
- data/lib/mml.rb +36 -6
- data/reference-docs/mathml-source/pubtext/mathmlspec.dtd +150 -0
- data/reference-docs/mathml-source/pubtext/xmlspec.dtd +2649 -0
- data/reference-docs/mathml-source/readme.txt +40 -0
- data/reference-docs/mathml-source/run +296 -0
- data/reference-docs/mathml-source/style/html/html2xhtml.xsl +216 -0
- data/reference-docs/mathml-source/style/html/images.xsl +98 -0
- data/reference-docs/mathml-source/style/html/mml6.xsl +1156 -0
- data/reference-docs/mathml-source/style/html/mmldiff.xsl +566 -0
- data/reference-docs/mathml-source/style/html/mmlspec.xsl +2531 -0
- data/reference-docs/mathml-source/style/html/slices-common.xsl +312 -0
- data/reference-docs/mathml-source/style/html/slices.xsl +48 -0
- data/reference-docs/mathml-source/style/html/xmlspec.xsl +2542 -0
- data/reference-docs/mathml-source/style/pdf/mathmlspec.xsl +2510 -0
- data/reference-docs/mathml-source/xml/changes.xml +773 -0
- data/reference-docs/mathml-source/xml/character-set.xml +1011 -0
- data/reference-docs/mathml-source/xml/content-element-def.xml +6143 -0
- data/reference-docs/mathml-source/xml/content-markup.xml +8178 -0
- data/reference-docs/mathml-source/xml/contributors.xml +425 -0
- data/reference-docs/mathml-source/xml/dom-bindings.xml +20 -0
- data/reference-docs/mathml-source/xml/dom-intro.xml +114 -0
- data/reference-docs/mathml-source/xml/fundamentals.xml +1646 -0
- data/reference-docs/mathml-source/xml/glossary.xml +519 -0
- data/reference-docs/mathml-source/xml/interface.xml +1096 -0
- data/reference-docs/mathml-source/xml/introduction.xml +724 -0
- data/reference-docs/mathml-source/xml/mathml-css-sample.xml +304 -0
- data/reference-docs/mathml-source/xml/mathml-dom.xml +3813 -0
- data/reference-docs/mathml-source/xml/mathml-spec.xml +356 -0
- data/reference-docs/mathml-source/xml/mixing.xml +982 -0
- data/reference-docs/mathml-source/xml/operator-dict.xml +551 -0
- data/reference-docs/mathml-source/xml/parsing.xml +2565 -0
- data/reference-docs/mathml-source/xml/presentation-markup.xml +6834 -0
- data/reference-docs/mathml-source/xml/references.xml +323 -0
- data/reference-docs/mathml-source/xml/validation-grammar.xml +877 -0
- data/schemas/README.adoc +15 -0
- data/schemas/mathml2/CVS/Entries +4 -0
- data/schemas/mathml2/CVS/Repository +1 -0
- data/schemas/mathml2/CVS/Root +1 -0
- data/schemas/mathml2/common/CVS/Entries +4 -0
- data/schemas/mathml2/common/CVS/Repository +1 -0
- data/schemas/mathml2/common/CVS/Root +1 -0
- data/schemas/mathml2/common/common-attribs.xsd +41 -0
- data/schemas/mathml2/common/math.xsd +126 -0
- data/schemas/mathml2/common/xlink-href.xsd +20 -0
- data/schemas/mathml2/content/CVS/Entries +16 -0
- data/schemas/mathml2/content/CVS/Repository +1 -0
- data/schemas/mathml2/content/CVS/Root +1 -0
- data/schemas/mathml2/content/arith.xsd +90 -0
- data/schemas/mathml2/content/calculus.xsd +146 -0
- data/schemas/mathml2/content/common-attrib.xsd +30 -0
- data/schemas/mathml2/content/constants.xsd +83 -0
- data/schemas/mathml2/content/constructs.xsd +260 -0
- data/schemas/mathml2/content/elementary-functions.xsd +117 -0
- data/schemas/mathml2/content/functions.xsd +73 -0
- data/schemas/mathml2/content/linear-algebra.xsd +173 -0
- data/schemas/mathml2/content/logic.xsd +53 -0
- data/schemas/mathml2/content/relations.xsd +55 -0
- data/schemas/mathml2/content/semantics.xsd +85 -0
- data/schemas/mathml2/content/sets.xsd +236 -0
- data/schemas/mathml2/content/statistics.xsd +136 -0
- data/schemas/mathml2/content/tokens.xsd +120 -0
- data/schemas/mathml2/content/tokens.xsd.~1.3.~ +119 -0
- data/schemas/mathml2/content/vector-calculus.xsd +88 -0
- data/schemas/mathml2/mathml2.xsd +59 -0
- data/schemas/mathml2/presentation/CVS/Entries +12 -0
- data/schemas/mathml2/presentation/CVS/Repository +1 -0
- data/schemas/mathml2/presentation/CVS/Root +1 -0
- data/schemas/mathml2/presentation/action.xsd +44 -0
- data/schemas/mathml2/presentation/characters.xsd +37 -0
- data/schemas/mathml2/presentation/common-attribs.xsd +113 -0
- data/schemas/mathml2/presentation/common-types.xsd +103 -0
- data/schemas/mathml2/presentation/error.xsd +40 -0
- data/schemas/mathml2/presentation/layout.xsd +195 -0
- data/schemas/mathml2/presentation/scripts.xsd +186 -0
- data/schemas/mathml2/presentation/space.xsd +52 -0
- data/schemas/mathml2/presentation/style.xsd +69 -0
- data/schemas/mathml2/presentation/table.xsd +216 -0
- data/schemas/mathml2/presentation/tokens.xsd +124 -0
- data/schemas/mathml3/mathml3-common.xsd +99 -0
- data/schemas/mathml3/mathml3-content.xsd +684 -0
- data/schemas/mathml3/mathml3-presentation.xsd +2151 -0
- data/schemas/mathml3/mathml3-strict-content.xsd +186 -0
- data/schemas/mathml3/mathml3.xsd +9 -0
- metadata +308 -4
- data/lib/mml/v3/common_attributes.rb +0 -22
- data/lib/mml/v4/common_attributes.rb +0 -26
data/lib/mml/v4.rb
CHANGED
|
@@ -1,81 +1,436 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
require_relative "versioned_parser"
|
|
5
|
+
|
|
6
|
+
Moxml::Config.default_adapter = Mml::DEFAULT_ADAPTER
|
|
7
|
+
|
|
8
|
+
require_relative "v4/configuration"
|
|
9
|
+
require_relative "v4/namespace"
|
|
10
|
+
require_relative "v4/common_elements"
|
|
4
11
|
|
|
5
12
|
module Mml
|
|
6
13
|
module V4
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
autoload :
|
|
11
|
-
autoload :
|
|
12
|
-
autoload :
|
|
13
|
-
autoload :
|
|
14
|
-
autoload :
|
|
15
|
-
autoload :
|
|
16
|
-
autoload :
|
|
17
|
-
autoload :
|
|
18
|
-
autoload :
|
|
14
|
+
extend Mml::VersionedParser
|
|
15
|
+
|
|
16
|
+
# Presentation elements
|
|
17
|
+
autoload :A, "mml/v4/a"
|
|
18
|
+
autoload :Maction, "mml/v4/maction"
|
|
19
|
+
autoload :Maligngroup, "mml/v4/maligngroup"
|
|
20
|
+
autoload :Malignmark, "mml/v4/malignmark"
|
|
21
|
+
autoload :Menclose, "mml/v4/menclose"
|
|
22
|
+
autoload :Merror, "mml/v4/merror"
|
|
23
|
+
autoload :Mfenced, "mml/v4/mfenced"
|
|
24
|
+
autoload :Mfrac, "mml/v4/mfrac"
|
|
25
|
+
autoload :Mfraction, "mml/v4/mfraction"
|
|
26
|
+
autoload :Mglyph, "mml/v4/mglyph"
|
|
19
27
|
autoload :Mi, "mml/v4/mi"
|
|
20
|
-
autoload :Mlabeledtr, "mml/v4/mlabeledtr"
|
|
21
28
|
autoload :Mlongdiv, "mml/v4/mlongdiv"
|
|
22
|
-
autoload :
|
|
23
|
-
autoload :
|
|
24
|
-
autoload :
|
|
25
|
-
autoload :
|
|
26
|
-
autoload :
|
|
27
|
-
autoload :
|
|
28
|
-
autoload :
|
|
29
|
-
autoload :
|
|
30
|
-
autoload :Mrow, "mml/v4/mrow"
|
|
29
|
+
autoload :Mn, "mml/v4/mn"
|
|
30
|
+
autoload :Mo, "mml/v4/mo"
|
|
31
|
+
autoload :Mover, "mml/v4/mover"
|
|
32
|
+
autoload :Mpadded, "mml/v4/mpadded"
|
|
33
|
+
autoload :Mphantom, "mml/v4/mphantom"
|
|
34
|
+
autoload :Mprescripts, "mml/v4/mprescripts"
|
|
35
|
+
autoload :Mroot, "mml/v4/mroot"
|
|
36
|
+
autoload :Mrow, "mml/v4/mrow"
|
|
31
37
|
autoload :Ms, "mml/v4/ms"
|
|
32
|
-
autoload :Mscarries,
|
|
33
|
-
autoload :Mscarry,
|
|
34
|
-
autoload :Msgroup,
|
|
35
|
-
autoload :Msline,
|
|
36
|
-
autoload :Mspace,
|
|
37
|
-
autoload :Msqrt,
|
|
38
|
-
autoload :Msrow,
|
|
39
|
-
autoload :Mstack,
|
|
40
|
-
autoload :Mstyle,
|
|
41
|
-
autoload :Msub,
|
|
42
|
-
autoload :Msubsup,
|
|
43
|
-
autoload :Msup,
|
|
44
|
-
autoload :
|
|
45
|
-
autoload :
|
|
46
|
-
autoload :Mtext,
|
|
47
|
-
autoload :Mtr,
|
|
48
|
-
autoload :
|
|
49
|
-
autoload :
|
|
50
|
-
autoload :
|
|
51
|
-
autoload :
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
38
|
+
autoload :Mscarries, "mml/v4/mscarries"
|
|
39
|
+
autoload :Mscarry, "mml/v4/mscarry"
|
|
40
|
+
autoload :Msgroup, "mml/v4/msgroup"
|
|
41
|
+
autoload :Msline, "mml/v4/msline"
|
|
42
|
+
autoload :Mspace, "mml/v4/mspace"
|
|
43
|
+
autoload :Msqrt, "mml/v4/msqrt"
|
|
44
|
+
autoload :Msrow, "mml/v4/msrow"
|
|
45
|
+
autoload :Mstack, "mml/v4/mstack"
|
|
46
|
+
autoload :Mstyle, "mml/v4/mstyle"
|
|
47
|
+
autoload :Msub, "mml/v4/msub"
|
|
48
|
+
autoload :Msubsup, "mml/v4/msubsup"
|
|
49
|
+
autoload :Msup, "mml/v4/msup"
|
|
50
|
+
autoload :Mtd, "mml/v4/mtd"
|
|
51
|
+
autoload :Mtable, "mml/v4/mtable"
|
|
52
|
+
autoload :Mtext, "mml/v4/mtext"
|
|
53
|
+
autoload :Mtr, "mml/v4/mtr"
|
|
54
|
+
autoload :Mlabeledtr, "mml/v4/mlabeledtr"
|
|
55
|
+
autoload :Munder, "mml/v4/munder"
|
|
56
|
+
autoload :Munderover, "mml/v4/munderover"
|
|
57
|
+
autoload :Mmultiscripts, "mml/v4/mmultiscripts"
|
|
58
|
+
autoload :None, "mml/v4/none"
|
|
59
|
+
autoload :Semantics, "mml/v4/semantics"
|
|
60
|
+
autoload :Math, "mml/v4/math"
|
|
61
|
+
|
|
62
|
+
# Content elements - autoloaded individually
|
|
63
|
+
autoload :AnnotationXml, "mml/v4/annotation_xml"
|
|
64
|
+
autoload :Annotation, "mml/v4/annotation"
|
|
65
|
+
autoload :Apply, "mml/v4/apply"
|
|
66
|
+
autoload :Cbytes, "mml/v4/cbytes"
|
|
67
|
+
autoload :Cerror, "mml/v4/cerror"
|
|
68
|
+
autoload :Ci, "mml/v4/ci"
|
|
69
|
+
autoload :Cn, "mml/v4/cn"
|
|
70
|
+
autoload :Cs, "mml/v4/cs"
|
|
71
|
+
autoload :Csymbol, "mml/v4/csymbol"
|
|
72
|
+
autoload :Bvar, "mml/v4/constructs"
|
|
73
|
+
autoload :Condition, "mml/v4/constructs"
|
|
74
|
+
autoload :Interval, "mml/v4/constructs"
|
|
75
|
+
autoload :Lambda, "mml/v4/constructs"
|
|
76
|
+
autoload :Inverse, "mml/v4/constructs"
|
|
77
|
+
autoload :Degree, "mml/v4/constructs"
|
|
78
|
+
autoload :Piecewise, "mml/v4/constructs"
|
|
79
|
+
autoload :Piece, "mml/v4/constructs"
|
|
80
|
+
autoload :Otherwise, "mml/v4/constructs"
|
|
81
|
+
autoload :Sep, "mml/v4/constructs"
|
|
82
|
+
autoload :Bind, "mml/v4/constructs"
|
|
83
|
+
autoload :Fn, "mml/v4/deprecated_content"
|
|
84
|
+
autoload :Reln, "mml/v4/deprecated_content"
|
|
85
|
+
autoload :Declare, "mml/v4/deprecated_content"
|
|
86
|
+
autoload :Share, "mml/v4/deprecated_content"
|
|
87
|
+
autoload :Abs, "mml/v4/arith"
|
|
88
|
+
autoload :Conjugate, "mml/v4/arith"
|
|
89
|
+
autoload :Arg, "mml/v4/arith"
|
|
90
|
+
autoload :Real, "mml/v4/arith"
|
|
91
|
+
autoload :Imaginary, "mml/v4/arith"
|
|
92
|
+
autoload :Floor, "mml/v4/arith"
|
|
93
|
+
autoload :Ceiling, "mml/v4/arith"
|
|
94
|
+
autoload :Quotient, "mml/v4/arith"
|
|
95
|
+
autoload :Divide, "mml/v4/arith"
|
|
96
|
+
autoload :Rem, "mml/v4/arith"
|
|
97
|
+
autoload :Minus, "mml/v4/arith"
|
|
98
|
+
autoload :Plus, "mml/v4/arith"
|
|
99
|
+
autoload :Times, "mml/v4/arith"
|
|
100
|
+
autoload :Power, "mml/v4/arith"
|
|
101
|
+
autoload :Root, "mml/v4/arith"
|
|
102
|
+
autoload :Max, "mml/v4/arith"
|
|
103
|
+
autoload :Min, "mml/v4/arith"
|
|
104
|
+
autoload :Gcd, "mml/v4/arith"
|
|
105
|
+
autoload :Lcm, "mml/v4/arith"
|
|
106
|
+
autoload :Sum, "mml/v4/arith"
|
|
107
|
+
autoload :Product, "mml/v4/arith"
|
|
108
|
+
autoload :Factorial, "mml/v4/arith"
|
|
109
|
+
autoload :And, "mml/v4/logic"
|
|
110
|
+
autoload :Or, "mml/v4/logic"
|
|
111
|
+
autoload :Xor, "mml/v4/logic"
|
|
112
|
+
autoload :Not, "mml/v4/logic"
|
|
113
|
+
autoload :Implies, "mml/v4/logic"
|
|
114
|
+
autoload :Forall, "mml/v4/logic"
|
|
115
|
+
autoload :Exists, "mml/v4/logic"
|
|
116
|
+
autoload :Eq, "mml/v4/relations"
|
|
117
|
+
autoload :Neq, "mml/v4/relations"
|
|
118
|
+
autoload :Lt, "mml/v4/relations"
|
|
119
|
+
autoload :Gt, "mml/v4/relations"
|
|
120
|
+
autoload :Leq, "mml/v4/relations"
|
|
121
|
+
autoload :Geq, "mml/v4/relations"
|
|
122
|
+
autoload :Equivalent, "mml/v4/relations"
|
|
123
|
+
autoload :Approx, "mml/v4/relations"
|
|
124
|
+
autoload :Set, "mml/v4/sets"
|
|
125
|
+
autoload :List, "mml/v4/sets"
|
|
126
|
+
autoload :Union, "mml/v4/sets"
|
|
127
|
+
autoload :Intersect, "mml/v4/sets"
|
|
128
|
+
autoload :In, "mml/v4/sets"
|
|
129
|
+
autoload :Notin, "mml/v4/sets"
|
|
130
|
+
autoload :Notsubset, "mml/v4/sets"
|
|
131
|
+
autoload :Notprsubset, "mml/v4/sets"
|
|
132
|
+
autoload :Subset, "mml/v4/sets"
|
|
133
|
+
autoload :Prsubset, "mml/v4/sets"
|
|
134
|
+
autoload :Setdiff, "mml/v4/sets"
|
|
135
|
+
autoload :Card, "mml/v4/sets"
|
|
136
|
+
autoload :Cartesianproduct, "mml/v4/sets"
|
|
137
|
+
autoload :Diff, "mml/v4/calculus"
|
|
138
|
+
autoload :Partialdiff, "mml/v4/calculus"
|
|
139
|
+
autoload :Factorof, "mml/v4/factorof"
|
|
140
|
+
autoload :Int, "mml/v4/calculus"
|
|
141
|
+
autoload :Limit, "mml/v4/limit"
|
|
142
|
+
autoload :Lowlimit, "mml/v4/calculus"
|
|
143
|
+
autoload :Tendsto, "mml/v4/tendsto"
|
|
144
|
+
autoload :Uplimit, "mml/v4/calculus"
|
|
145
|
+
autoload :Divergence, "mml/v4/vector_calculus"
|
|
146
|
+
autoload :Grad, "mml/v4/vector_calculus"
|
|
147
|
+
autoload :Curl, "mml/v4/vector_calculus"
|
|
148
|
+
autoload :Laplacian, "mml/v4/vector_calculus"
|
|
149
|
+
autoload :Compose, "mml/v4/functions"
|
|
150
|
+
autoload :Domain, "mml/v4/functions"
|
|
151
|
+
autoload :Codomain, "mml/v4/functions"
|
|
152
|
+
autoload :Image, "mml/v4/functions"
|
|
153
|
+
autoload :Ident, "mml/v4/functions"
|
|
154
|
+
autoload :Sin, "mml/v4/elementary_functions"
|
|
155
|
+
autoload :Cos, "mml/v4/elementary_functions"
|
|
156
|
+
autoload :Tan, "mml/v4/elementary_functions"
|
|
157
|
+
autoload :Sec, "mml/v4/elementary_functions"
|
|
158
|
+
autoload :Csc, "mml/v4/elementary_functions"
|
|
159
|
+
autoload :Cot, "mml/v4/elementary_functions"
|
|
160
|
+
autoload :Sinh, "mml/v4/elementary_functions"
|
|
161
|
+
autoload :Cosh, "mml/v4/elementary_functions"
|
|
162
|
+
autoload :Tanh, "mml/v4/elementary_functions"
|
|
163
|
+
autoload :Sech, "mml/v4/elementary_functions"
|
|
164
|
+
autoload :Csch, "mml/v4/elementary_functions"
|
|
165
|
+
autoload :Coth, "mml/v4/elementary_functions"
|
|
166
|
+
autoload :Arcsin, "mml/v4/elementary_functions"
|
|
167
|
+
autoload :Arccos, "mml/v4/elementary_functions"
|
|
168
|
+
autoload :Arctan, "mml/v4/elementary_functions"
|
|
169
|
+
autoload :Arcsec, "mml/v4/elementary_functions"
|
|
170
|
+
autoload :Arccsc, "mml/v4/elementary_functions"
|
|
171
|
+
autoload :Arccot, "mml/v4/elementary_functions"
|
|
172
|
+
autoload :Arcsinh, "mml/v4/elementary_functions"
|
|
173
|
+
autoload :Arccosh, "mml/v4/elementary_functions"
|
|
174
|
+
autoload :Arctanh, "mml/v4/elementary_functions"
|
|
175
|
+
autoload :Arcsech, "mml/v4/elementary_functions"
|
|
176
|
+
autoload :Arccsch, "mml/v4/elementary_functions"
|
|
177
|
+
autoload :Arccoth, "mml/v4/elementary_functions"
|
|
178
|
+
autoload :Exp, "mml/v4/elementary_functions"
|
|
179
|
+
autoload :Ln, "mml/v4/elementary_functions"
|
|
180
|
+
autoload :Log, "mml/v4/elementary_functions"
|
|
181
|
+
autoload :Integers, "mml/v4/constants"
|
|
182
|
+
autoload :Reals, "mml/v4/constants"
|
|
183
|
+
autoload :Rationals, "mml/v4/constants"
|
|
184
|
+
autoload :Naturalnumbers, "mml/v4/constants"
|
|
185
|
+
autoload :Complexes, "mml/v4/constants"
|
|
186
|
+
autoload :Primes, "mml/v4/constants"
|
|
187
|
+
autoload :Exponentiale, "mml/v4/constants"
|
|
188
|
+
autoload :Imaginaryi, "mml/v4/constants"
|
|
189
|
+
autoload :Notanumber, "mml/v4/constants"
|
|
190
|
+
autoload :True, "mml/v4/constants"
|
|
191
|
+
autoload :False, "mml/v4/constants"
|
|
192
|
+
autoload :Emptyset, "mml/v4/constants"
|
|
193
|
+
autoload :Pi, "mml/v4/constants"
|
|
194
|
+
autoload :Eulergamma, "mml/v4/constants"
|
|
195
|
+
autoload :Infinity, "mml/v4/constants"
|
|
196
|
+
autoload :Vector, "mml/v4/linear_algebra"
|
|
197
|
+
autoload :Matrix, "mml/v4/linear_algebra"
|
|
198
|
+
autoload :Matrixrow, "mml/v4/linear_algebra"
|
|
199
|
+
autoload :Determinant, "mml/v4/linear_algebra"
|
|
200
|
+
autoload :Transpose, "mml/v4/linear_algebra"
|
|
201
|
+
autoload :Selector, "mml/v4/linear_algebra"
|
|
202
|
+
autoload :Vectorproduct, "mml/v4/linear_algebra"
|
|
203
|
+
autoload :Scalarproduct, "mml/v4/linear_algebra"
|
|
204
|
+
autoload :Outerproduct, "mml/v4/linear_algebra"
|
|
205
|
+
autoload :Mean, "mml/v4/statistics"
|
|
206
|
+
autoload :Sdev, "mml/v4/statistics"
|
|
207
|
+
autoload :Variance, "mml/v4/statistics"
|
|
208
|
+
autoload :Median, "mml/v4/statistics"
|
|
209
|
+
autoload :Mode, "mml/v4/statistics"
|
|
210
|
+
autoload :Moment, "mml/v4/statistics"
|
|
211
|
+
autoload :Momentabout, "mml/v4/statistics"
|
|
212
|
+
|
|
213
|
+
# Presentation element registrations
|
|
214
|
+
Configuration.register_model(A, id: :a)
|
|
215
|
+
Configuration.register_model(Maction, id: :maction)
|
|
216
|
+
Configuration.register_model(Maligngroup, id: :maligngroup)
|
|
217
|
+
Configuration.register_model(Malignmark, id: :malignmark)
|
|
218
|
+
Configuration.register_model(Menclose, id: :menclose)
|
|
219
|
+
Configuration.register_model(Merror, id: :merror)
|
|
220
|
+
Configuration.register_model(Mfenced, id: :mfenced)
|
|
221
|
+
Configuration.register_model(Mfrac, id: :mfrac)
|
|
222
|
+
Configuration.register_model(Mfraction, id: :mfraction)
|
|
223
|
+
Configuration.register_model(Mglyph, id: :mglyph)
|
|
224
|
+
Configuration.register_model(Mi, id: :mi)
|
|
225
|
+
Configuration.register_model(Mlongdiv, id: :mlongdiv)
|
|
226
|
+
Configuration.register_model(Mn, id: :mn)
|
|
227
|
+
Configuration.register_model(Mo, id: :mo)
|
|
228
|
+
Configuration.register_model(Mover, id: :mover)
|
|
229
|
+
Configuration.register_model(Mpadded, id: :mpadded)
|
|
230
|
+
Configuration.register_model(Mphantom, id: :mphantom)
|
|
231
|
+
Configuration.register_model(Mprescripts, id: :mprescripts)
|
|
232
|
+
Configuration.register_model(Mroot, id: :mroot)
|
|
233
|
+
Configuration.register_model(Mrow, id: :mrow)
|
|
234
|
+
Configuration.register_model(Ms, id: :ms)
|
|
235
|
+
Configuration.register_model(Mscarries, id: :mscarries)
|
|
236
|
+
Configuration.register_model(Mscarry, id: :mscarry)
|
|
237
|
+
Configuration.register_model(Msgroup, id: :msgroup)
|
|
238
|
+
Configuration.register_model(Msline, id: :msline)
|
|
239
|
+
Configuration.register_model(Mspace, id: :mspace)
|
|
240
|
+
Configuration.register_model(Msqrt, id: :msqrt)
|
|
241
|
+
Configuration.register_model(Msrow, id: :msrow)
|
|
242
|
+
Configuration.register_model(Mstack, id: :mstack)
|
|
243
|
+
Configuration.register_model(Mstyle, id: :mstyle)
|
|
244
|
+
Configuration.register_model(Msub, id: :msub)
|
|
245
|
+
Configuration.register_model(Msubsup, id: :msubsup)
|
|
246
|
+
Configuration.register_model(Msup, id: :msup)
|
|
247
|
+
Configuration.register_model(Mtd, id: :mtd)
|
|
248
|
+
Configuration.register_model(Mtable, id: :mtable)
|
|
249
|
+
Configuration.register_model(Mtext, id: :mtext)
|
|
250
|
+
Configuration.register_model(Mtr, id: :mtr)
|
|
251
|
+
Configuration.register_model(Mlabeledtr, id: :mlabeledtr)
|
|
252
|
+
Configuration.register_model(Munder, id: :munder)
|
|
253
|
+
Configuration.register_model(Munderover, id: :munderover)
|
|
254
|
+
Configuration.register_model(Mmultiscripts, id: :mmultiscripts)
|
|
255
|
+
Configuration.register_model(None, id: :none)
|
|
256
|
+
Configuration.register_model(Semantics, id: :semantics)
|
|
257
|
+
Configuration.register_model(Math, id: :math)
|
|
258
|
+
|
|
259
|
+
# Content element registrations
|
|
260
|
+
Configuration.register_model(Annotation, id: :annotation)
|
|
261
|
+
Configuration.register_model(AnnotationXml, id: :"annotation-xml")
|
|
262
|
+
Configuration.register_model(Apply, id: :apply)
|
|
263
|
+
Configuration.register_model(Cbytes, id: :cbytes)
|
|
264
|
+
Configuration.register_model(Cerror, id: :cerror)
|
|
265
|
+
Configuration.register_model(Ci, id: :ci)
|
|
266
|
+
Configuration.register_model(Cn, id: :cn)
|
|
267
|
+
Configuration.register_model(Cs, id: :cs)
|
|
268
|
+
Configuration.register_model(Csymbol, id: :csymbol)
|
|
269
|
+
|
|
270
|
+
# Constructs (bvar, condition, interval, lambda, inverse, degree, piecewise, piece, otherwise, sep, bind)
|
|
271
|
+
Configuration.register_model(Bvar, id: :bvar)
|
|
272
|
+
Configuration.register_model(Condition, id: :condition)
|
|
273
|
+
Configuration.register_model(Interval, id: :interval)
|
|
274
|
+
Configuration.register_model(Lambda, id: :lambda)
|
|
275
|
+
Configuration.register_model(Inverse, id: :inverse)
|
|
276
|
+
Configuration.register_model(Degree, id: :degree)
|
|
277
|
+
Configuration.register_model(Piecewise, id: :piecewise)
|
|
278
|
+
Configuration.register_model(Piece, id: :piece)
|
|
279
|
+
Configuration.register_model(Otherwise, id: :otherwise)
|
|
280
|
+
Configuration.register_model(Sep, id: :sep)
|
|
281
|
+
Configuration.register_model(Bind, id: :bind)
|
|
282
|
+
|
|
283
|
+
# V2 compatibility (fn, reln, declare, share)
|
|
284
|
+
Configuration.register_model(Fn, id: :fn)
|
|
285
|
+
Configuration.register_model(Reln, id: :reln)
|
|
286
|
+
Configuration.register_model(Declare, id: :declare)
|
|
287
|
+
Configuration.register_model(Share, id: :share)
|
|
288
|
+
|
|
289
|
+
# Arith (22 classes)
|
|
290
|
+
Configuration.register_model(Abs, id: :abs)
|
|
291
|
+
Configuration.register_model(Conjugate, id: :conjugate)
|
|
292
|
+
Configuration.register_model(Arg, id: :arg)
|
|
293
|
+
Configuration.register_model(Real, id: :real)
|
|
294
|
+
Configuration.register_model(Imaginary, id: :imaginary)
|
|
295
|
+
Configuration.register_model(Floor, id: :floor)
|
|
296
|
+
Configuration.register_model(Ceiling, id: :ceiling)
|
|
297
|
+
Configuration.register_model(Quotient, id: :quotient)
|
|
298
|
+
Configuration.register_model(Divide, id: :divide)
|
|
299
|
+
Configuration.register_model(Rem, id: :rem)
|
|
300
|
+
Configuration.register_model(Minus, id: :minus)
|
|
301
|
+
Configuration.register_model(Plus, id: :plus)
|
|
302
|
+
Configuration.register_model(Times, id: :times)
|
|
303
|
+
Configuration.register_model(Power, id: :power)
|
|
304
|
+
Configuration.register_model(Root, id: :root)
|
|
305
|
+
Configuration.register_model(Max, id: :max)
|
|
306
|
+
Configuration.register_model(Min, id: :min)
|
|
307
|
+
Configuration.register_model(Gcd, id: :gcd)
|
|
308
|
+
Configuration.register_model(Lcm, id: :lcm)
|
|
309
|
+
Configuration.register_model(Sum, id: :sum)
|
|
310
|
+
Configuration.register_model(Product, id: :product)
|
|
311
|
+
Configuration.register_model(Factorial, id: :factorial)
|
|
312
|
+
|
|
313
|
+
# Logic (7)
|
|
314
|
+
Configuration.register_model(And, id: :and)
|
|
315
|
+
Configuration.register_model(Or, id: :or)
|
|
316
|
+
Configuration.register_model(Xor, id: :xor)
|
|
317
|
+
Configuration.register_model(Not, id: :not)
|
|
318
|
+
Configuration.register_model(Implies, id: :implies)
|
|
319
|
+
Configuration.register_model(Forall, id: :forall)
|
|
320
|
+
Configuration.register_model(Exists, id: :exists)
|
|
321
|
+
|
|
322
|
+
# Relations (8 - no Factorof)
|
|
323
|
+
Configuration.register_model(Eq, id: :eq)
|
|
324
|
+
Configuration.register_model(Neq, id: :neq)
|
|
325
|
+
Configuration.register_model(Lt, id: :lt)
|
|
326
|
+
Configuration.register_model(Gt, id: :gt)
|
|
327
|
+
Configuration.register_model(Leq, id: :leq)
|
|
328
|
+
Configuration.register_model(Geq, id: :geq)
|
|
329
|
+
Configuration.register_model(Equivalent, id: :equivalent)
|
|
330
|
+
Configuration.register_model(Approx, id: :approx)
|
|
331
|
+
Configuration.register_model(Factorof, id: :factorof)
|
|
332
|
+
|
|
333
|
+
# Sets (13 - uses List not Mlist)
|
|
334
|
+
Configuration.register_model(Set, id: :set)
|
|
335
|
+
Configuration.register_model(List, id: :list)
|
|
336
|
+
Configuration.register_model(Union, id: :union)
|
|
337
|
+
Configuration.register_model(Intersect, id: :intersect)
|
|
338
|
+
Configuration.register_model(In, id: :in)
|
|
339
|
+
Configuration.register_model(Notin, id: :notin)
|
|
340
|
+
Configuration.register_model(Notsubset, id: :notsubset)
|
|
341
|
+
Configuration.register_model(Notprsubset, id: :notprsubset)
|
|
342
|
+
Configuration.register_model(Subset, id: :subset)
|
|
343
|
+
Configuration.register_model(Prsubset, id: :prsubset)
|
|
344
|
+
Configuration.register_model(Setdiff, id: :setdiff)
|
|
345
|
+
Configuration.register_model(Card, id: :card)
|
|
346
|
+
Configuration.register_model(Cartesianproduct, id: :cartesianproduct)
|
|
347
|
+
|
|
348
|
+
# Calculus (5 - no Limit, Tendsto)
|
|
349
|
+
Configuration.register_model(Diff, id: :diff)
|
|
350
|
+
Configuration.register_model(Partialdiff, id: :partialdiff)
|
|
351
|
+
Configuration.register_model(Int, id: :int)
|
|
352
|
+
Configuration.register_model(Limit, id: :limit)
|
|
353
|
+
Configuration.register_model(Lowlimit, id: :lowlimit)
|
|
354
|
+
Configuration.register_model(Tendsto, id: :tendsto)
|
|
355
|
+
Configuration.register_model(Uplimit, id: :uplimit)
|
|
356
|
+
|
|
357
|
+
# Vector Calculus (4)
|
|
358
|
+
Configuration.register_model(Divergence, id: :divergence)
|
|
359
|
+
Configuration.register_model(Grad, id: :grad)
|
|
360
|
+
Configuration.register_model(Curl, id: :curl)
|
|
361
|
+
Configuration.register_model(Laplacian, id: :laplacian)
|
|
362
|
+
|
|
363
|
+
# Functions (5 - no Domainofapplication)
|
|
364
|
+
Configuration.register_model(Compose, id: :compose)
|
|
365
|
+
Configuration.register_model(Domain, id: :domain)
|
|
366
|
+
Configuration.register_model(Codomain, id: :codomain)
|
|
367
|
+
Configuration.register_model(Image, id: :image)
|
|
368
|
+
Configuration.register_model(Ident, id: :ident)
|
|
369
|
+
|
|
370
|
+
# Elementary Functions (27 - no Logbase)
|
|
371
|
+
Configuration.register_model(Sin, id: :sin)
|
|
372
|
+
Configuration.register_model(Cos, id: :cos)
|
|
373
|
+
Configuration.register_model(Tan, id: :tan)
|
|
374
|
+
Configuration.register_model(Sec, id: :sec)
|
|
375
|
+
Configuration.register_model(Csc, id: :csc)
|
|
376
|
+
Configuration.register_model(Cot, id: :cot)
|
|
377
|
+
Configuration.register_model(Sinh, id: :sinh)
|
|
378
|
+
Configuration.register_model(Cosh, id: :cosh)
|
|
379
|
+
Configuration.register_model(Tanh, id: :tanh)
|
|
380
|
+
Configuration.register_model(Sech, id: :sech)
|
|
381
|
+
Configuration.register_model(Csch, id: :csch)
|
|
382
|
+
Configuration.register_model(Coth, id: :coth)
|
|
383
|
+
Configuration.register_model(Arcsin, id: :arcsin)
|
|
384
|
+
Configuration.register_model(Arccos, id: :arccos)
|
|
385
|
+
Configuration.register_model(Arctan, id: :arctan)
|
|
386
|
+
Configuration.register_model(Arcsec, id: :arcsec)
|
|
387
|
+
Configuration.register_model(Arccsc, id: :arccsc)
|
|
388
|
+
Configuration.register_model(Arccot, id: :arccot)
|
|
389
|
+
Configuration.register_model(Arcsinh, id: :arcsinh)
|
|
390
|
+
Configuration.register_model(Arccosh, id: :arccosh)
|
|
391
|
+
Configuration.register_model(Arctanh, id: :arctanh)
|
|
392
|
+
Configuration.register_model(Arcsech, id: :arcsech)
|
|
393
|
+
Configuration.register_model(Arccsch, id: :arccsch)
|
|
394
|
+
Configuration.register_model(Arccoth, id: :arccoth)
|
|
395
|
+
Configuration.register_model(Exp, id: :exp)
|
|
396
|
+
Configuration.register_model(Ln, id: :ln)
|
|
397
|
+
Configuration.register_model(Log, id: :log)
|
|
398
|
+
|
|
399
|
+
# Constants (15 - uses True/False not Mtrue/Mfalse)
|
|
400
|
+
Configuration.register_model(Integers, id: :integers)
|
|
401
|
+
Configuration.register_model(Reals, id: :reals)
|
|
402
|
+
Configuration.register_model(Rationals, id: :rationals)
|
|
403
|
+
Configuration.register_model(Naturalnumbers, id: :naturalnumbers)
|
|
404
|
+
Configuration.register_model(Complexes, id: :complexes)
|
|
405
|
+
Configuration.register_model(Primes, id: :primes)
|
|
406
|
+
Configuration.register_model(Exponentiale, id: :exponentiale)
|
|
407
|
+
Configuration.register_model(Imaginaryi, id: :imaginaryi)
|
|
408
|
+
Configuration.register_model(Notanumber, id: :notanumber)
|
|
409
|
+
Configuration.register_model(True, id: :true) # rubocop:disable Lint/BooleanSymbol
|
|
410
|
+
Configuration.register_model(False, id: :false) # rubocop:disable Lint/BooleanSymbol
|
|
411
|
+
Configuration.register_model(Emptyset, id: :emptyset)
|
|
412
|
+
Configuration.register_model(Pi, id: :pi)
|
|
413
|
+
Configuration.register_model(Eulergamma, id: :eulergamma)
|
|
414
|
+
Configuration.register_model(Infinity, id: :infinity)
|
|
415
|
+
|
|
416
|
+
# Linear Algebra (9)
|
|
417
|
+
Configuration.register_model(Vector, id: :vector)
|
|
418
|
+
Configuration.register_model(Matrix, id: :matrix)
|
|
419
|
+
Configuration.register_model(Matrixrow, id: :matrixrow)
|
|
420
|
+
Configuration.register_model(Determinant, id: :determinant)
|
|
421
|
+
Configuration.register_model(Transpose, id: :transpose)
|
|
422
|
+
Configuration.register_model(Selector, id: :selector)
|
|
423
|
+
Configuration.register_model(Vectorproduct, id: :vectorproduct)
|
|
424
|
+
Configuration.register_model(Scalarproduct, id: :scalarproduct)
|
|
425
|
+
Configuration.register_model(Outerproduct, id: :outerproduct)
|
|
426
|
+
|
|
427
|
+
# Statistics (7)
|
|
428
|
+
Configuration.register_model(Mean, id: :mean)
|
|
429
|
+
Configuration.register_model(Sdev, id: :sdev)
|
|
430
|
+
Configuration.register_model(Variance, id: :variance)
|
|
431
|
+
Configuration.register_model(Median, id: :median)
|
|
432
|
+
Configuration.register_model(Mode, id: :mode)
|
|
433
|
+
Configuration.register_model(Moment, id: :moment)
|
|
434
|
+
Configuration.register_model(Momentabout, id: :momentabout)
|
|
78
435
|
end
|
|
79
436
|
end
|
|
80
|
-
|
|
81
|
-
Mml::V4.update_attributes
|
data/lib/mml/version.rb
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mml
|
|
4
|
+
module VersionedParser
|
|
5
|
+
# Shared parse entrypoint for versioned modules.
|
|
6
|
+
def parse(input, namespace_exist: true,
|
|
7
|
+
context: Mml::UNSPECIFIED_CONTEXT, register: nil)
|
|
8
|
+
self::Configuration.adapter ||= Mml::DEFAULT_ADAPTER
|
|
9
|
+
context_id = parse_context_id(context, register)
|
|
10
|
+
root_class = Lutaml::Model::GlobalContext.resolve_type(
|
|
11
|
+
:math,
|
|
12
|
+
context_id,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
root_class.from_xml(
|
|
16
|
+
xml_input(input, namespace_exist),
|
|
17
|
+
register: context_id,
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Namespace-less MathML is normalized before handing it to lutaml-model.
|
|
22
|
+
def parse_with_no_namespace(input)
|
|
23
|
+
adapter = self::Configuration.adapter || Mml::DEFAULT_ADAPTER
|
|
24
|
+
Moxml.new(adapter).parse(input).tap do |doc|
|
|
25
|
+
doc.root.add_namespace(nil, self::Namespace.uri)
|
|
26
|
+
end.to_xml
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Version modules keep their own default context id.
|
|
30
|
+
def parse_context_id(context, register)
|
|
31
|
+
Mml::ContextOptions.normalize_context_option(
|
|
32
|
+
context: context,
|
|
33
|
+
register: register,
|
|
34
|
+
default_context: self::Configuration.default_context_id,
|
|
35
|
+
warning_source: "#{name}.parse",
|
|
36
|
+
)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Keep the main parse flow readable by separating namespace normalization.
|
|
40
|
+
def xml_input(input, namespace_exist)
|
|
41
|
+
return input if namespace_exist
|
|
42
|
+
|
|
43
|
+
parse_with_no_namespace(input)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
data/lib/mml.rb
CHANGED
|
@@ -1,18 +1,48 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
3
5
|
module Mml
|
|
4
6
|
class Error < StandardError; end
|
|
5
7
|
|
|
8
|
+
DEFAULT_ADAPTER = RUBY_ENGINE == "opal" ? :oga : :ox
|
|
9
|
+
SUPPORTED_VERSIONS = [2, 3, 4].freeze
|
|
10
|
+
UNSPECIFIED_CONTEXT = Object.new.freeze
|
|
11
|
+
|
|
12
|
+
autoload :Namespace, "mml/namespace"
|
|
13
|
+
autoload :CommonElements, "mml/common_elements"
|
|
14
|
+
autoload :ContextOptions, "mml/context_options"
|
|
15
|
+
autoload :Base, "mml/base"
|
|
16
|
+
autoload :V2, "mml/v2"
|
|
6
17
|
autoload :V3, "mml/v3"
|
|
7
18
|
autoload :V4, "mml/v4"
|
|
8
19
|
|
|
9
20
|
module_function
|
|
10
21
|
|
|
11
|
-
def parse(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
def parse(
|
|
23
|
+
input,
|
|
24
|
+
namespace_exist: true,
|
|
25
|
+
version: 3,
|
|
26
|
+
context: UNSPECIFIED_CONTEXT,
|
|
27
|
+
register: nil
|
|
28
|
+
)
|
|
29
|
+
parser_for(version).parse(
|
|
30
|
+
input,
|
|
31
|
+
namespace_exist: namespace_exist,
|
|
32
|
+
context: Mml::ContextOptions.normalize_context_option(
|
|
33
|
+
context: context,
|
|
34
|
+
register: register,
|
|
35
|
+
default_context: nil,
|
|
36
|
+
warning_source: "Mml.parse",
|
|
37
|
+
),
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def parser_for(version)
|
|
42
|
+
return Mml::V2 if version == 2
|
|
43
|
+
return Mml::V3 if version == 3
|
|
44
|
+
return Mml::V4 if version == 4
|
|
45
|
+
|
|
46
|
+
raise Error, "Unsupported MathML version: #{version}"
|
|
17
47
|
end
|
|
18
48
|
end
|