Improving data serialization and making it more diff friendly.
This commit is contained in:
parent
27eb70e928
commit
d7da993cd0
@ -51,7 +51,12 @@ Tiddler >> asDictionary [
|
||||
|
||||
{ #category : 'converting' }
|
||||
Tiddler >> asJson [
|
||||
^ STONJSON toStringPretty: self asDictionary
|
||||
^ STON toStringPretty: { self asDictionary }
|
||||
]
|
||||
|
||||
{ #category : 'converting' }
|
||||
Tiddler >> asJsonString [
|
||||
^ STONJSON toStringPretty: self asDictionary
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
@ -60,6 +65,20 @@ Tiddler >> asJsonTempFile [
|
||||
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
Tiddler >> asStonStringPretty [
|
||||
| output temp |
|
||||
temp := self.
|
||||
temp wiki: nil.
|
||||
output := '' writeStream.
|
||||
(STON writer on: output)
|
||||
newLine: String crlf;
|
||||
prettyPrint: true;
|
||||
keepNewLines: true;
|
||||
nextPut: temp.
|
||||
^ output contents
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
Tiddler >> bag [
|
||||
^ bag
|
||||
|
@ -16,9 +16,15 @@ Class {
|
||||
|
||||
{ #category : 'accessing' }
|
||||
TiddlyWiki >> exportSTONTiddlersFile [
|
||||
| stonFile |
|
||||
| stonFile output |
|
||||
stonFile := self tiddlersJSONFile withoutExtension, 'ston'.
|
||||
^ MarkupFile exportAsFileOn: stonFile containing:(STON toStringPretty: self)
|
||||
output := '' writeStream.
|
||||
(STON writer on: output )
|
||||
newLine: String lf;
|
||||
prettyPrint: true;
|
||||
keepNewLines: true;
|
||||
nextPut: self.
|
||||
^ MarkupFile exportAsFileOn: stonFile containing:self
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
|
Loading…
Reference in New Issue
Block a user