// Copyright 2017-2022 The MathJax Consortium// SPDX-License-Identifier: Apache-2.0// This file is a Go translation and modification of MathJax 3.2.2 behavior.// Source: ts/input/tex/ParseUtil.ts, readKeyval and keyvalOptions.package teximport// parseUtilKeyvalOptions collects the complete list before validating its own keys.// The original readKeyval uses an ordinary JavaScript object: primitive// assignments to __proto__ do not create an own property, and Object.keys// enumerates array-index properties before other keys.func parseUtilKeyvalOptions( string, func(string) bool, bool) (*ordered.Map[any], error) { := ordered.New[any]() := for != "" { , , , := empheqReadOptionValue(, "=,")if != nil {returnnil, } = varany = trueif == '=' {varstring , _, , = empheqReadOptionValue(, ",")if != nil {returnnil, }switch {case"true": = truecase"false": = falsedefault: = } } elseif == "" {continue }if != "__proto__" { .Set(, ) } }if != nil {for , := range .JavaScriptKeys() {if !() {if {returnnil, texError("InvalidOption", "Invalid option: %s", ) } .Delete() } } }return , nil}
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.