* Parse adjustment values from `a:avLst > a:gd` elements. * Each guide has a `name` attribute and a `fmla` attribute like "val 50000".
(avLst: SafeXmlNode)
| 146 | * Each guide has a `name` attribute and a `fmla` attribute like "val 50000". |
| 147 | */ |
| 148 | function parseAdjustments(avLst: SafeXmlNode): Map<string, number> { |
| 149 | const adjustments = new Map<string, number>() |
| 150 | for (const gd of avLst.children('gd')) { |
| 151 | const name = gd.attr('name') |
| 152 | const fmla = gd.attr('fmla') ?? '' |
| 153 | if (!name) continue |
| 154 | |
| 155 | // fmla is typically "val NNNNN" — extract the numeric part |
| 156 | const match = fmla.match(/val\s+(-?\d+)/) |
| 157 | if (match) { |
| 158 | adjustments.set(name, Number(match[1])) |
| 159 | } else { |
| 160 | // Try direct numeric value |
| 161 | const num = Number(fmla) |
| 162 | if (!Number.isNaN(num)) { |
| 163 | adjustments.set(name, num) |
| 164 | } |
| 165 | } |
| 166 | } |
| 167 | return adjustments |
| 168 | } |
| 169 | |
| 170 | /** |
| 171 | * Parse a shape XML node (`p:sp` or `p:cxnSp`) into ShapeNodeData. |
no test coverage detected