From 57401052b402a82ccc799ebc9a6c866e7ab5260d Mon Sep 17 00:00:00 2001 From: ruidajo Date: Fri, 11 Mar 2022 01:19:03 -0500 Subject: [PATCH] Improving rebuild tiddlers from STON files. --- repository/TiddlyWiki/TiddlyWiki.class.st | 35 ++++++++++++++--------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/repository/TiddlyWiki/TiddlyWiki.class.st b/repository/TiddlyWiki/TiddlyWiki.class.st index 60c3328..e5e3c9d 100644 --- a/repository/TiddlyWiki/TiddlyWiki.class.st +++ b/repository/TiddlyWiki/TiddlyWiki.class.st @@ -415,19 +415,14 @@ TiddlyWiki >> printOn: aStream [ { #category : #accessing } TiddlyWiki >> rebuildTiddlers [ - | stonTiddlers contentTiddlersFiles shadowTiddlersFile | - + | stonTiddlers 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: (contentTiddlersFiles collect:[ :each | STONJSON fromString: each contents ]). + addAll: self rebuildTiddlersWithoutShadows ; + addAll: (STON fromString:shadowTiddlersFile first contents). ^ stonTiddlers ] @@ -435,11 +430,12 @@ TiddlyWiki >> rebuildTiddlers [ TiddlyWiki >> rebuildTiddlersJSON [ self tiddlers: self rebuildTiddlersWithoutShadows. - ^ self exportJSONSubtiddlers: (self rebuildTiddlers asArray) as: 'rebuildedTiddlers'. + ^ self exportJSONSubtiddlers: + (self rebuildTiddlersWithoutShadows asArray) as: 'rebuildedTiddlers'. ] { #category : #accessing } -TiddlyWiki >> rebuildTiddlersWithoutShadows [ +TiddlyWiki >> rebuildTiddlersWithoutLargeTiddlers [ | stonTiddlers contentTiddlersFiles | contentTiddlersFiles := self tiddlersFolder files @@ -447,10 +443,23 @@ TiddlyWiki >> rebuildTiddlersWithoutShadows [ stonTiddlers := OrderedCollection new. 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' ]) - collect: [ :each | STONJSON fromString: each contents ]); - addAll: (contentTiddlersFiles collect:[ :each | STONJSON fromString: each contents ]). + collect: [ :each | STONJSON fromString: each contents ]). + + stonTiddlers := OrderedCollection new. + stonTiddlers + addAll: largeTiddlers; + addAll: self rebuildTiddlersWithoutLargeTiddlers. ^ stonTiddlers ]