Creating tiddler testing methods and improving filtering-exporting.

This commit is contained in:
ruidajo 2022-02-16 09:34:11 -05:00
parent dc018e614f
commit c0657044ff
2 changed files with 66 additions and 0 deletions

View File

@ -223,6 +223,30 @@ Tiddler >> importFedWikiPage: pageViewUrlString [
^ STONJSON fromString: pageData retrieveContents
]
{ #category : #testing }
Tiddler >> isJavascript [
^ self type = 'application/javascript'
]
{ #category : #testing }
Tiddler >> isNilType [
^ self type = nil
]
{ #category : #testing }
Tiddler >> isShadow [
^ self title beginsWith: '$:/'
]
{ #category : #testing }
Tiddler >> isTW5Type [
^ self type = 'text/vnd.tiddlywiki'
]
{ #category : #utilities }
Tiddler >> itemContentsStringFor: item into: stream [
stream

View File

@ -110,6 +110,22 @@ TiddlyWiki >> exportJSONSubtiddlers: subtiddlersCollection as: aName [
^ MarkupFile exportAsFileOn: self file parent / aName, 'json' containing: (self jsonSubtiddlers: subtiddlersCollection)
]
{ #category : #accessing }
TiddlyWiki >> exportJSTiddlers [
| jsTiddlers jsNotShadow |
jsTiddlers := self tiddlers select: [ :each | each isJavascript ].
jsNotShadow := jsTiddlers reject: [ :each | each isShadow ].
^ jsNotShadow do: [ :each | each exportSTONFileInto: 'tiddlers' ]
]
{ #category : #accessing }
TiddlyWiki >> exportLargeTiddlers [
^ self largeTiddlers do: [ :each |
each exportSTONFileInto: self largeTiddlersFolderName ].
]
{ #category : #accessing }
TiddlyWiki >> exportSTONFiles [
@ -135,6 +151,19 @@ TiddlyWiki >> exportSTONTiddlers: aCollection [
aCollection do: [:each | each exportSTONFile ]
]
{ #category : #accessing }
TiddlyWiki >> exportTW5Tiddlers [
| tw5Tiddlers tw5ExplicitTiddlers notShadowTiddlers |
tw5Tiddlers := self tiddlers select: [ :each | each isNilType ].
tw5ExplicitTiddlers := self tiddlers select: [ :each | each isTW5Type ].
notShadowTiddlers := OrderedCollection new.
notShadowTiddlers addAll: (tw5ExplicitTiddlers reject: [ :each | each isShadow ]).
notShadowTiddlers addAll: (tw5Tiddlers reject: [ :each | each isShadow ]).
^ notShadowTiddlers do: [ :each | each exportSTONFileInto: 'tiddlers' ]
]
{ #category : #accessing }
TiddlyWiki >> file [
^ file
@ -206,6 +235,19 @@ TiddlyWiki >> jsonSubtiddlers: subtiddlersCollection [
^ STONJSON toStringPretty: subtiddlersDict
]
{ #category : #accessing }
TiddlyWiki >> largeTiddlers [
| wikiImages wikiPDFs wikiLargeTiddlers |
wikiImages := self selectContentType: 'image/'.
wikiPDFs := self selectContentType: 'application/pdf'.
wikiLargeTiddlers := OrderedCollection new.
wikiLargeTiddlers
addAll: wikiImages;
addAll: wikiPDFs.
^ wikiLargeTiddlers
]
{ #category : #accessing }
TiddlyWiki >> largeTiddlersFolder [
"I store all shadow tiddlers, i.e. tiddlers that provide functionality to TiddlyWiki,