// Copyright (c) 2009-2022 The MathJax Consortium// SPDX-License-Identifier: Apache-2.0// Sources: ts/input/tex/{FilterUtil,ParseOptions,ParseUtil}.ts and// ts/core/MmlTree/MmlNode.ts and ts/core/Tree/Node.ts.package teximport ()// The inherited-attribute pass already handles cleanStretchy's stretchy// attribute and removes its temporary flag. Retain the registered candidates// first so its ORD wrapper can be added at the source postfilter boundary,// after moveLimits. ParseUtil.copyNode preserves and re-registers in-lists.func stretchyCleanupOperators( []*mml.Node) []*mml.Node {var []*mml.Node := make(map[*mml.Node]bool)for , := range { , := .Property("fixStretchy") , := .Property("in-lists")if ![] && propertyBool() && strings.Contains(","+propertyString()+",", ",fixStretchy,") { = append(, )// The source removes fixStretchy after the first registered event. [] = true } }return}func cleanStretchy( *mml.Node, []*mml.Node) {for , := range {// ParseOptions.getList discards detached construction events. := falsefor := ; != nil; = .Parent {if == { = truebreak } }if ! {continue } , := lookupOperatorDefinition(textContent(), operatorForms())if {for , := range .Properties {if .Name == "stretchy" && propertyBool(.Value) { .Attributes.Set("stretchy", false) } } }if .TeXClass != mml.TeXClassOrd || && .TexClass != int(mml.TeXClassOrd) {continue } := .Parent := node("TeXAtom", ) _ = .ReplaceChild(, )// AbstractNode.replaceChild clears the old child's parent even after // nodeFactory has inserted that child into the new TeXAtom. Preserve // that postfilter-specific state: inheritance and later core-parent // queries see a parentless operator. The general Go replacement API // deliberately retains ownership when a caller has already moved it. .Parent = nil// AbstractMmlNode.inheritAttributesFrom copies only the current size, // display/script level and prime style, then inherits through the new // wrapper. Font/color attributes remain on the original token. := ordered.New[inheritedAttribute]()if .Attributes.IsSet("mathsize") { , := .Attributes.Get("mathsize") .Set("mathsize", inheritedAttribute{source: "math", value: }) } , := .Attributes.Get("displaystyle") , := propertyIntValue(.Attributes, "scriptlevel") , := .Property("texprimestyle")setInheritedAttributes(, , propertyBool(), , propertyBool())for := ; != nil; = .Parent {refreshDynamicFlags() } }}
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.