Improving rebuild tiddlers from STON files.

This commit is contained in:
ruidajo 2022-03-11 01:19:03 -05:00
parent 53aeaf9240
commit 57401052b4

View File

@ -415,19 +415,14 @@ TiddlyWiki >> printOn: aStream [
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> rebuildTiddlers [ TiddlyWiki >> rebuildTiddlers [
| stonTiddlers contentTiddlersFiles shadowTiddlersFile | | stonTiddlers shadowTiddlersFile |
shadowTiddlersFile := self largeTiddlersFolder asFileReference children shadowTiddlersFile := self largeTiddlersFolder asFileReference children
select: [ :each | each basename beginsWith: '_shadow.ston' ]. select: [ :each | each basename beginsWith: '_shadow.ston' ].
contentTiddlersFiles := self tiddlersFolder files
select: [ :each | each basename endsWith: 'ston' ].
stonTiddlers := OrderedCollection new. stonTiddlers := OrderedCollection new.
stonTiddlers stonTiddlers
addAll: (((self largeTiddlersFolder files) addAll: self rebuildTiddlersWithoutShadows ;
reject: [ :each | each basename beginsWith: '_shadow.ston' ]) addAll: (STON fromString:shadowTiddlersFile first contents).
collect: [ :each | STONJSON fromString: each contents ]);
addAll: (contentTiddlersFiles collect:[ :each | STONJSON fromString: each contents ]).
^ stonTiddlers ^ stonTiddlers
] ]
@ -435,11 +430,12 @@ TiddlyWiki >> rebuildTiddlers [
TiddlyWiki >> rebuildTiddlersJSON [ TiddlyWiki >> rebuildTiddlersJSON [
self tiddlers: self rebuildTiddlersWithoutShadows. self tiddlers: self rebuildTiddlersWithoutShadows.
^ self exportJSONSubtiddlers: (self rebuildTiddlers asArray) as: 'rebuildedTiddlers'. ^ self exportJSONSubtiddlers:
(self rebuildTiddlersWithoutShadows asArray) as: 'rebuildedTiddlers'.
] ]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> rebuildTiddlersWithoutShadows [ TiddlyWiki >> rebuildTiddlersWithoutLargeTiddlers [
| stonTiddlers contentTiddlersFiles | | stonTiddlers contentTiddlersFiles |
contentTiddlersFiles := self tiddlersFolder files contentTiddlersFiles := self tiddlersFolder files
@ -447,10 +443,23 @@ TiddlyWiki >> rebuildTiddlersWithoutShadows [
stonTiddlers := OrderedCollection new. stonTiddlers := OrderedCollection new.
stonTiddlers stonTiddlers
addAll: (((self largeTiddlersFolder files) addAll: (contentTiddlersFiles
collect:[ :each | STONJSON fromString: each contents ]).
^ stonTiddlers
]
{ #category : #accessing }
TiddlyWiki >> rebuildTiddlersWithoutShadows [
| stonTiddlers largeTiddlers |
largeTiddlers := (((self largeTiddlersFolder files)
reject: [ :each | each basename beginsWith: '_shadow.ston' ]) reject: [ :each | each basename beginsWith: '_shadow.ston' ])
collect: [ :each | STONJSON fromString: each contents ]); collect: [ :each | STONJSON fromString: each contents ]).
addAll: (contentTiddlersFiles collect:[ :each | STONJSON fromString: each contents ]).
stonTiddlers := OrderedCollection new.
stonTiddlers
addAll: largeTiddlers;
addAll: self rebuildTiddlersWithoutLargeTiddlers.
^ stonTiddlers ^ stonTiddlers
] ]