From 8f85ef94a65c11acac01839bfaf639f2c7f06475 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 22 Dec 2012 23:09:10 +0000 Subject: [PATCH] Stop using triple curly braces for code We'll use triple curly braces for filtered transclusions, and require backtick for code. --- .../modules/parsers/wikiparser/rules/codeblock.js | 14 ++++++-------- .../parsers/wikiparser/rules/codeinline.js | 15 +++++---------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/core/modules/parsers/wikiparser/rules/codeblock.js b/core/modules/parsers/wikiparser/rules/codeblock.js index 06c3746de..84c932b10 100644 --- a/core/modules/parsers/wikiparser/rules/codeblock.js +++ b/core/modules/parsers/wikiparser/rules/codeblock.js @@ -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 diff --git a/core/modules/parsers/wikiparser/rules/codeinline.js b/core/modules/parsers/wikiparser/rules/codeinline.js index 47c67b917..84777edd9 100644 --- a/core/modules/parsers/wikiparser/rules/codeinline.js +++ b/core/modules/parsers/wikiparser/rules/codeinline.js @@ -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),