// Copyright (c) 2009-2022 The MathJax Consortium // SPDX-License-Identifier: Apache-2.0 // Based on BaseMethods.LeftRight and BaseItems.LeftItem (MathJax 3.2.2).
package tex import // A delimiter closes every intervening row continuation. Keep its kind and // captured color until the owning LeftItem receives it, including across an // OverItem denominator or a SetFont continuation. type rowDelimiterItem struct { middle bool delimiter, color string } func ( *parser) ( string) ([]*mml.Node, error) { , := .readDelimiter(, false) if != nil { return nil, } := .rowDelimiter defer func() { .rowDelimiter = }() var []*mml.Node for { .rowDelimiter = nil , _, = .parseRowWithPrefix(0, true, ) if != nil { return nil, } if .environmentPopped { .environmentPopped = false return , nil } := .rowDelimiter if !.middle { := .leftRightFenced(, row(, true), .delimiter, true) if .color != "" { .Children[len(.Children)-1].Attributes.Set("mathcolor", .color) } return []*mml.Node{}, nil } // Middle closes styles and restores the environment at Left entry. // Its empty CLOSE/OPEN atoms retain the original TeX spacing, while // the middle mo has no explicit texClass (the dictionary decides it). := .token("mo", .delimiter) .Attributes.Set("stretchy", true) if .color != "" { .Attributes.Set("mathcolor", .color) } = append(, texAtom(forcedRow(nil, true), mml.TeXClassClose), , texAtom(forcedRow(nil, true), mml.TeXClassOpen), ) } }