Using external improved exporters.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-03-14 10:23:50 -05:00
parent e05a216b52
commit 4b49160bb1
2 changed files with 31 additions and 6 deletions

View File

@ -157,18 +157,39 @@ Tiddler >> exportSTONFile [
{ #category : #accessing } { #category : #accessing }
Tiddler >> exportSTONFileInto: subfolder [ Tiddler >> exportSTONFileInto: subfolder [
| stonFile output dashedTitle sanitized | | stonFile |
dashedTitle := '-' join: (self title substrings collect: [ :each | each ]). stonFile := self wiki file parent / subfolder / self fileName.
sanitized := dashedTitle copyWithoutAll: #($¿ $? $! $/).
stonFile := self wiki file parent / subfolder / (sanitized, '--', (self uid copyFrom: 1 to: 5), '.ston').
^ MarkupFile exportAsFileOn: stonFile containing: self asStonStringPretty ^ 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 } { #category : #accessing }
Tiddler >> exportWithTemplate: aTemplate [ Tiddler >> exportWithTemplate: aTemplate [
^ aTemplate asMustacheTemplate value: self asDictionary ^ 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 } { #category : #accessing }
Tiddler >> fromDictionary: aDictionary [ Tiddler >> fromDictionary: aDictionary [
| customKeys | | customKeys |
@ -227,6 +248,10 @@ Tiddler >> importFedWikiPage: pageViewUrlString [
^ STONJSON fromString: pageData retrieveContents ^ STONJSON fromString: pageData retrieveContents
] ]
{ #category : #accessing }
Tiddler >> installTiddlerExporter [
]
{ #category : #testing } { #category : #testing }
Tiddler >> isImage [ Tiddler >> isImage [

View File

@ -158,7 +158,7 @@ TiddlyWiki >> exportCommonTiddlers [
| content | | content |
content := self commonTiddlers. content := self commonTiddlers.
^ content do: [ :each | ^ content do: [ :each |
each exportSTONFileInto: 'tiddlers' ]. each exportSTONFileOptimized ].
] ]
{ #category : #accessing } { #category : #accessing }
@ -191,7 +191,7 @@ TiddlyWiki >> exportJSONFileOptimized [
| exporter wikiFolder | | exporter wikiFolder |
wikiFolder := self file parent. wikiFolder := self file parent.
exporter := wikiFolder / 'scripts' / 'exportJsonFile'. exporter := wikiFolder / 'scripts' / 'exportJsonFile'.
exporter exists ifFalse: [ self installJsonExporter]. exporter exists ifFalse: [ self installJsonExporter ].
OSSUnixSubprocess new OSSUnixSubprocess new
command: exporter fullName; command: exporter fullName;