(str, renameMap = argumentKeyRenameMap)
| 2232 | } |
| 2233 | |
| 2234 | function parseSurgeTemplateArgumentPairs(str, renameMap = argumentKeyRenameMap) { |
| 2235 | str = stripWrapQuote(str) |
| 2236 | if (!/(\{\{\{[^{}]+\}\}\}|\{[^{}]+\})/.test(str) || !/&/.test(str) && !/^\s*[^=\s]+\s*=/.test(str)) return [] |
| 2237 | const items = splitTopLevel(str, '&') |
| 2238 | const pairs = [] |
| 2239 | for (let i = 0; i < items.length; i++) { |
| 2240 | const matched = items[i].match(/^\s*([^=\s]+)\s*=\s*["']?(?:\{\{\{([^{}]+)\}\}\}|\{([^{}]+)\})["']?\s*$/) |
| 2241 | if (!matched) return [] |
| 2242 | const scriptKey = matched[1].trim() |
| 2243 | const templateKey = (matched[2] || matched[3] || '').trim() |
| 2244 | if (scriptKey && templateKey) renameMap.set(templateKey, scriptKey) |
| 2245 | pairs.push({ scriptKey, templateKey }) |
| 2246 | } |
| 2247 | return pairs |
| 2248 | } |
| 2249 | |
| 2250 | function getSurgeTemplateArgumentListKeys(str) { |
| 2251 | return parseSurgeTemplateArgumentPairs(str).map(item => item.scriptKey) |
no test coverage detected