MCPcopy Index your code
hub / github.com/simstudioai/sim / parseFontAttrs

Function parseFontAttrs

apps/sim/lib/copilot/vfs/document-style.ts:129–141  ·  view source on GitHub ↗
(
  fontAttrsXml: string,
  themeFonts?: { major: string; minor: string }
)

Source from the content-addressed store, hash-verified

127}
128
129function parseFontAttrs(
130 fontAttrsXml: string,
131 themeFonts?: { major: string; minor: string }
132): { font?: string; themeFont?: string } {
133 const asciiLit = /\bw:ascii="([^"]+)"/.exec(fontAttrsXml)
134 // LibreOffice DOCX files may put a semicolon-separated fallback list in w:ascii — take the first
135 if (asciiLit) return { font: asciiLit[1].split(';')[0].trim() || asciiLit[1] }
136 const themeRef = /\bw:asciiTheme="([^"]+)"/.exec(fontAttrsXml)
137 if (!themeRef) return {}
138 // Resolve immediately if theme fonts are available, otherwise defer
139 if (themeFonts) return { font: resolveThemeFont(themeRef[1], themeFonts) }
140 return { themeFont: themeRef[1] }
141}
142
143function parseDocxStyles(
144 xml: string,

Callers 1

parseDocxStylesFunction · 0.85

Calls 1

resolveThemeFontFunction · 0.70

Tested by

no test coverage detected