From fd89e60de885450ed0f9e13e3ae55e0132777974 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Wed, 20 Oct 2021 13:35:57 -0500 Subject: [PATCH] STON exportation excludes binary images now, to keep the output diff friendly. --- repository/TiddlyWiki/TiddlyWiki.class.st | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/repository/TiddlyWiki/TiddlyWiki.class.st b/repository/TiddlyWiki/TiddlyWiki.class.st index 0c27fb5..fc03890 100644 --- a/repository/TiddlyWiki/TiddlyWiki.class.st +++ b/repository/TiddlyWiki/TiddlyWiki.class.st @@ -13,7 +13,7 @@ Class { 'remote', 'name' ], - #category : 'TiddlyWiki-Model' + #category : #'TiddlyWiki-Model' } { #category : #accessing } @@ -51,14 +51,14 @@ TiddlyWiki >> exportJSONSubtiddlers: subtiddlersCollection [ { #category : #accessing } TiddlyWiki >> exportSTONFile [ - | stonFile output | + | stonFile output wikiTemp | stonFile := self tiddlersJSONFile withoutExtension, 'ston'. output := '' writeStream. (STON writer on: output ) newLine: String lf; prettyPrint: true; keepNewLines: true; - nextPut: self. + nextPut: self withoutImages. ^ MarkupFile exportAsFileOn: stonFile containing:output contents ] @@ -195,3 +195,13 @@ TiddlyWiki >> tiddlersJSONFile [ ]. ^ 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 +]