From 092e495e90ff008161d712a038daa58c7d2bf56e Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 18 Oct 2012 23:20:27 +0100 Subject: [PATCH] Fixes the text reference parsing --- core/modules/wiki.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 78d914e72..7d471235c 100644 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -26,7 +26,10 @@ last dispatched. Each entry is a hashmap containing two fields: "use strict"; /* -Get the value of a text reference +Get the value of a text reference. Text references can have any of these forms: + + ## + ## - specifies a field of the current tiddlers */ exports.getTextReference = function(textRef,defaultText,currTiddlerTitle) { var tr = this.parseTextReference(textRef), @@ -85,12 +88,14 @@ exports.parseTextReference = function(textRef,currTiddlerTitle) { var pos = textRef.indexOf("!!"); if(pos !== -1) { if(pos === 0) { + // Just a field return { - field: textRef + field: textRef.substring(2) }; } else { + // Field and title return { - title: textRef.substring(0,pos - 1), + title: textRef.substring(0,pos), field: textRef.substring(pos + 2) }; }