mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-06-25 23:03:15 +00:00
Fix writing non-wikitext text tiddlers
The plan had been to switch template depending on the content type, but we’d only implemented support for saving wikitext tiddlers. That meant that creating a tiddler with any non-wikitext content type failed to write the file correctly under Node.js. Now we just always save in .tid file format.
This commit is contained in:
parent
b357e8bb26
commit
a4506231a7
|
@ -40,10 +40,6 @@ $tw.config.typeInfo = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$tw.config.typeTemplates = {
|
|
||||||
"application/x-tiddler": "$:/core/templates/tid-tiddler"
|
|
||||||
};
|
|
||||||
|
|
||||||
FileSystemAdaptor.prototype.getTiddlerFileInfo = function(tiddler,callback) {
|
FileSystemAdaptor.prototype.getTiddlerFileInfo = function(tiddler,callback) {
|
||||||
// See if we've already got information about this file
|
// See if we've already got information about this file
|
||||||
var self = this,
|
var self = this,
|
||||||
|
@ -178,8 +174,7 @@ FileSystemAdaptor.prototype.saveTiddler = function(tiddler,callback) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Save the tiddler as a self contained templated file
|
// Save the tiddler as a self contained templated file
|
||||||
template = $tw.config.typeTemplates[fileInfo.type];
|
content = self.wiki.renderTiddler("text/plain","$:/core/templates/tid-tiddler",{variables: {currentTiddler: tiddler.fields.title}});
|
||||||
content = self.wiki.renderTiddler("text/plain",template,{variables: {currentTiddler: tiddler.fields.title}});
|
|
||||||
fs.writeFile(fileInfo.filepath,content,{encoding: "utf8"},function (err) {
|
fs.writeFile(fileInfo.filepath,content,{encoding: "utf8"},function (err) {
|
||||||
if(err) {
|
if(err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user