diff --git a/temp.js b/temp.js new file mode 100644 index 0000000..56f0961 --- /dev/null +++ b/temp.js @@ -0,0 +1,19 @@ +const flavorTextRegexp = /\| flavor-text = ([\s\S]+?)\n\|/; +const flavorTextReplacement = newFlavorText => `| flavor-text = ${newFlavorText}\n|` + +function fixPageContent (pageContent) { + let match = pageContent.match(flavorTextRegexp); + if (!match) return pageContent; + + let flavorText = match[1]; + let newFlavorText = flavorText + // linebreaks with no preceding
or
etc + .replace(/(?)\n/g, '
\n') + // spans that set color via inline style instead of using {{colorize}} + .replace(/([^<]+)<\/span>/g, '`$1`') + .replace(/([^<]+)<\/span>/g, '``$1``') + + return pageContent.replace(flavorTextRegexp, flavorTextReplacement(newFlavorText)); +} + +const pages = //...