@tryghost/mg-shortcodes 0.1.2 → 0.2.0

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/lib/Shortcodes.js CHANGED
@@ -14,8 +14,8 @@ class Shortcodes {
14
14
  }});
15
15
  }
16
16
 
17
- unwrapFromQuotes(string) {
18
- const chars = ['’', '”', '“', '‘', '"'];
17
+ unwrapFromQuotes(string = '') {
18
+ const chars = ['’', '”', '“', '‘', '"', '"'];
19
19
  const quoteRegExp = new RegExp(`^(${chars.join('|')})|(${chars.join('|')})$`, 'gm');
20
20
  return string.replace(quoteRegExp, '');
21
21
  }
@@ -30,11 +30,11 @@ class Shortcodes {
30
30
  tagAttrMatches.forEach((item) => {
31
31
  let theKey;
32
32
  let theValue;
33
- if (item[1] && item[2]) {
33
+ if (item[1] && item[2] !== 'undefined') {
34
34
  // Quoted key="value" pairs
35
35
  theKey = item[1];
36
36
  theValue = this.typeCast(item[2]);
37
- } else if (item[5] && item[6]) {
37
+ } else if (item[5] && item[6] !== 'undefined') {
38
38
  // Unquoted key=value pairs
39
39
  theKey = item[5];
40
40
  theValue = this.typeCast(item[6]);
@@ -158,6 +158,7 @@ class Shortcodes {
158
158
  let knownShortcode = this.hasKnownShortcode(text);
159
159
 
160
160
  if (knownShortcode) {
161
+ // console.log({knownShortcode});
161
162
  const theCall = this.getCallback(knownShortcode.name);
162
163
  const attrs = this.parseAttributes(knownShortcode.match.groups.attrs);
163
164
  const content = knownShortcode.match.groups.content;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/mg-shortcodes",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-shortcodes",
5
5
  "author": "Ghost Foundation",
6
6
  "license": "MIT",
@@ -20,9 +20,9 @@
20
20
  "access": "public"
21
21
  },
22
22
  "devDependencies": {
23
- "eslint": "8.29.0",
24
- "jest": "29.3.1",
25
- "jest-extended": "3.2.0"
23
+ "eslint": "8.34.0",
24
+ "jest": "29.4.3",
25
+ "jest-extended": "3.2.3"
26
26
  },
27
- "gitHead": "93bb4878021ece28b5885db3fa695c2b23cbc599"
27
+ "gitHead": "c4270f6229caa350155a03a0646b3c0c21eaff5e"
28
28
  }