Improving data serialization and making it more diff friendly.
This commit is contained in:
parent
27eb70e928
commit
d7da993cd0
@ -51,6 +51,11 @@ Tiddler >> asDictionary [
|
|||||||
|
|
||||||
{ #category : 'converting' }
|
{ #category : 'converting' }
|
||||||
Tiddler >> asJson [
|
Tiddler >> asJson [
|
||||||
|
^ STON toStringPretty: { self asDictionary }
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : 'converting' }
|
||||||
|
Tiddler >> asJsonString [
|
||||||
^ STONJSON toStringPretty: self asDictionary
|
^ STONJSON toStringPretty: self asDictionary
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -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' }
|
{ #category : 'accessing' }
|
||||||
Tiddler >> bag [
|
Tiddler >> bag [
|
||||||
^ bag
|
^ bag
|
||||||
|
@ -16,9 +16,15 @@ Class {
|
|||||||
|
|
||||||
{ #category : 'accessing' }
|
{ #category : 'accessing' }
|
||||||
TiddlyWiki >> exportSTONTiddlersFile [
|
TiddlyWiki >> exportSTONTiddlersFile [
|
||||||
| stonFile |
|
| stonFile output |
|
||||||
stonFile := self tiddlersJSONFile withoutExtension, 'ston'.
|
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' }
|
{ #category : 'accessing' }
|
||||||
|
Loading…
Reference in New Issue
Block a user