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

Function parseLayout

apps/sim/lib/pptx-renderer/model/layout.ts:151–186  ·  view source on GitHub ↗
(root: SafeXmlNode)

Source from the content-addressed store, hash-verified

149 * Parse a slide layout XML root (`p:sldLayout`) into LayoutData.
150 */
151export function parseLayout(root: SafeXmlNode): LayoutData {
152 const cSld = root.child('cSld')
153
154 // --- Background ---
155 const bg = cSld.child('bg')
156 const background = bg.exists() ? bg : undefined
157
158 // --- Shape tree ---
159 const spTree = cSld.child('spTree')
160
161 // --- Color map override ---
162 let colorMapOverride: Map<string, string> | undefined
163 const clrMapOvr = root.child('clrMapOvr')
164 if (clrMapOvr.exists()) {
165 const overrideMapping = clrMapOvr.child('overrideClrMapping')
166 if (overrideMapping.exists()) {
167 colorMapOverride = parseAllAttributes(overrideMapping)
168 }
169 }
170
171 // --- Placeholders (recursive so we find title/body inside grpSp; resolve position in slide space) ---
172 const placeholders = extractPlaceholdersRecursive(spTree, null)
173
174 // --- showMasterSp: if "0", master shapes should not be rendered for this layout ---
175 const showMasterSpAttr = root.attr('showMasterSp')
176 const showMasterSp = showMasterSpAttr !== '0'
177
178 return {
179 colorMapOverride,
180 background,
181 placeholders,
182 spTree,
183 rels: new Map(), // populated later by buildPresentation
184 showMasterSp,
185 }
186}

Callers 1

buildPresentationFunction · 0.90

Calls 5

parseAllAttributesFunction · 0.90
childMethod · 0.80
existsMethod · 0.80
attrMethod · 0.80

Tested by

no test coverage detected