1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-11-14 22:37:13 +00:00

Introduce JSON parse utility function with error handling (#6401)

* Introduce JSON parse utility function with error handling

Fixes #6400

* Fix typo
This commit is contained in:
Jeremy Ruston
2022-02-21 15:29:25 +00:00
committed by GitHub
parent 5378b45c40
commit 82c8fe7fa8
18 changed files with 48 additions and 58 deletions

View File

@@ -151,7 +151,7 @@ WikiFolderMaker.prototype.saveCustomPlugin = function(pluginTiddler) {
pluginInfo = pluginTiddler.getFieldStrings({exclude: ["text","type"]});
this.saveJSONFile(directory + path.sep + "plugin.info",pluginInfo);
self.log("Writing " + directory + path.sep + "plugin.info: " + JSON.stringify(pluginInfo,null,$tw.config.preferences.jsonSpaces));
var pluginTiddlers = JSON.parse(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin
var pluginTiddlers = $tw.utils.parseJSONSafe(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin
$tw.utils.each(pluginTiddlers,function(tiddler) {
self.saveTiddler(directory,new $tw.Tiddler(tiddler));
});