(root: SafeXmlNode)
| 39 | * Parse a slide master XML root (`p:sldMaster`) into MasterData. |
| 40 | */ |
| 41 | export function parseMaster(root: SafeXmlNode): MasterData { |
| 42 | const cSld = root.child('cSld') |
| 43 | |
| 44 | // --- Background --- |
| 45 | const bg = cSld.child('bg') |
| 46 | const background = bg.exists() ? bg : undefined |
| 47 | |
| 48 | // --- Shape tree --- |
| 49 | const spTree = cSld.child('spTree') |
| 50 | |
| 51 | // --- Color map --- |
| 52 | const clrMap = root.child('clrMap') |
| 53 | const colorMap = parseAllAttributes(clrMap) |
| 54 | |
| 55 | // --- Text styles --- |
| 56 | const txStyles = root.child('txStyles') |
| 57 | const titleStyle = txStyles.child('titleStyle') |
| 58 | const bodyStyle = txStyles.child('bodyStyle') |
| 59 | const otherStyle = txStyles.child('otherStyle') |
| 60 | |
| 61 | // --- Default text style --- |
| 62 | const defaultTextStyle = root.child('defaultTextStyle') |
| 63 | |
| 64 | // --- Placeholders --- |
| 65 | const placeholders = extractPlaceholders(spTree) |
| 66 | |
| 67 | return { |
| 68 | colorMap, |
| 69 | background, |
| 70 | textStyles: { |
| 71 | titleStyle: titleStyle.exists() ? titleStyle : undefined, |
| 72 | bodyStyle: bodyStyle.exists() ? bodyStyle : undefined, |
| 73 | otherStyle: otherStyle.exists() ? otherStyle : undefined, |
| 74 | }, |
| 75 | defaultTextStyle: defaultTextStyle.exists() ? defaultTextStyle : undefined, |
| 76 | placeholders, |
| 77 | spTree, |
| 78 | rels: new Map(), // populated later by buildPresentation |
| 79 | } |
| 80 | } |
no test coverage detected