STON exportation excludes binary images now, to keep the output diff friendly.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-10-20 13:35:57 -05:00
parent fecbd57f16
commit fd89e60de8

View File

@ -13,7 +13,7 @@ Class {
'remote', 'remote',
'name' 'name'
], ],
#category : 'TiddlyWiki-Model' #category : #'TiddlyWiki-Model'
} }
{ #category : #accessing } { #category : #accessing }
@ -51,14 +51,14 @@ TiddlyWiki >> exportJSONSubtiddlers: subtiddlersCollection [
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> exportSTONFile [ TiddlyWiki >> exportSTONFile [
| stonFile output | | stonFile output wikiTemp |
stonFile := self tiddlersJSONFile withoutExtension, 'ston'. stonFile := self tiddlersJSONFile withoutExtension, 'ston'.
output := '' writeStream. output := '' writeStream.
(STON writer on: output ) (STON writer on: output )
newLine: String lf; newLine: String lf;
prettyPrint: true; prettyPrint: true;
keepNewLines: true; keepNewLines: true;
nextPut: self. nextPut: self withoutImages.
^ MarkupFile exportAsFileOn: stonFile containing:output contents ^ MarkupFile exportAsFileOn: stonFile containing:output contents
] ]
@ -195,3 +195,13 @@ TiddlyWiki >> tiddlersJSONFile [
]. ].
^ jsonFile ^ jsonFile
] ]
{ #category : #accessing }
TiddlyWiki >> withoutImages [
| filteredTiddlers tempWiki |
filteredTiddlers := self tiddlers reject: [:tiddler | tiddler type isNotNil and: [tiddler type beginsWith: 'image/'] ].
tempWiki := self copy
tiddlers: filteredTiddlers.
tempWiki tiddlers do: [:tiddler | tiddler wiki: tempWiki ].
^ tempWiki
]