From 4b49160bb1d67159fb41e59fe4c9103ac73e7aa4 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Mon, 14 Mar 2022 10:23:50 -0500 Subject: [PATCH] Using external improved exporters. --- repository/TiddlyWiki/Tiddler.class.st | 33 ++++++++++++++++++++--- repository/TiddlyWiki/TiddlyWiki.class.st | 4 +-- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/repository/TiddlyWiki/Tiddler.class.st b/repository/TiddlyWiki/Tiddler.class.st index 83bda4e..a10d39d 100644 --- a/repository/TiddlyWiki/Tiddler.class.st +++ b/repository/TiddlyWiki/Tiddler.class.st @@ -157,18 +157,39 @@ Tiddler >> exportSTONFile [ { #category : #accessing } Tiddler >> exportSTONFileInto: subfolder [ - | stonFile output dashedTitle sanitized | - dashedTitle := '-' join: (self title substrings collect: [ :each | each ]). - sanitized := dashedTitle copyWithoutAll: #($¿ $? $! $¡ $/). - stonFile := self wiki file parent / subfolder / (sanitized, '--', (self uid copyFrom: 1 to: 5), '.ston'). + | stonFile | + stonFile := self wiki file parent / subfolder / self fileName. ^ MarkupFile exportAsFileOn: stonFile containing: self asStonStringPretty ] +{ #category : #accessing } +Tiddler >> exportSTONFileOptimized [ + + | exporter wikiFolder | + wikiFolder := self wiki file parent. + exporter := wikiFolder / 'scripts' / 'stringAsFileInto'. + exporter exists ifFalse: [ self installTiddlerExporter ]. + + OSSUnixSubprocess new + command: exporter fullName; + arguments: { self asStonStringPretty . self fileName }; + workingDirectory: exporter parent fullName; + runAndWaitOnExitDo: [ :process :outString | ^ wikiFolder / 'scripts' / self fileName ] +] + { #category : #accessing } Tiddler >> exportWithTemplate: aTemplate [ ^ aTemplate asMustacheTemplate value: self asDictionary ] +{ #category : #accessing } +Tiddler >> fileName [ + | dashedTitle sanitized | + dashedTitle := '-' join: (self title substrings collect: [ :each | each ]). + sanitized := dashedTitle copyWithoutAll: #($¿ $? $! $¡ $/). + ^ sanitized , '--', (self uid copyFrom: 1 to: 5), '.ston'. +] + { #category : #accessing } Tiddler >> fromDictionary: aDictionary [ | customKeys | @@ -227,6 +248,10 @@ Tiddler >> importFedWikiPage: pageViewUrlString [ ^ STONJSON fromString: pageData retrieveContents ] +{ #category : #accessing } +Tiddler >> installTiddlerExporter [ +] + { #category : #testing } Tiddler >> isImage [ diff --git a/repository/TiddlyWiki/TiddlyWiki.class.st b/repository/TiddlyWiki/TiddlyWiki.class.st index f243cb0..6bac430 100644 --- a/repository/TiddlyWiki/TiddlyWiki.class.st +++ b/repository/TiddlyWiki/TiddlyWiki.class.st @@ -158,7 +158,7 @@ TiddlyWiki >> exportCommonTiddlers [ | content | content := self commonTiddlers. ^ content do: [ :each | - each exportSTONFileInto: 'tiddlers' ]. + each exportSTONFileOptimized ]. ] { #category : #accessing } @@ -191,7 +191,7 @@ TiddlyWiki >> exportJSONFileOptimized [ | exporter wikiFolder | wikiFolder := self file parent. exporter := wikiFolder / 'scripts' / 'exportJsonFile'. - exporter exists ifFalse: [ self installJsonExporter]. + exporter exists ifFalse: [ self installJsonExporter ]. OSSUnixSubprocess new command: exporter fullName;