Completed code blocks and runs

print-window-tiddler
Jeremy Ruston 2012-06-02 10:15:52 +01:00
rodzic 80b2d9c9fe
commit ec933eb1b5
3 zmienionych plików z 31 dodań i 4 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -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>>