From: Benjamin Auder Date: Fri, 20 Nov 2020 21:17:47 +0000 (+0100) Subject: Factor some lines (raw loading pug files) X-Git-Url: https://git.auder.net/variants/current/doc/css/assets/scripts/%7B%7B%20pkg.url%20%7D%7D?a=commitdiff_plain;h=70c9745d34b705eb8a4dc72b6e4655739d31347c;p=vchess.git Factor some lines (raw loading pug files) --- diff --git a/client/package-lock.json b/client/package-lock.json index 954dad64..d50195cc 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -575,18 +575,18 @@ } }, "@vue/cli-overlay": { - "version": "4.5.8", - "resolved": "https://registry.npmjs.org/@vue/cli-overlay/-/cli-overlay-4.5.8.tgz", - "integrity": "sha512-M6q4QPKQfErHk54ycxBASgBadgdsK45f6v2NWUTAiFXdTtqv1Z7gR8JAbQhiXbni/m9571bLJnZFv5c8uhAHnw==", + "version": "4.5.9", + "resolved": "https://registry.npmjs.org/@vue/cli-overlay/-/cli-overlay-4.5.9.tgz", + "integrity": "sha512-E2PWv6tCdUz+eEDj2Th2oxiKmzMe02qi0PcxiNaO7oaqggmEOrp1rLgop7DWpiLDBiqUZk2x0vjK/q2Tz8z/eg==", "dev": true }, "@vue/cli-plugin-eslint": { - "version": "4.5.8", - "resolved": "https://registry.npmjs.org/@vue/cli-plugin-eslint/-/cli-plugin-eslint-4.5.8.tgz", - "integrity": "sha512-1lg3K2D/harXbN4FvRoA1b0X9947H+G4Ql/43rxJY39OqswfK/d1ck438Fo9M4l1+zhBSUNDmcjn7Q2EH6qWmA==", + "version": "4.5.9", + "resolved": "https://registry.npmjs.org/@vue/cli-plugin-eslint/-/cli-plugin-eslint-4.5.9.tgz", + "integrity": "sha512-wTsWRiRWPW5ik4bgtlh4P4h63Zgjsyvqx2FY0kcj+bSAnQGPJ3bKUOMU9KQP5EyNH6pAXMVGh2LEXK9WwJMf1w==", "dev": true, "requires": { - "@vue/cli-shared-utils": "^4.5.8", + "@vue/cli-shared-utils": "^4.5.9", "eslint-loader": "^2.2.1", "globby": "^9.2.0", "inquirer": "^7.1.0", @@ -595,24 +595,24 @@ } }, "@vue/cli-plugin-router": { - "version": "4.5.8", - "resolved": "https://registry.npmjs.org/@vue/cli-plugin-router/-/cli-plugin-router-4.5.8.tgz", - "integrity": "sha512-tJwVLdX4jj0Ia/1hsBejRbo4gs0hb2z1z5ert+4Ve5RNdpOKUG69OaPQgXPqvuYSQh9MW7bqG0iJmYtVD+KBNw==", + "version": "4.5.9", + "resolved": "https://registry.npmjs.org/@vue/cli-plugin-router/-/cli-plugin-router-4.5.9.tgz", + "integrity": "sha512-eBBfbZpQ1sJrdlx8i7iReFxSnuzwmrv+s2OCT3kjBd6uWRqGnD4VihpS4srC7vZLzDQrDplumSn0a93L9Qf3wQ==", "dev": true, "requires": { - "@vue/cli-shared-utils": "^4.5.8" + "@vue/cli-shared-utils": "^4.5.9" } }, "@vue/cli-plugin-vuex": { - "version": "4.5.8", - "resolved": "https://registry.npmjs.org/@vue/cli-plugin-vuex/-/cli-plugin-vuex-4.5.8.tgz", - "integrity": "sha512-wU9WPhay1zBxtdd/HLRYhFRLBbG9lw3YTBJep9sTnYwUeXiEgum4O88Q2j6cwBBPPHMgeMrKMPHS85Jf4hMc0g==", + "version": "4.5.9", + "resolved": "https://registry.npmjs.org/@vue/cli-plugin-vuex/-/cli-plugin-vuex-4.5.9.tgz", + "integrity": "sha512-mFNIJhYiJjzCgytkDHX00ROy5Yzl7prkZpUbeDE0biwcLteMf2s3qZVbESOQl6GcviqcfEt2f3tHQQtLNa+OLg==", "dev": true }, "@vue/cli-service": { - "version": "4.5.8", - "resolved": "https://registry.npmjs.org/@vue/cli-service/-/cli-service-4.5.8.tgz", - "integrity": "sha512-YcVEJvA5vQOcfRzhCQDfHxRW9WHvKqlQeiuSvNddfV2uQqKD3ifhsNYiZZuFvbev9qgRUmtmxSafpwYzj/LLBw==", + "version": "4.5.9", + "resolved": "https://registry.npmjs.org/@vue/cli-service/-/cli-service-4.5.9.tgz", + "integrity": "sha512-E3XlfM0q+UnnjbC9rwLIWNo2umZCRwnlMJY0KOhY1hFvqisGIYzFmQQ4o01KGyTx2BZNMuQg7Kw+BZ5gyM1Wig==", "dev": true, "requires": { "@intervolga/optimize-cssnano-plugin": "^1.0.5", @@ -621,10 +621,10 @@ "@types/minimist": "^1.2.0", "@types/webpack": "^4.0.0", "@types/webpack-dev-server": "^3.11.0", - "@vue/cli-overlay": "^4.5.8", - "@vue/cli-plugin-router": "^4.5.8", - "@vue/cli-plugin-vuex": "^4.5.8", - "@vue/cli-shared-utils": "^4.5.8", + "@vue/cli-overlay": "^4.5.9", + "@vue/cli-plugin-router": "^4.5.9", + "@vue/cli-plugin-vuex": "^4.5.9", + "@vue/cli-shared-utils": "^4.5.9", "@vue/component-compiler-utils": "^3.1.2", "@vue/preload-webpack-plugin": "^1.1.0", "@vue/web-component-wrapper": "^1.2.0", @@ -911,9 +911,9 @@ } }, "@vue/cli-shared-utils": { - "version": "4.5.8", - "resolved": "https://registry.npmjs.org/@vue/cli-shared-utils/-/cli-shared-utils-4.5.8.tgz", - "integrity": "sha512-pa6oenhBO/5HeDLRSokiwVN01gROACEDy3ESXWuPmragOREGNmmFKtkPHlqeYavGEX6LFp7f0VK3uMX6UYS5mQ==", + "version": "4.5.9", + "resolved": "https://registry.npmjs.org/@vue/cli-shared-utils/-/cli-shared-utils-4.5.9.tgz", + "integrity": "sha512-anvsrv+rkQC+hgxaT2nQQxnSWSsIzyysZ36LO7qPjXvDRBvcvKLAAviFlUkYbZ+ntbV8puzJ3zw+gUhQw4SEVA==", "dev": true, "requires": { "@hapi/joi": "^15.0.1", @@ -3848,9 +3848,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.596", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.596.tgz", - "integrity": "sha512-nLO2Wd2yU42eSoNJVQKNf89CcEGqeFZd++QsnN2XIgje1s/19AgctfjLIbPORlvcCO8sYjLwX4iUgDdusOY8Sg==", + "version": "1.3.597", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.597.tgz", + "integrity": "sha512-VJI21MucKaqyFw0oe3j9BIg+nDF4MHzUZAmUwZzrxho+s8zPCD13Fds07Rgu+MTtAadO4tYTKFdAUksKYUyIJw==", "dev": true }, "elliptic": { @@ -7537,9 +7537,9 @@ } }, "node-releases": { - "version": "1.1.66", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.66.tgz", - "integrity": "sha512-JHEQ1iWPGK+38VLB2H9ef2otU4l8s3yAMt9Xf934r6+ojCYDMHPMqvCc9TnzfeFSP1QEOeU6YZEd3+De0LTCgg==", + "version": "1.1.67", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.67.tgz", + "integrity": "sha512-V5QF9noGFl3EymEwUYzO+3NTDpGfQB4ve6Qfnzf3UNydMhjQRVPR1DZTuvWiLzaFJYw2fmDwAfnRNEVb64hSIg==", "dev": true }, "node-sass": { diff --git a/client/package.json b/client/package.json index 0e606bd7..dc407969 100644 --- a/client/package.json +++ b/client/package.json @@ -13,8 +13,8 @@ "vue-router": "^3.4.9" }, "devDependencies": { - "@vue/cli-plugin-eslint": "^4.5.8", - "@vue/cli-service": "^4.5.8", + "@vue/cli-plugin-eslint": "^4.5.9", + "@vue/cli-service": "^4.5.9", "ajv": "^6.12.6", "apply-loader": "^2.0.0", "babel-eslint": "^10.1.0", diff --git a/client/src/utils/afterRawLoad.js b/client/src/utils/afterRawLoad.js new file mode 100644 index 00000000..58bdb565 --- /dev/null +++ b/client/src/utils/afterRawLoad.js @@ -0,0 +1,10 @@ +export default function afterRawLoad(text) { + return ( + text + // Next two lines fix a weird issue after last update (2019-11) + .replace(/\\n/g, " ") + .replace(/\\"/g, '"') + .replace('export default "', "") + .replace(/";$/, "") + ); +} diff --git a/client/src/views/Analyse.vue b/client/src/views/Analyse.vue index 175cc157..eb36422d 100644 --- a/client/src/views/Analyse.vue +++ b/client/src/views/Analyse.vue @@ -29,6 +29,7 @@ import BaseGame from "@/components/BaseGame.vue"; import { processModalClick } from "@/utils/modalClick"; import { replaceByDiag } from "@/utils/printDiagram"; import { store } from "@/store"; +import afterRawLoad from "@/utils/afterRawLoad"; export default { name: "my-analyse", // TODO: game import ==> require some adjustments, like @@ -100,17 +101,12 @@ export default { }) .catch((err) => { this.alertAndQuit("Mispelled variant name", true); }); this.rulesContent = - require( - "raw-loader!@/translations/rules/" + - this.gameRef.vname + "/" + - this.st.lang + ".pug" + afterRawLoad( + require( + "raw-loader!@/translations/rules/" + + this.gameRef.vname + "/" + this.st.lang + ".pug" ).default - .replace('export default "', "") - .replace(/";$/, "") - // Next two lines fix a weird issue after last update (2019-11) - .replace(/\\n/g, " ") - .replace(/\\"/g, '"') - .replace(/(fen:)([^:]*):/g, replaceByDiag); + ).replace(/(fen:)([^:]*):/g, replaceByDiag); }, loadGame: function(orientation) { this.game.vname = this.gameRef.vname; diff --git a/client/src/views/Faq.vue b/client/src/views/Faq.vue index 71647173..05b1e25a 100644 --- a/client/src/views/Faq.vue +++ b/client/src/views/Faq.vue @@ -7,6 +7,7 @@ main