Added support for macros with embedded content

print-window-tiddler
Jeremy Ruston 2012-06-05 17:01:17 +01:00
rodzic 03da553c3b
commit ee7fba9297
2 zmienionych plików z 10 dodań i 3 usunięć

Wyświetl plik

@ -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
});

Wyświetl plik

@ -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 &#xc7; &#199; &quot;HTML Entity&quot;.
Here is a macro <<list all>>
Here is a macro <<version>>.
This is a macro with content <<link to:"HelloThere"><This is a //link// to something.>>
! This is a new heading
This is a paragraph