mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +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:
parent
7bc7f643b6
commit
ba2f831d8c
@ -1261,15 +1261,15 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/tids","tiddlerdeserializer",{
|
|||||||
for(var t=0; t<lines.length; t++) {
|
for(var t=0; t<lines.length; t++) {
|
||||||
var line = lines[t];
|
var line = lines[t];
|
||||||
if(line.charAt(0) !== "#") {
|
if(line.charAt(0) !== "#") {
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user