Merge branch 'detach-recovery', integrating tiddler exporter changes.

This commit is contained in:
ruidajo 2022-10-10 17:17:55 -05:00
commit 7ba4c88e20

View File

@ -247,6 +247,16 @@ TiddlyWiki >> exportJSONFromRebuildedCommonTiddlers [
]
{ #category : #accessing }
TiddlyWiki >> exportJSONFromTiddlersInSubfolder: subfolder [
| rebuildedTiddlersJSON dateNowString |
dateNowString := (DateAndTime now asLocalStringYMDHM copyReplaceAll: ':' with: '-') copyReplaceAll: ' ' with: '-'.
rebuildedTiddlersJSON := '[', (',' join: ((self rebuildTiddlersFromSubfolder: subfolder) collect: [ :each | each asJsonString ])), ']'.
^ MarkupFile exportAsFileOn: subfolder / 'rebuildedTiddlers', dateNowString, 'json' containing: rebuildedTiddlersJSON
]
{ #category : #accessing }
TiddlyWiki >> exportJSONSubtiddlers: subtiddlersCollection [
@ -259,6 +269,23 @@ TiddlyWiki >> exportJSONSubtiddlers: subtiddlersCollection as: aName [
^ MarkupFile exportAsFileOn: self file parent / aName, 'json' containing: (self jsonSubtiddlers: subtiddlersCollection)
]
{ #category : #accessing }
TiddlyWiki >> exportJSONTiddlersTagged: aTag in: aFolder [
| dateNowString |
dateNowString := (DateAndTime now asLocalStringYMDHM copyReplaceAll: ':' with: '-') copyReplaceAll: ' ' with: '-'.
self exportJSONTiddlersTagged: aTag in: aFolder named: (self name, '-', aTag, '-', dateNowString)
]
{ #category : #accessing }
TiddlyWiki >> exportJSONTiddlersTagged: aTag in: aFolder named: aFileName [
| taggedTiddlers jsonString |
taggedTiddlers := self taggedWith: aTag.
jsonString := '[', (',' join: (taggedTiddlers collect: [ :each | each asJsonString ])), ']'.
^ MarkupFile exportAsFileOn: aFolder / (aFileName, '.json') containing: jsonString
]
{ #category : #accessing }
TiddlyWiki >> exportJSTiddlers [
@ -403,6 +430,7 @@ TiddlyWiki >> importJSONLink [
| tiddlersJson |
tiddlersJson := (self remote asString, '/tiddlers.json') asUrl retrieveContents.
jsonFile := self folder / 'tiddlers.json'.
self name; file.
MarkupFile exportAsFileOn: jsonFile containing: tiddlersJson.
^ self fromString: tiddlersJson
]
@ -568,6 +596,21 @@ TiddlyWiki >> rebuildTiddlers [
^ stonTiddlers
]
{ #category : #accessing }
TiddlyWiki >> rebuildTiddlersFromSubfolder: subfolder [
| stonTiddlers contentTiddlersFiles |
contentTiddlersFiles := subfolder children
select: [ :each | each basename endsWith: 'ston' ].
stonTiddlers := OrderedCollection new.
stonTiddlers
addAll: (contentTiddlersFiles
collect:[ :each | STONJSON fromString: each contents ]).
stonTiddlers collect: [ :tiddler | tiddler wiki: self ].
^ stonTiddlers
]
{ #category : #accessing }
TiddlyWiki >> rebuildTiddlersJSON [