mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-24 17:10:29 +00:00
Completed code blocks and runs
This commit is contained in:
parent
80b2d9c9fe
commit
ec933eb1b5
@ -20,7 +20,18 @@ exports.regExpString = "\\{\\{\\{\\s*\\r?\\n";
|
||||
|
||||
exports.parse = function(match,isBlock) {
|
||||
this.pos = match.index + match[0].length;
|
||||
return [$tw.Tree.Element("pre",{},this.parseRun(/(\}\}\})/mg))];
|
||||
var regExp = /(\r?\n\}\}\})/mg,
|
||||
text;
|
||||
regExp.lastIndex = this.pos;
|
||||
match = regExp.exec(this.source);
|
||||
if(match) {
|
||||
text = this.source.substring(this.pos,match.index);
|
||||
this.pos = match.index + match[0].length;
|
||||
} else {
|
||||
text = this.source.substr(this.pos);
|
||||
this.pos = this.sourceLength;
|
||||
}
|
||||
return [$tw.Tree.Element("code",{},[$tw.Tree.Text(text)])];
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -16,11 +16,27 @@ exports.name = "coderun";
|
||||
|
||||
exports.runParser = true;
|
||||
|
||||
exports.regExpString = "\\{\\{\\{";
|
||||
exports.regExpString = "(?:\\{\\{\\{)|(?:`)";
|
||||
|
||||
exports.parse = function(match,isBlock) {
|
||||
this.pos = match.index + match[0].length;
|
||||
return [$tw.Tree.Element("code",{},this.parseRun(/(\}\}\})/mg))];
|
||||
var regExp,
|
||||
text;
|
||||
if(match[0] === "{{{") {
|
||||
regExp = /(\}\}\})/mg;
|
||||
} else {
|
||||
regExp = /(`)/mg;
|
||||
}
|
||||
regExp.lastIndex = this.pos;
|
||||
match = regExp.exec(this.source);
|
||||
if(match) {
|
||||
text = this.source.substring(this.pos,match.index);
|
||||
this.pos = match.index + match[0].length;
|
||||
} else {
|
||||
text = this.source.substr(this.pos);
|
||||
this.pos = this.sourceLength;
|
||||
}
|
||||
return [$tw.Tree.Element("code",{},[$tw.Tree.Text(text)])];
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -13,7 +13,7 @@ Here's a paragraph with an embedded macro <<image "Motovun Jack.jpg">> and that
|
||||
This will be mono
|
||||
}}}
|
||||
|
||||
And this will be {{{inline and monospaced}}}.
|
||||
And this will be {{{inline and monospaced}}} and `so will this` little bit.
|
||||
|
||||
Here is a macro <<list all>>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user