Local and remote tiddlers UID integration.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-10-10 12:22:30 -05:00
parent 8bea95118d
commit 110b5460dd

View File

@ -242,7 +242,7 @@ TiddlyWiki >> exportJSONFromRebuildedCommonTiddlers [
| rebuildedTiddlersJSON dateNowString wikiFolder| | rebuildedTiddlersJSON dateNowString wikiFolder|
wikiFolder := self folder. wikiFolder := self folder.
dateNowString := (DateAndTime now asLocalStringYMDHM copyReplaceAll: ':' with: '-') copyReplaceAll: ' ' with: '-'. dateNowString := (DateAndTime now asLocalStringYMDHM copyReplaceAll: ':' with: '-') copyReplaceAll: ' ' with: '-'.
rebuildedTiddlersJSON := '[', (',' join: (self rebuildTiddlersWithoutLargeTiddlers collect: [ :each | each asJsonString ])), ']'. rebuildedTiddlersJSON := '[', (',' join: (self rebuildWithoutLargeTiddlers collect: [ :each | each asJsonString ])), ']'.
^ MarkupFile exportAsFileOn: wikiFolder / 'rebuildedCommonTiddlers', dateNowString, 'json' containing: rebuildedTiddlersJSON ^ MarkupFile exportAsFileOn: wikiFolder / 'rebuildedCommonTiddlers', dateNowString, 'json' containing: rebuildedTiddlersJSON
] ]
@ -365,7 +365,15 @@ TiddlyWiki >> fromUrl: anUrlString [
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> getRemoteTiddlers [ TiddlyWiki >> getRemoteTiddlers [
self importJSONLink. | remoteTiddlers localTiddlers |
remoteTiddlers := self importJSONLink tiddlers.
localTiddlers := self rebuildWithoutLargeTiddlers asArray.
"^ self recentCommonTiddlersChanged"
localTiddlers do: [ :each | | remoteTiddler |
remoteTiddler := remoteTiddlers detect: [:tiddler | tiddler title = each title].
remoteTiddler customFields at: 'uid' put: (each customFields at: 'uid').
].
self tiddlers: remoteTiddlers.
^ self recentCommonTiddlersChanged ^ self recentCommonTiddlersChanged
] ]
@ -555,7 +563,7 @@ TiddlyWiki >> rebuildTiddlers [
stonTiddlers := OrderedCollection new. stonTiddlers := OrderedCollection new.
stonTiddlers stonTiddlers
addAll: self rebuildTiddlersWithoutShadows ; addAll: self rebuildWithoutShadows ;
addAll: (STON fromString:shadowTiddlersFile first contents). addAll: (STON fromString:shadowTiddlersFile first contents).
^ stonTiddlers ^ stonTiddlers
] ]
@ -563,13 +571,13 @@ TiddlyWiki >> rebuildTiddlers [
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> rebuildTiddlersJSON [ TiddlyWiki >> rebuildTiddlersJSON [
self tiddlers: self rebuildTiddlersWithoutShadows. self tiddlers: self rebuildWithoutShadows.
^ self exportJSONSubtiddlers: ^ self exportJSONSubtiddlers:
(self rebuildTiddlersWithoutShadows) as: 'rebuildedTiddlers'. (self rebuildWithoutShadows) as: 'rebuildedTiddlers'.
] ]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> rebuildTiddlersWithoutLargeTiddlers [ TiddlyWiki >> rebuildWithoutLargeTiddlers [
| stonTiddlers contentTiddlersFiles | | stonTiddlers contentTiddlersFiles |
contentTiddlersFiles := self tiddlersFolder files contentTiddlersFiles := self tiddlersFolder files
@ -584,7 +592,7 @@ TiddlyWiki >> rebuildTiddlersWithoutLargeTiddlers [
] ]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> rebuildTiddlersWithoutShadows [ TiddlyWiki >> rebuildWithoutShadows [
| stonTiddlers largeTiddlersRebuild | | stonTiddlers largeTiddlersRebuild |
largeTiddlersRebuild := (((self largeTiddlersFolder files) largeTiddlersRebuild := (((self largeTiddlersFolder files)
@ -594,7 +602,7 @@ TiddlyWiki >> rebuildTiddlersWithoutShadows [
stonTiddlers := OrderedCollection new. stonTiddlers := OrderedCollection new.
stonTiddlers stonTiddlers
addAll: largeTiddlersRebuild; addAll: largeTiddlersRebuild;
addAll: self rebuildTiddlersWithoutLargeTiddlers. addAll: self rebuildWithoutLargeTiddlers.
^ stonTiddlers ^ stonTiddlers
] ]