Factor some lines (raw loading pug files)
[vchess.git] / client / src / views / Rules.vue
index 2871f3f..2edd8a8 100644 (file)
@@ -44,6 +44,7 @@ import ComputerGame from "@/components/ComputerGame.vue";
 import { store } from "@/store";
 import { replaceByDiag } from "@/utils/printDiagram";
 import { CompgameStorage } from "@/utils/compgameStorage";
+import afterRawLoad from "@/utils/afterRawLoad";
 export default {
   name: "my-rules",
   components: {
@@ -77,19 +78,13 @@ export default {
     },
     content: function() {
       if (!this.gameInfo.vname) return ""; //variant not set yet
-      // (AJAX) Request to get rules content (plain text, HTML)
       return (
-        require(
-          "raw-loader!@/translations/rules/" +
-          this.gameInfo.vname + "/" +
-          this.st.lang + ".pug"
+        afterRawLoad(
+          require(
+            "raw-loader!@/translations/rules/" +
+            this.gameInfo.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)
       );
     }
   },