domma-cms 0.14.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -647,12 +647,14 @@ async function processCollectionBlocks(markdown) {
|
|
|
647
647
|
*/
|
|
648
648
|
export function parseShortcodeAttrs(attrStr) {
|
|
649
649
|
const attrs = {};
|
|
650
|
-
// Pass 1: quoted key="value" or key='value' pairs
|
|
651
|
-
|
|
652
|
-
|
|
650
|
+
// Pass 1: quoted key="value" or key='value' pairs — proper disjunction so
|
|
651
|
+
// a double-quoted value can contain apostrophes (and vice versa) without
|
|
652
|
+
// the opposite quote terminating the match.
|
|
653
|
+
for (const [, key, dq, sq] of attrStr.matchAll(/([\w-]+)=(?:"([^"]*)"|'([^']*)')/g)) {
|
|
654
|
+
attrs[key] = dq ?? sq ?? '';
|
|
653
655
|
}
|
|
654
656
|
// Pass 2: standalone flag attributes (no value) — blank out key=value matches first
|
|
655
|
-
const stripped = attrStr.replace(/([\w-]+)=["'
|
|
657
|
+
const stripped = attrStr.replace(/([\w-]+)=(?:"[^"]*"|'[^']*')/g, m => ' '.repeat(m.length));
|
|
656
658
|
for (const [, key] of stripped.matchAll(/\b([\w-]+)\b/g)) {
|
|
657
659
|
if (!(key in attrs)) attrs[key] = true;
|
|
658
660
|
}
|