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
|
^ STONJSON fromString: pageData retrieveContents
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #testing }
|
||||||
|
Tiddler >> isImage [
|
||||||
|
|
||||||
|
^ self type = 'image/'
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #testing }
|
{ #category : #testing }
|
||||||
Tiddler >> isJavascript [
|
Tiddler >> isJavascript [
|
||||||
|
|
||||||
^ self type = 'application/javascript'
|
^ self type = 'application/javascript'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #testing }
|
||||||
|
Tiddler >> isMarkdown [
|
||||||
|
|
||||||
|
^ self type = 'text/x-markdown'
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #testing }
|
{ #category : #testing }
|
||||||
Tiddler >> isNilType [
|
Tiddler >> isNilType [
|
||||||
|
|
||||||
^ self type = nil
|
^ self type = nil
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #testing }
|
||||||
|
Tiddler >> isPDF [
|
||||||
|
|
||||||
|
^ self type = 'application/pdf'
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #testing }
|
{ #category : #testing }
|
||||||
Tiddler >> isShadow [
|
Tiddler >> isShadow [
|
||||||
|
|
||||||
@ -247,6 +265,18 @@ Tiddler >> isTW5Type [
|
|||||||
^ self type = 'text/vnd.tiddlywiki'
|
^ 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 }
|
{ #category : #utilities }
|
||||||
Tiddler >> itemContentsStringFor: item into: stream [
|
Tiddler >> itemContentsStringFor: item into: stream [
|
||||||
stream
|
stream
|
||||||
|
@ -80,6 +80,22 @@ TiddlyWiki >> contentTiddlers [
|
|||||||
^ self tiddlers copyWithoutAll: self shadow
|
^ 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 }
|
{ #category : #accessing }
|
||||||
TiddlyWiki >> exportContentType: aMimeType [
|
TiddlyWiki >> exportContentType: aMimeType [
|
||||||
|
|
||||||
@ -321,15 +337,31 @@ TiddlyWiki >> printOn: aStream [
|
|||||||
nextPutAll: '( ', self name ,' )'
|
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 }
|
{ #category : #accessing }
|
||||||
TiddlyWiki >> rebuildTiddlersJSON [
|
TiddlyWiki >> rebuildTiddlersJSON [
|
||||||
|
|
||||||
| stonTiddlers stonTiddlerFiles |
|
self tiddlers: self rebuildTiddlers.
|
||||||
stonTiddlerFiles := self tiddlersFolder asFileReference children
|
^ self exportJSONSubtiddlers: (self rebuildTiddlers asArray) as: 'rebuildedTiddlers'.
|
||||||
select: [ :each | each fullName endsWith: 'ston' ].
|
|
||||||
stonTiddlers := stonTiddlerFiles collect: [ :each | STON fromString: each contents ].
|
|
||||||
self tiddlers: stonTiddlers.
|
|
||||||
^ self exportJSONSubtiddlers: self tiddlers as: 'rebuildedTiddlers'.
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
|
Loading…
Reference in New Issue
Block a user