// Copyright 2018-2022 The MathJax Consortium// SPDX-License-Identifier: Apache-2.0// Source: ts/core/MmlTree/MmlNodes/mfenced.ts.package mmlimport ()// CreateFencedNodes ports MmlMfenced.addFakeNodes/fakeNode. Its caller must// apply the original incoming inheritance context to the returned operators,// rather than copying the resolved attributes of their mfenced parent.func ( *Factory) ( *Node) { := func(, string) string { := if , := .Attributes.Get(); { = fmt.Sprint() }returnstrings.Map(func( rune) rune {switch {case' ', '\t', '\n', '\r':return -1 }return }, ) } := func(, string, TeXClass) *Node { := .Create("mo", .Text())if != "" { .Attributes.Set("fence", true) .Attributes.Set("form", ) }// The source sets the field only. Operator inheritance may replace it; // a texClass property would incorrectly suppress that source behavior. .TeXClass = .Parent = return }if .Fenced == nil { .Fenced = &FencedNodes{} } := .Fencedif := ("open", "("); != "" { .Open = (, "prefix", TeXClassOpen) }if := []rune(("separators", ",")); len() != 0 { := 0for , := range .Children[min(1, len(.Children)):] {if == nil {continue } := [min(, len()-1)] .Separators = append(.Separators, (string(), "", TeXClassNone)) ++ } }if := ("close", ")"); != "" { .Close = (, "postfix", TeXClassClose) }}
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.