diff --git a/core/modules/parsers/wikiparser/rules/transcludeblock.js b/core/modules/parsers/wikiparser/rules/transcludeblock.js index b8eda0831..7a92e7f9a 100644 --- a/core/modules/parsers/wikiparser/rules/transcludeblock.js +++ b/core/modules/parsers/wikiparser/rules/transcludeblock.js @@ -8,6 +8,8 @@ Wiki text rule for block-level transclusion. For example: ``` {{MyTiddler}} {{MyTiddler|tooltip}} +{{MyTiddler||TemplateTitle}} +{{MyTiddler|tooltip||TemplateTitle}} {{MyTiddler}width:40;height:50;}.class.class ``` @@ -24,7 +26,7 @@ exports.types = {block: true}; exports.init = function(parser) { this.parser = parser; // Regexp to match - this.matchRegExp = /\{\{([^\{\}\|]+)(?:\|([^\{\}]+))?\}([^\}]*)\}(?:\.(\S+))?(?:\r?\n|$)/mg; + this.matchRegExp = /\{\{([^\{\}\|]+)(?:\|([^\|\{\}]+))?(?:\|\|([^\|\{\}]+))?\}([^\}]*)\}(?:\.(\S+))?(?:\r?\n|$)/mg; }; exports.parse = function() { @@ -33,8 +35,9 @@ exports.parse = function() { // Get the match details var targetTitle = this.match[1], tooltip = this.match[2], - style = this.match[3], - classes = this.match[4]; + template = this.match[3], + style = this.match[4], + classes = this.match[5]; // Return the transclude widget var node = { type: "widget", @@ -47,6 +50,9 @@ exports.parse = function() { if(tooltip) { node.attributes.tooltip = {type: "string", value: tooltip}; } + if(template) { + node.attributes.template = {type: "string", value: template}; + } if(style) { node.attributes.style = {type: "string", value: style}; } diff --git a/core/modules/parsers/wikiparser/rules/transcludeinline.js b/core/modules/parsers/wikiparser/rules/transcludeinline.js index 6ea1759e7..0882a9472 100644 --- a/core/modules/parsers/wikiparser/rules/transcludeinline.js +++ b/core/modules/parsers/wikiparser/rules/transcludeinline.js @@ -8,6 +8,8 @@ Wiki text rule for inline-level transclusion. For example: ``` {{MyTiddler}} {{MyTiddler|tooltip}} +{{MyTiddler||TemplateTitle}} +{{MyTiddler|tooltip||TemplateTitle}} {{MyTiddler}width:40;height:50;}.class.class ``` @@ -24,7 +26,7 @@ exports.types = {inline: true}; exports.init = function(parser) { this.parser = parser; // Regexp to match - this.matchRegExp = /\{\{([^\{\}\|]+)(?:\|([^\{\}]+))?\}([^\}]*)\}(?:\.(\S+))?/mg; + this.matchRegExp = /\{\{([^\{\}\|]+)(?:\|([^\|\{\}]+))?(?:\|\|([^\|\{\}]+))?\}([^\}]*)\}(?:\.(\S+))?/mg; }; exports.parse = function() { @@ -33,8 +35,9 @@ exports.parse = function() { // Get the match details var targetTitle = this.match[1], tooltip = this.match[2], - style = this.match[3], - classes = this.match[4]; + template = this.match[3], + style = this.match[4], + classes = this.match[5]; // Return the transclude widget var node = { type: "widget", @@ -46,6 +49,9 @@ exports.parse = function() { if(tooltip) { node.attributes.tooltip = {type: "string", value: tooltip}; } + if(template) { + node.attributes.template = {type: "string", value: template}; + } if(style) { node.attributes.style = {type: "string", value: style}; }