mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-24 17:10:29 +00:00
Added support for macros with embedded content
This commit is contained in:
parent
03da553c3b
commit
ee7fba9297
@ -17,16 +17,21 @@ exports.name = "macro";
|
|||||||
exports.runParser = true;
|
exports.runParser = true;
|
||||||
exports.blockParser = true;
|
exports.blockParser = true;
|
||||||
|
|
||||||
exports.regExpString = "<<";
|
exports.regExpString = "<<(?:(?:[!@£\\$%\\^\\&\\*\\(\\)`\\~'\"\\|\\\\\\/;\\:\\.\\,\\+\\=\\-\\_\\{\\}])|(?:[^>\\s]+))(?:\\s*)(?:(?:[^>]|(?:>(?!>|<)))*)>(?:>|<)";
|
||||||
|
|
||||||
exports.parse = function(match,isBlock) {
|
exports.parse = function(match,isBlock) {
|
||||||
var regExp = /<<(?:([!@£\$%\^\&\*\(\)`\~'"\|\\\/;\:\.\,\+\=\-\_\{\}])|([^>\s]+))(?:\s*)((?:[^>]|(?:>(?!>)))*)>>/mg;
|
var regExp = /<<(?:([!@£\$%\^\&\*\(\)`\~'"\|\\\/;\:\.\,\+\=\-\_\{\}])|([^>\s]+))(?:\s*)((?:[^>]|(?:>(?!>|<)))*)>(?:(>)|(<))/mg,
|
||||||
|
content = [];
|
||||||
regExp.lastIndex = this.pos;
|
regExp.lastIndex = this.pos;
|
||||||
match = regExp.exec(this.source);
|
match = regExp.exec(this.source);
|
||||||
if(match && match.index === this.pos) {
|
if(match && match.index === this.pos) {
|
||||||
this.pos = match.index + match[0].length;
|
this.pos = match.index + match[0].length;
|
||||||
|
if(match[5]) {
|
||||||
|
content = this.parseRun(/(>>)/mg);
|
||||||
|
}
|
||||||
var macroNode = $tw.Tree.Macro(match[1] || match[2],{
|
var macroNode = $tw.Tree.Macro(match[1] || match[2],{
|
||||||
srcParams: match[3],
|
srcParams: match[3],
|
||||||
|
content: content,
|
||||||
isBlock: isBlock,
|
isBlock: isBlock,
|
||||||
wiki: this.wiki
|
wiki: this.wiki
|
||||||
});
|
});
|
||||||
|
@ -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's an unterminated ''bit of bold face. And also some entities like Ç Ç "HTML Entity".
|
||||||
|
|
||||||
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 new heading
|
||||||
This is a paragraph
|
This is a paragraph
|
||||||
|
Loading…
Reference in New Issue
Block a user