« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util/replacer.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/util/replacer.js b/src/util/replacer.js
index 2c0e89f1..f692b068 100644
--- a/src/util/replacer.js
+++ b/src/util/replacer.js
@@ -201,7 +201,7 @@ function parseNodes(input, i, stopAt, textOnly) {
       string = string.trimEnd();
     }
 
-    string = squashBackslashes(string);
+    string = cleanRawText(string);
 
     if (string.length) {
       nodes.push({i: iString, iEnd: i, type: 'text', data: string});
@@ -429,6 +429,19 @@ export function squashBackslashes(text) {
   return text.replace(/([^\\](?:\\{2})*)\\(?![\\*_-])/g, '$1');
 }
 
+export function restoreRawHTMLTags(text) {
+  // Replace stuff like <html:a> with <a>; these signal that
+  // the tag shouldn't be processed by the replacer system,
+  // and should just be embedded into the content as raw HTML.
+  return text.replace(/<html:(.*?)(?=[ >])/g, '<$1');
+}
+
+export function cleanRawText(text) {
+  text = squashBackslashes(text);
+  text = restoreRawHTMLTags(text);
+  return text;
+}
+
 export function postprocessImages(inputNodes) {
   const outputNodes = [];