asdf
This commit is contained in:
parent
b25a111a1e
commit
855c1571f9
1 changed files with 19 additions and 0 deletions
19
temp.js
Normal file
19
temp.js
Normal file
|
|
@ -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 <br> or <br /> etc
|
||||
.replace(/(?<!<br\s*\/?>)\n/g, '<br>\n')
|
||||
// spans that set color via inline style instead of using {{colorize}}
|
||||
.replace(/<span style="color: #00cc22;">([^<]+)<\/span>/g, '`$1`')
|
||||
.replace(/<span style="color: #ffff66;">([^<]+)<\/span>/g, '``$1``')
|
||||
|
||||
return pageContent.replace(flavorTextRegexp, flavorTextReplacement(newFlavorText));
|
||||
}
|
||||
|
||||
const pages = //...
|
||||
Loading…
Add table
Add a link
Reference in a new issue