Insert line breaks in output of getTiddlersAsJson (#5786)

Rather than have the entire store on one line, insert a line break
after each tiddler.
new-json-store-area
Simon Baird 2021-06-13 07:36:09 -04:00 zatwierdzone przez GitHub
rodzic bca2668373
commit 4110083d94
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -712,7 +712,7 @@ exports.getTiddlersAsJson = function(filter,options) {
}
var tiddlers = this.filterTiddlers(filter),
spaces = (options.spaces === undefined) ? $tw.config.preferences.jsonSpaces : options.spaces,
data = [],
jsonLines = [],
t,fields,tiddler;
for(t=0;t<tiddlers.length; t++) {
tiddler = this.getTiddler(tiddlers[t]);
@ -721,10 +721,10 @@ exports.getTiddlersAsJson = function(filter,options) {
for(var field in tiddler.fields) {
fields[field] = tiddler.getFieldString(field);
}
data.push(fields);
jsonLines.push(JSON.stringify(fields,null,spaces));
}
}
var json = JSON.stringify(data,null,spaces);
var json = "[\n" + jsonLines.join(",\n") + "\n]";
if(options.escapeUnsafeScriptCharacters) {
function escapeUnsafeChars(unsafeChar) {
return {