// 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.package svgimport ()// mathAlignShift is CommonWrapper.getAlignShift for the math wrapper only.// The output options currently expose MathJax's default center/zero alignment.// Keep existing table layout consumers independent of this late root policy.func ( *wrapper) () (string, float64) { := stringAttribute(.node, "indentalign", "auto") := stringAttribute(.node, "indentalignfirst", "indentalign")if != "indentalign" { = }if == "auto" { = "center" } := attribute(.node, "indentshift", "auto") := attribute(.node, "indentshiftfirst", "indentshift")if != "indentshift" { = }if == "auto" {// The fixed displayIndent "0" satisfies the primary zero-unit guard, // including right alignment. Explicit shifts are never sign-reversed. = "0" }// getAlignShift passes raw containerWidth, unlike getWrapWidth's em size. // The pinned conversion's default container is 80ex in CSS pixels.return , layout.Length2Em(, 80*.renderer.options.Ex, .bbox.Scale, .renderer.pxPerEm)}// handleMathMinWidth follows SVGmath.handleDisplay's responsive-width branch.func ( *wrapper) () {if .bbox.PWidth != layout.FullWidth || .renderer.table == nil {return } , := .mathAlignShift() := .renderer.table.outerBBox() , , := .L, .W, .Rswitch {case"right":if == 0 || math.IsNaN() { = - } = math.Max(, -)case"left":if == 0 || math.IsNaN() { = } = math.Max(, )case"center": += 2 * math.Abs() } .renderer.minWidth = math.Max(0, ++)}
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.