mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-11 21:14:02 +00:00
Added support for macros with embedded content
This commit is contained in:
@@ -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
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user