We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 54ddebb commit fb28235Copy full SHA for fb28235
src/parseTools.js
@@ -17,8 +17,10 @@ let currentlyParsedFilename = '';
17
// {{{ code }}} will be replaced with |eval(code)|.
18
// NOTE: Be careful with that ret check. If ret is |0|, |ret ? ret.toString() : ''| would result in ''!
19
function processMacros(text) {
20
- return text.replace(/{{{([^}]|}(?!}))+}}}/g, (str) => {
21
- str = str.substr(3, str.length - 6);
+ // The `?` here in makes the regex non-greedy so it matches with the closest
+ // set of closing braces.
22
+ // `[\s\S]` works like `.` but include newline.
23
+ return text.replace(/{{{([\s\S]+?)}}}/g, (_, str) => {
24
try {
25
const ret = eval(str);
26
return ret !== null ? ret.toString() : '';
0 commit comments