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 }
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 [

View File

@ -158,7 +158,7 @@ TiddlyWiki >> exportCommonTiddlers [
| content |
content := self commonTiddlers.
^ content do: [ :each |
each exportSTONFileInto: 'tiddlers' ].
each exportSTONFileOptimized ].
]
{ #category : #accessing }