Improving name consistency and formats exportation.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-09-09 11:03:15 -05:00
parent 28d0e1eb20
commit 847d1f7bc4
1 changed files with 15 additions and 9 deletions

View File

@ -34,7 +34,8 @@ Tiddler class >> nowLocal [
{ #category : 'accessing' }
Tiddler >> asDictionary [
^ Dictionary new
| response |
response := Dictionary new
at: 'title' put: self title;
at: 'text' put: self text;
at: 'created' put: self created asString;
@ -45,15 +46,13 @@ Tiddler >> asDictionary [
at: 'modified' put: self modified;
at: 'bag' put: self bag;
at: 'revision' put: self revision;
at: 'customFields' put: self customFields;
yourself.
]
{ #category : 'accessing' }
Tiddler >> asJSONFile [
| jsonFile |
jsonFile := self wiki file parent / 'tiddlers' / (self title asLowercase, '.json').
^ MarkupFile exportAsFileOn: jsonFile containing:self asJson
self customFields ifNotEmpty: [
self customFields keysAndValuesDo: [:k :v |
response at: k put: v
]
].
^ response
]
{ #category : 'converting' }
@ -137,6 +136,13 @@ Tiddler >> customFields [
^ customFields ifNil: [ customFields := Dictionary new]
]
{ #category : 'accessing' }
Tiddler >> exportJSONFile [
| jsonFile |
jsonFile := self wiki file parent / 'tiddlers' / (self title asDashedLowercase, self created asString, '.json').
^ MarkupFile exportAsFileOn: jsonFile containing:self asJson
]
{ #category : 'accessing' }
Tiddler >> exportSTONFile [
| stonFile output |