mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-10-30 23:23:02 +00:00 
			
		
		
		
	Prettify JSON
This commit is contained in:
		| @@ -992,7 +992,7 @@ $tw.loadBundleFolder = function(filepath,excludeRegExp) { | |||||||
| 		title: bundleInfo.title, | 		title: bundleInfo.title, | ||||||
| 		type: "application/json", | 		type: "application/json", | ||||||
| 		bundle: "yes", | 		bundle: "yes", | ||||||
| 		text: JSON.stringify(bundleInfo) | 		text: JSON.stringify(bundleInfo,null,4) | ||||||
| 	} : null; | 	} : null; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,7 @@ exports.preferences = {}; | |||||||
|  |  | ||||||
| exports.preferences.animationDuration = 400; | exports.preferences.animationDuration = 400; | ||||||
| exports.preferences.animationDurationMs = exports.preferences.animationDuration + "ms"; | exports.preferences.animationDurationMs = exports.preferences.animationDuration + "ms"; | ||||||
|  | exports.preferences.jsonSpaces = 4; | ||||||
|  |  | ||||||
| exports.dateFormats = { | exports.dateFormats = { | ||||||
| 	months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November","December"], | 	months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November","December"], | ||||||
|   | |||||||
| @@ -334,7 +334,7 @@ Set a tiddlers content to a JavaScript object. Currently this is done by setting | |||||||
| */ | */ | ||||||
| exports.setTiddlerData = function(title,data) { | exports.setTiddlerData = function(title,data) { | ||||||
| 	var tiddler = this.getTiddler(title); | 	var tiddler = this.getTiddler(title); | ||||||
| 	this.addTiddler(new $tw.Tiddler(tiddler,{title: title, type: "application/json", text: JSON.stringify(data)})); | 	this.addTiddler(new $tw.Tiddler(tiddler,{title: title, type: "application/json", text: JSON.stringify(data,null,$tw.config.preferences.jsonSpaces)})); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /* | /* | ||||||
|   | |||||||
| @@ -395,7 +395,7 @@ $tw.plugins.dropbox.saveTiddlerIndex = function(path,callback) { | |||||||
| 		} | 		} | ||||||
| 	}); | 	}); | ||||||
| 	// Save everything to a tiddler | 	// Save everything to a tiddler | ||||||
| 	$tw.wiki.addTiddler({title: $tw.plugins.dropbox.titleTiddlerIndex, type: "application/json", text: JSON.stringify(index)},true); | 	$tw.wiki.addTiddler({title: $tw.plugins.dropbox.titleTiddlerIndex, type: "application/json", text: JSON.stringify(index,null,$tw.config.preferences.jsonSpaces)},true); | ||||||
| 	// Generate the index file | 	// Generate the index file | ||||||
| 	var file = $tw.wiki.renderTiddler("text/plain",$tw.plugins.dropbox.titleAppIndexTemplate); | 	var file = $tw.wiki.renderTiddler("text/plain",$tw.plugins.dropbox.titleAppIndexTemplate); | ||||||
| 	// Save the index to Dropbox | 	// Save the index to Dropbox | ||||||
|   | |||||||
| @@ -512,7 +512,7 @@ TiddlyWebSyncer.prototype.convertTiddlerToTiddlyWebFormat = function(title) { | |||||||
| 	if(result.type === "text/x-tiddlywiki") { | 	if(result.type === "text/x-tiddlywiki") { | ||||||
| 		result.type = null; | 		result.type = null; | ||||||
| 	} | 	} | ||||||
| 	return JSON.stringify(result); | 	return JSON.stringify(result,null,$tw.config.preferences.jsonSpaces); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /* | /* | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jeremy Ruston
					Jeremy Ruston