Fixing JSON exportation.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-09-08 20:00:14 -05:00
parent 1a198b9380
commit 28d0e1eb20

View File

@ -49,9 +49,16 @@ Tiddler >> asDictionary [
yourself.
]
{ #category : 'accessing' }
Tiddler >> asJSONFile [
| jsonFile |
jsonFile := self wiki file parent / 'tiddlers' / (self title asLowercase, '.json').
^ MarkupFile exportAsFileOn: jsonFile containing:self asJson
]
{ #category : 'converting' }
Tiddler >> asJson [
^ STON toStringPretty: { self asDictionary }
^ STONJSON toStringPretty: { self asDictionary }
]
{ #category : 'converting' }
@ -68,7 +75,7 @@ Tiddler >> asJsonTempFile [
{ #category : 'accessing' }
Tiddler >> asStonStringPretty [
| output temp |
temp := self.
temp := self copy.
temp wiki: nil.
output := '' writeStream.
(STON writer on: output)
@ -130,6 +137,13 @@ Tiddler >> customFields [
^ customFields ifNil: [ customFields := Dictionary new]
]
{ #category : 'accessing' }
Tiddler >> exportSTONFile [
| stonFile output |
stonFile := self wiki file parent / 'tiddlers' / (self title asLowercase, '.ston') .
^ MarkupFile exportAsFileOn: stonFile containing: self asStonStringPretty
]
{ #category : 'accessing' }
Tiddler >> exportWithTemplate: aTemplate [
^ aTemplate asMustacheTemplate value: self asDictionary