From e05a216b522bf9f9c852429194c30748e1b4f2cd Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sun, 13 Mar 2022 18:06:23 -0500 Subject: [PATCH] Better naming. Introducing optimized external Nim callings to improve speed. --- repository/TiddlyWiki/TiddlyWiki.class.st | 73 ++++++++++++----------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/repository/TiddlyWiki/TiddlyWiki.class.st b/repository/TiddlyWiki/TiddlyWiki.class.st index bd1ec6c..f243cb0 100644 --- a/repository/TiddlyWiki/TiddlyWiki.class.st +++ b/repository/TiddlyWiki/TiddlyWiki.class.st @@ -88,7 +88,7 @@ TiddlyWiki >> changesAfter: aDateString [ | recent created modified wiki aDate | aDate := aDateString asZTimestamp. - wiki := self contentTiddlersWithoutLargeTiddlers. + wiki := self commonTiddlers. created := wiki select: [ :tiddler | tiddler created asZTimestamp > aDate ]. modified := wiki select: [ :tiddler | tiddler modified isNotNil and: [ tiddler modified asZTimestamp > aDate ] ]. @@ -100,6 +100,21 @@ TiddlyWiki >> changesAfter: aDateString [ ^ recent asSet. ] +{ #category : #accessing } +TiddlyWiki >> commonTiddlers [ + + | 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. +] + { #category : #accessing } TiddlyWiki >> configDictonary [ ^ STONJSON fromString: self configFile contents. @@ -122,21 +137,6 @@ TiddlyWiki >> contentTiddlers [ ^ self tiddlers copyWithoutAll: self shadow ] -{ #category : #accessing } -TiddlyWiki >> contentTiddlersWithoutLargeTiddlers [ - - | 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. -] - { #category : #accessing } TiddlyWiki >> detectRepositoryLocal [ @@ -153,18 +153,18 @@ TiddlyWiki >> detectRepositoryLocal [ ] { #category : #accessing } -TiddlyWiki >> exportContentShadowAndLargeTiddlersSTONFiles [ +TiddlyWiki >> exportCommonTiddlers [ - self exportSTONFiles; exportLargeTiddlers + | content | + content := self commonTiddlers. + ^ content do: [ :each | + each exportSTONFileInto: 'tiddlers' ]. ] { #category : #accessing } -TiddlyWiki >> exportContentTiddlers [ +TiddlyWiki >> exportContentShadowAndLargeTiddlersSTONFiles [ - | content | - content := self contentTiddlersWithoutLargeTiddlers. - ^ content do: [ :each | - each exportSTONFileInto: 'tiddlers' ]. + self exportSTONFiles; exportLargeTiddlers ] { #category : #accessing } @@ -240,7 +240,7 @@ TiddlyWiki >> exportSTONFiles [ stonFile := self tiddlersJSONFile withoutExtension , 'ston' ]. shadowFile := self largeTiddlersFolder / '_shadow.ston'. wikiTemp := self copy. - wikiTemp tiddlers: self contentTiddlersWithoutLargeTiddlers. + wikiTemp tiddlers: self commonTiddlers. GrafoscopioUtils exportAsSton: self shadow on: shadowFile. ^ GrafoscopioUtils exportAsSton: wikiTemp on: stonFile ] @@ -515,29 +515,23 @@ TiddlyWiki >> repository [ ] { #category : #accessing } -TiddlyWiki >> resynchronize [ +TiddlyWiki >> resynchronizeWithRepository [ | repository return | repository := self repository. repository update. + self updateFromHtml. repository syncUnversioned. return := Dictionary new at: 'status' put: self addRecentChangesToRepo. - self exportSTONFiles. - self exportContentTiddlers. - self exportLargeTiddlers. + self exportSTONFiles; + exportCommonTiddlers; + exportLargeTiddlers. ^ return at: 'file' put: self rebuildTiddlersJSON; yourself. ] -{ #category : #accessing } -TiddlyWiki >> resynchronizeWithHtml [ - self - exportJSONFileOptimized; - importJSONFile. -] - { #category : #accessing } TiddlyWiki >> selectByTagsIncludes: string [ @@ -579,7 +573,7 @@ TiddlyWiki >> syncRemoteLocalDestructive [ exportJSONFile; importJSONFile. self exportSTONFiles. - self exportContentTiddlers. + self exportCommonTiddlers. self exportLargeTiddlers. ^ Dictionary new at: 'status' put: repository status; @@ -627,6 +621,13 @@ TiddlyWiki >> tiddlersJSONUrl [ self remote ifNil: [^ nil]. ] +{ #category : #accessing } +TiddlyWiki >> updateFromHtml [ + self + exportJSONFileOptimized; + importJSONFile. +] + { #category : #accessing } TiddlyWiki >> withoutContentType: application [ | filteredTiddlers tempWiki |