1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Stop using triple curly braces for code

We'll use triple curly braces for filtered transclusions, and require
backtick for code.
This commit is contained in:
Jeremy Ruston 2012-12-22 23:09:10 +00:00
parent fa17eb1b96
commit 8f85ef94a6
2 changed files with 11 additions and 18 deletions

View File

@ -5,13 +5,11 @@ module-type: wikirule
Wiki text rule for code blocks. For example:
{{{
{{{
```
```
This text will not be //wikified//
}}}
}}}
Note that the opening curly braces and the closing curly braces must each be on a line of their own, and not be preceded or followed by white space.
```
```
\*/
(function(){
@ -26,11 +24,11 @@ exports.types = {block: true};
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = /\{\{\{\r?\n/mg;
this.matchRegExp = /```\r?\n/mg;
};
exports.parse = function() {
var reEnd = /(\r?\n\}\}\}$)/mg;
var reEnd = /(\r?\n```$)/mg;
// Move past the match
this.parser.pos = this.matchRegExp.lastIndex;
// Look for the end of the block

View File

@ -5,9 +5,9 @@ module-type: wikirule
Wiki text inline rule for code runs. For example:
{{{
This is a {{{code run}}} and `so is this`.
}}}
```
This is a `code run`.
```
\*/
(function(){
@ -22,18 +22,13 @@ exports.types = {inline: true};
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = /(\{\{\{)|(`)/mg;
this.matchRegExp = /`/mg;
};
exports.parse = function() {
// Move past the match
this.parser.pos = this.matchRegExp.lastIndex;
var reEnd;
if(this.match[0] === "{{{") {
reEnd = /(\}\}\})/mg;
} else {
reEnd = /(`)/mg;
}
var reEnd = /`/mg;
// Look for the end marker
reEnd.lastIndex = this.parser.pos;
var match = reEnd.exec(this.parser.source),