// Copyright 2018-2022 The MathJax Consortium
// SPDX-License-Identifier: Apache-2.0
// Source: ts/core/MmlTree/MmlNodes/mfenced.ts.

package mml

import (
	
	
)

// 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()
		}
		return strings.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{}
	}
	 := .Fenced
	if  := ("open", "(");  != "" {
		.Open = (, "prefix", TeXClassOpen)
	}
	if  := []rune(("separators", ",")); len() != 0 {
		 := 0
		for ,  := range .Children[min(1, len(.Children)):] {
			if  == nil {
				continue
			}
			 := [min(, len()-1)]
			.Separators = append(.Separators, (string(), "", TeXClassNone))
			++
		}
	}
	if  := ("close", ")");  != "" {
		.Close = (, "postfix", TeXClassClose)
	}
}