diff --git a/core/modules/parsers/wikiparser/rules/transcludeblock.js b/core/modules/parsers/wikiparser/rules/transcludeblock.js index 525113d5d..5c5367cb4 100644 --- a/core/modules/parsers/wikiparser/rules/transcludeblock.js +++ b/core/modules/parsers/wikiparser/rules/transcludeblock.js @@ -23,6 +23,27 @@ exports.init = function(parser) { this.matchRegExp = /\{\{([^\{\}\|]*)(?:\|\|([^\|\{\}]+))?(?:\|([^\{\}]+))?\}\}(?:\r?\n|$)/mg; }; +/* +Reject the match if we don't have a template or text reference +*/ +exports.findNextMatch = function(startPos) { + this.matchRegExp.lastIndex = startPos; + this.match = this.matchRegExp.exec(this.parser.source); + if(this.match) { + var template = $tw.utils.trim(this.match[2]), + textRef = $tw.utils.trim(this.match[1]); + // Bail if we don't have a template or text reference + if(!template && !textRef) { + return undefined; + } else { + return this.match.index; + } + } else { + return undefined; + } + return this.match ? this.match.index : undefined; +}; + exports.parse = function() { // Move past the match this.parser.pos = this.matchRegExp.lastIndex; diff --git a/core/modules/parsers/wikiparser/rules/transcludeinline.js b/core/modules/parsers/wikiparser/rules/transcludeinline.js index 4ae58e617..57def3e33 100644 --- a/core/modules/parsers/wikiparser/rules/transcludeinline.js +++ b/core/modules/parsers/wikiparser/rules/transcludeinline.js @@ -23,6 +23,27 @@ exports.init = function(parser) { this.matchRegExp = /\{\{([^\{\}\|]*)(?:\|\|([^\|\{\}]+))?(?:\|([^\{\}]+))?\}\}/mg; }; +/* +Reject the match if we don't have a template or text reference +*/ +exports.findNextMatch = function(startPos) { + this.matchRegExp.lastIndex = startPos; + this.match = this.matchRegExp.exec(this.parser.source); + if(this.match) { + var template = $tw.utils.trim(this.match[2]), + textRef = $tw.utils.trim(this.match[1]); + // Bail if we don't have a template or text reference + if(!template && !textRef) { + return undefined; + } else { + return this.match.index; + } + } else { + return undefined; + } + return this.match ? this.match.index : undefined; +}; + exports.parse = function() { // Move past the match this.parser.pos = this.matchRegExp.lastIndex; diff --git a/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid b/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid index f35234cbf..7483128e2 100644 --- a/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid +++ b/editions/prerelease/tiddlers/system/TiddlyWiki Pre-release.tid @@ -19,4 +19,5 @@ The pre-release is also available as an [[empty wiki|https://tiddlywiki.com/prer
Updated: <$view field="modified" format="date" template={{$:/language/Tiddler/DateFormat}}/>
<$transclude mode="block"/> +