Skip to content

Commit

Permalink
Allow \end to end an whitespace only/empty macro definition. Fixes Ti…
Browse files Browse the repository at this point in the history
  • Loading branch information
btheado committed Dec 24, 2023
1 parent 0cf6833 commit de2dcd7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/modules/parsers/wikiparser/rules/macrodef.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ exports.parse = function() {
paramMatch = reParam.exec(paramString);
}
}
// Is this a multiline definition?
// On the \define line, was there anything other than whitespace after the close paren?
var reEnd;
if(this.match[3]) {
// If so, the end of the body is marked with \end
reEnd = new RegExp("(\\r?\\n[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?(?:$|\\r?\\n))","mg");
// If so, it is a multiline definition and the end of the body is marked with \end
reEnd = new RegExp("((?:^|\\r?\\n)[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?(?:$|\\r?\\n))","mg");
} else {
// Otherwise, the end of the definition is marked by the end of the line
reEnd = /($|\r?\n)/mg;
Expand Down

0 comments on commit de2dcd7

Please sign in to comment.