diff --git a/core/modules/parsers/newwikitextparser/rules/macro.js b/core/modules/parsers/newwikitextparser/rules/macro.js index 865e1d4c8..7c154c67b 100644 --- a/core/modules/parsers/newwikitextparser/rules/macro.js +++ b/core/modules/parsers/newwikitextparser/rules/macro.js @@ -17,16 +17,21 @@ exports.name = "macro"; exports.runParser = true; exports.blockParser = true; -exports.regExpString = "<<"; +exports.regExpString = "<<(?:(?:[!@£\\$%\\^\\&\\*\\(\\)`\\~'\"\\|\\\\\\/;\\:\\.\\,\\+\\=\\-\\_\\{\\}])|(?:[^>\\s]+))(?:\\s*)(?:(?:[^>]|(?:>(?!>|<)))*)>(?:>|<)"; exports.parse = function(match,isBlock) { - var regExp = /<<(?:([!@£\$%\^\&\*\(\)`\~'"\|\\\/;\:\.\,\+\=\-\_\{\}])|([^>\s]+))(?:\s*)((?:[^>]|(?:>(?!>)))*)>>/mg; + var regExp = /<<(?:([!@£\$%\^\&\*\(\)`\~'"\|\\\/;\:\.\,\+\=\-\_\{\}])|([^>\s]+))(?:\s*)((?:[^>]|(?:>(?!>|<)))*)>(?:(>)|(<))/mg, + content = []; regExp.lastIndex = this.pos; match = regExp.exec(this.source); if(match && match.index === this.pos) { this.pos = match.index + match[0].length; + if(match[5]) { + content = this.parseRun(/(>>)/mg); + } var macroNode = $tw.Tree.Macro(match[1] || match[2],{ srcParams: match[3], + content: content, isBlock: isBlock, wiki: this.wiki }); diff --git a/tw5.com/tiddlers/TestingNewWikiText.tid b/tw5.com/tiddlers/TestingNewWikiText.tid index dba1a6524..a9558257d 100644 --- a/tw5.com/tiddlers/TestingNewWikiText.tid +++ b/tw5.com/tiddlers/TestingNewWikiText.tid @@ -23,7 +23,9 @@ Here is some ''bold face'', and __some underlining__ and of course some --strike Here's an unterminated ''bit of bold face. And also some entities like Ç Ç "HTML Entity". -Here is a macro <> +Here is a macro <>. + +This is a macro with content <> ! This is a new heading This is a paragraph