diff --git a/changelog.md b/changelog.md index 0a9e509f2..b331fc4f0 100644 --- a/changelog.md +++ b/changelog.md @@ -84,6 +84,16 @@ pre { ## changelog For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery). +### Saturday 6/7/2024 - v3.13.1 +{{taskList + +##### calculuschild, G-Ambatte + +* [x] Hotfixes for issues with v3.13.0 + +Fixes issues [#3559](https://github.com/naturalcrit/homebrewery/issues/3559), [#3552](https://github.com/naturalcrit/homebrewery/issues/3552), [#3554](https://github.com/naturalcrit/homebrewery/issues/3554) +}} + ### Friday 28/6/2024 - v3.13.0 {{taskList diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index 1aa767f36..d87e720c1 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -189,12 +189,14 @@ const BrewRenderer = (props)=>{ }; let brewThemeRendererPath = props?.renderer ? props.renderer : 'Legacy'; + // Correct for casing vs theme.json + if(brewThemeRendererPath == 'legacy') { brewThemeRendererPath = 'Legacy'; } if(props?.theme && (props?.theme[0] === '#')) { brewThemeRendererPath = 'Brew'; } let themePath = props.theme ?? '5ePHB'; const Themes = { ...staticThemes, ...props.userThemes }; - const baseThemePath = (themePath && themePath[0] !== '#') ? Themes[brewThemeRendererPath][themePath]?.baseTheme : 'Brew'; + const baseThemePath = (themePath && themePath[0] !== '#') ? Themes[brewThemeRendererPath][themePath].baseTheme : 'Brew'; // Override static theme values if a Brew theme. diff --git a/package-lock.json b/package-lock.json index 5d25f0561..556854e7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "homebrewery", - "version": "3.13.0", + "version": "3.13.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "homebrewery", - "version": "3.13.0", + "version": "3.13.1", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -14,7 +14,7 @@ "@babel/plugin-transform-runtime": "^7.24.7", "@babel/preset-env": "^7.24.7", "@babel/preset-react": "^7.24.7", - "@googleapis/drive": "^8.10.0", + "@googleapis/drive": "^8.11.0", "body-parser": "^1.20.2", "classnames": "^2.5.1", "codemirror": "^5.65.6", @@ -32,13 +32,13 @@ "less": "^3.13.1", "lodash": "^4.17.21", "marked": "11.2.0", - "marked-emoji": "^1.4.0", + "marked-emoji": "^1.4.1", "marked-extended-tables": "^1.0.8", - "marked-gfm-heading-id": "^3.1.3", + "marked-gfm-heading-id": "^3.2.0", "marked-smartypants-lite": "^1.0.2", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", - "mongoose": "^8.4.1", + "mongoose": "^8.4.5", "nanoid": "3.3.4", "nconf": "^0.12.1", "react": "^18.3.1", @@ -52,7 +52,7 @@ "devDependencies": { "eslint": "^8.57.0", "eslint-plugin-jest": "^28.6.0", - "eslint-plugin-react": "^7.34.2", + "eslint-plugin-react": "^7.34.3", "jest": "^29.7.0", "jest-expect-message": "^1.1.3", "postcss-less": "^6.0.0", @@ -1966,9 +1966,9 @@ } }, "node_modules/@googleapis/drive": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/@googleapis/drive/-/drive-8.10.0.tgz", - "integrity": "sha512-loumtaDmAn2JvU4KuFMhhtaYG1Hxw0RVS4vl+rOWMU7NAU151XYfIWFDJfFFZjvYZxH4tbsmHEnF+DKH1hQ75Q==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/@googleapis/drive/-/drive-8.11.0.tgz", + "integrity": "sha512-HW6/2oThc4X086mGkZxpdP4P+aHpYbjHa6wr9l1F/R+snpk6G8/EuRXEcTkgQUl2t/NdNz3lj8re0AQBG5faSA==", "dependencies": { "googleapis-common": "^7.0.0" }, @@ -3422,16 +3422,19 @@ } }, "node_modules/array.prototype.tosorted": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.3.tgz", - "integrity": "sha512-/DdH4TiTmOKzyQbp/eadcCVexiCb36xJg7HshYOYJnNZFDj33GEv0P7GxsynpShhq4OLYJzbGcBDkLsDt7MnNg==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.4.tgz", + "integrity": "sha512-p6Fx8B7b7ZhL/gmUsAy0D15WhvDccw3mnGNbZpi3pmeJdxtWsj2jEaI4Y6oo3XiHfzuSgPwKc04MYt6KgvC/wA==", "dev": true, "dependencies": { - "call-bind": "^1.0.5", + "call-bind": "^1.0.7", "define-properties": "^1.2.1", - "es-abstract": "^1.22.3", - "es-errors": "^1.1.0", + "es-abstract": "^1.23.3", + "es-errors": "^1.3.0", "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" } }, "node_modules/arraybuffer.prototype.slice": { @@ -5603,16 +5606,16 @@ } }, "node_modules/eslint-plugin-react": { - "version": "7.34.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.34.2.tgz", - "integrity": "sha512-2HCmrU+/JNigDN6tg55cRDKCQWicYAPB38JGSFDQt95jDm8rrvSUo7YPkOIm5l6ts1j1zCvysNcasvfTMQzUOw==", + "version": "7.34.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.34.3.tgz", + "integrity": "sha512-aoW4MV891jkUulwDApQbPYTVZmeuSyFrudpbTAQuj5Fv8VL+o6df2xIGpw8B0hPjAaih1/Fb0om9grCdyFYemA==", "dev": true, "dependencies": { "array-includes": "^3.1.8", "array.prototype.findlast": "^1.2.5", "array.prototype.flatmap": "^1.3.2", "array.prototype.toreversed": "^1.1.2", - "array.prototype.tosorted": "^1.1.3", + "array.prototype.tosorted": "^1.1.4", "doctrine": "^2.1.0", "es-iterator-helpers": "^1.0.19", "estraverse": "^5.3.0", @@ -9831,11 +9834,11 @@ } }, "node_modules/marked-emoji": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/marked-emoji/-/marked-emoji-1.4.0.tgz", - "integrity": "sha512-/2TJfGzXpiBBq+X3akHHbTrAjZPJDwR+7FV6SyQLECnQEfaoVkrpKZJzHhPTAq3Sl/A1l2frMT0u6b38VBBlNg==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/marked-emoji/-/marked-emoji-1.4.1.tgz", + "integrity": "sha512-3xHWQn8XD1LyhMpHxWpHTDWBZ9bpXLlW8JIqvyXTO6he7okKIB/W9fD/3fTg0DQuZlSQvPZ6Ub5hN6Rnmn7j9g==", "peerDependencies": { - "marked": ">=4 <13" + "marked": ">=4 <14" } }, "node_modules/marked-extended-tables": { @@ -9847,9 +9850,9 @@ } }, "node_modules/marked-gfm-heading-id": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/marked-gfm-heading-id/-/marked-gfm-heading-id-3.1.3.tgz", - "integrity": "sha512-A0cRU4PCueX/5m8VE4mT8uTQ36l3xMYRojz3Eqnk4BmUFZ0T+9Xhn2KvHcANP4qbhfOeuMrWJCTQbASIBR5xeg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/marked-gfm-heading-id/-/marked-gfm-heading-id-3.2.0.tgz", + "integrity": "sha512-Xfxpr5lXLDLY10XqzSCA9l2dDaiabQUgtYM9hw8yunyVsB/xYBRpiic6BOiY/EAJw1ik1eWr1ET1HKOAPZBhXg==", "dependencies": { "github-slugger": "^2.0.0" }, @@ -10228,9 +10231,9 @@ } }, "node_modules/mongoose": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.4.1.tgz", - "integrity": "sha512-odQ2WEWGL3hb0Qex+QMN4eH6D34WdMEw7F1If2MGABApSDmG9cMmqv/G1H6WsXmuaH9mkuuadW/WbLE5+tHJwA==", + "version": "8.4.5", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.4.5.tgz", + "integrity": "sha512-E5KjBThxST2uFSKKXuiMa9H9Zx4DLTSLuxodAnIzJRixNwc1ARTlJUK1m0a80EB+ZKGP4QNTasyUYRG9DUSHOA==", "dependencies": { "bson": "^6.7.0", "kareem": "2.6.3", diff --git a/package.json b/package.json index 9bacb6c64..321f9afbe 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "homebrewery", "description": "Create authentic looking D&D homebrews using only markdown", - "version": "3.13.0", + "version": "3.13.1", "engines": { "npm": "^10.2.x", "node": "^20.8.x" @@ -86,7 +86,7 @@ "@babel/plugin-transform-runtime": "^7.24.7", "@babel/preset-env": "^7.24.7", "@babel/preset-react": "^7.24.7", - "@googleapis/drive": "^8.10.0", + "@googleapis/drive": "^8.11.0", "body-parser": "^1.20.2", "classnames": "^2.5.1", "codemirror": "^5.65.6", @@ -104,13 +104,13 @@ "less": "^3.13.1", "lodash": "^4.17.21", "marked": "11.2.0", - "marked-emoji": "^1.4.0", + "marked-emoji": "^1.4.1", "marked-extended-tables": "^1.0.8", - "marked-gfm-heading-id": "^3.1.3", + "marked-gfm-heading-id": "^3.2.0", "marked-smartypants-lite": "^1.0.2", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", - "mongoose": "^8.4.1", + "mongoose": "^8.4.5", "nanoid": "3.3.4", "nconf": "^0.12.1", "react": "^18.3.1", @@ -124,7 +124,7 @@ "devDependencies": { "eslint": "^8.57.0", "eslint-plugin-jest": "^28.6.0", - "eslint-plugin-react": "^7.34.2", + "eslint-plugin-react": "^7.34.3", "jest": "^29.7.0", "jest-expect-message": "^1.1.3", "postcss-less": "^6.0.0", diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 529129833..39939f306 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -787,11 +787,13 @@ const processStyleTags = (string)=>{ }; }; +//Given a string representing an HTML element, extract all of its properties (id, class, style, and other attributes) const extractHTMLStyleTags = (htmlString)=>{ - const id = htmlString.match(/id="([^"]*)"/)?.[1] || null; - const classes = htmlString.match(/class="([^"]*)"/)?.[1] || null; - const styles = htmlString.match(/style="([^"]*)"/)?.[1] || null; - const attributes = htmlString.match(/[a-zA-Z]+="[^"]*"/g) + const firstElementOnly = htmlString.split('>')[0]; + const id = firstElementOnly.match(/id="([^"]*)"/)?.[1] || null; + const classes = firstElementOnly.match(/class="([^"]*)"/)?.[1] || null; + const styles = firstElementOnly.match(/style="([^"]*)"/)?.[1] || null; + const attributes = firstElementOnly.match(/[a-zA-Z]+="[^"]*"/g) ?.filter((attr)=>!attr.startsWith('class="') && !attr.startsWith('style="') && !attr.startsWith('id="')) .reduce((obj, attr)=>{ const index = attr.indexOf('='); diff --git a/tests/markdown/mustache-syntax.test.js b/tests/markdown/mustache-syntax.test.js index 7b0115cae..3f7f2529b 100644 --- a/tests/markdown/mustache-syntax.test.js +++ b/tests/markdown/mustache-syntax.test.js @@ -333,6 +333,13 @@ describe('Injection: When an injection tag follows an element', ()=>{ expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('
text{background:blue}
'); }); + it('Renders an parent and child element, each modified by an injector', function() { + const source = dedent`**bolded text**{color:red} + {color:blue}`; + const rendered = Markdown.render(source).trimReturns(); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('bolded text
'); + }); + it('Renders an image with added attributes', function() { const source = ` {position:absolute,bottom:20px,left:130px,width:220px,a="b and c",d=e}`; const rendered = Markdown.render(source).trimReturns();