Improving tiddler testing and exporting.
This commit is contained in:
parent
c0657044ff
commit
b0ca67d17f
@ -223,18 +223,36 @@ Tiddler >> importFedWikiPage: pageViewUrlString [
|
||||
^ STONJSON fromString: pageData retrieveContents
|
||||
]
|
||||
|
||||
{ #category : #testing }
|
||||
Tiddler >> isImage [
|
||||
|
||||
^ self type = 'image/'
|
||||
]
|
||||
|
||||
{ #category : #testing }
|
||||
Tiddler >> isJavascript [
|
||||
|
||||
^ self type = 'application/javascript'
|
||||
]
|
||||
|
||||
{ #category : #testing }
|
||||
Tiddler >> isMarkdown [
|
||||
|
||||
^ self type = 'text/x-markdown'
|
||||
]
|
||||
|
||||
{ #category : #testing }
|
||||
Tiddler >> isNilType [
|
||||
|
||||
^ self type = nil
|
||||
]
|
||||
|
||||
{ #category : #testing }
|
||||
Tiddler >> isPDF [
|
||||
|
||||
^ self type = 'application/pdf'
|
||||
]
|
||||
|
||||
{ #category : #testing }
|
||||
Tiddler >> isShadow [
|
||||
|
||||
@ -247,6 +265,18 @@ Tiddler >> isTW5Type [
|
||||
^ self type = 'text/vnd.tiddlywiki'
|
||||
]
|
||||
|
||||
{ #category : #testing }
|
||||
Tiddler >> isTextPlain [
|
||||
|
||||
^ self type = 'text/plain'
|
||||
]
|
||||
|
||||
{ #category : #testing }
|
||||
Tiddler >> isXTiddlerDictionary [
|
||||
|
||||
^ self type = 'application/x-tiddler-dictionary'
|
||||
]
|
||||
|
||||
{ #category : #utilities }
|
||||
Tiddler >> itemContentsStringFor: item into: stream [
|
||||
stream
|
||||
|
@ -80,6 +80,22 @@ TiddlyWiki >> contentTiddlers [
|
||||
^ self tiddlers copyWithoutAll: self shadow
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> exportContentTiddlers [
|
||||
|
||||
| content |
|
||||
content := OrderedCollection new.
|
||||
content
|
||||
addAll: (self contentTiddlers
|
||||
select: [ :each | each isTW5Type or: [ each isNilType ]]);
|
||||
addAll: (self contentTiddlers select: [ :each | each isJavascript ]);
|
||||
addAll: (self contentTiddlers select: [ :each | each isXTiddlerDictionary ]);
|
||||
addAll: (self contentTiddlers select: [ :each | each isTextPlain ]);
|
||||
addAll: (self contentTiddlers select: [ :each | each isMarkdown ]).
|
||||
^ content do: [ :each |
|
||||
each exportSTONFileInto: 'tiddlers' ].
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> exportContentType: aMimeType [
|
||||
|
||||
@ -321,15 +337,31 @@ TiddlyWiki >> printOn: aStream [
|
||||
nextPutAll: '( ', self name ,' )'
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> rebuildTiddlers [
|
||||
|
||||
| stonTiddlers contentTiddlersFiles shadowTiddlersFile |
|
||||
|
||||
shadowTiddlersFile := self largeTiddlersFolder asFileReference children
|
||||
select: [ :each | each basename beginsWith: '_shadow.ston' ].
|
||||
contentTiddlersFiles := self tiddlersFolder files
|
||||
select: [ :each | each basename endsWith: 'ston' ].
|
||||
|
||||
stonTiddlers := OrderedCollection new.
|
||||
stonTiddlers
|
||||
addAll: (((self largeTiddlersFolder files)
|
||||
reject: [ :each | each basename beginsWith: '_shadow.ston' ])
|
||||
collect: [ :each | STONJSON fromString: each contents ]);
|
||||
addAll: (STON fromString:shadowTiddlersFile first contents);
|
||||
addAll: (contentTiddlersFiles collect:[ :each | STONJSON fromString: each contents ]).
|
||||
^ stonTiddlers
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> rebuildTiddlersJSON [
|
||||
|
||||
| stonTiddlers stonTiddlerFiles |
|
||||
stonTiddlerFiles := self tiddlersFolder asFileReference children
|
||||
select: [ :each | each fullName endsWith: 'ston' ].
|
||||
stonTiddlers := stonTiddlerFiles collect: [ :each | STON fromString: each contents ].
|
||||
self tiddlers: stonTiddlers.
|
||||
^ self exportJSONSubtiddlers: self tiddlers as: 'rebuildedTiddlers'.
|
||||
self tiddlers: self rebuildTiddlers.
|
||||
^ self exportJSONSubtiddlers: (self rebuildTiddlers asArray) as: 'rebuildedTiddlers'.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
Loading…
Reference in New Issue
Block a user