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

View File

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