1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Fix parsing of multids files

The old code required a space after the colon separating the title
fragment from the text, and didn’t trim the strings. The new code is
more tolerant, by not requiring the space, and trimming the strings.
This commit is contained in:
Jermolene 2016-08-18 08:58:54 +01:00
parent 7bc7f643b6
commit ba2f831d8c

View File

@ -1264,12 +1264,12 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/tids","tiddlerdeserializer",{
var colonPos= line.indexOf(":"); var colonPos= line.indexOf(":");
if(colonPos !== -1) { if(colonPos !== -1) {
var tiddler = $tw.utils.extend(Object.create(null),fields); var tiddler = $tw.utils.extend(Object.create(null),fields);
tiddler.title = (tiddler.title || "") + line.substr(0,colonPos); tiddler.title = (tiddler.title || "") + line.substr(0,colonPos).trim();
if(titles.indexOf(tiddler.title) !== -1) { if(titles.indexOf(tiddler.title) !== -1) {
console.log("Warning: .multids file contains multiple definitions for " + tiddler.title); console.log("Warning: .multids file contains multiple definitions for " + tiddler.title);
} }
titles.push(tiddler.title); titles.push(tiddler.title);
tiddler.text = line.substr(colonPos + 2); tiddler.text = line.substr(colonPos + 2).trim();
tiddlers.push(tiddler); tiddlers.push(tiddler);
} }
} }