Creating TWServer and modifying tiddlers by tag JSON exporters.

This commit is contained in:
ruidajo 2022-10-12 20:26:48 -05:00
parent fadbdf7ec2
commit a1270d6ca2
2 changed files with 44 additions and 3 deletions

View File

@ -0,0 +1,41 @@
Class {
#name : #TWServer,
#superclass : #Object,
#instVars : [
'wikis'
],
#category : #TiddlyWiki
}
{ #category : #'instance creation' }
TWServer class >> new [
| instance |
instance := super new.
^ instance
wikis: Dictionary new
]
{ #category : #'export - json' }
TWServer >> exportTiddlersFrom: aWikiName tagged: aTag into: aFolder [
| wiki |
wiki := wikis at: aWikiName.
^ wiki exportJSONTiddlersTagged: aTag in: aFolder
]
{ #category : #accessing }
TWServer >> wikiNames [
| return |
return := OrderedCollection new.
wikis keysDo: [ :key | return add: key ].
^ return
]
{ #category : #accessing }
TWServer >> wikis: aTiddlyWikisDictionary [
wikis := aTiddlyWikisDictionary
]

View File

@ -269,15 +269,15 @@ TiddlyWiki >> exportJSONSubtiddlers: subtiddlersCollection as: aName [
^ MarkupFile exportAsFileOn: self file parent / aName, 'json' containing: (self jsonSubtiddlers: subtiddlersCollection) ^ MarkupFile exportAsFileOn: self file parent / aName, 'json' containing: (self jsonSubtiddlers: subtiddlersCollection)
] ]
{ #category : #accessing } { #category : #'export - json' }
TiddlyWiki >> exportJSONTiddlersTagged: aTag in: aFolder [ TiddlyWiki >> exportJSONTiddlersTagged: aTag in: aFolder [
| dateNowString | | dateNowString |
dateNowString := (DateAndTime now asLocalStringYMDHM copyReplaceAll: ':' with: '-') copyReplaceAll: ' ' with: '-'. dateNowString := (DateAndTime now asLocalStringYMDHM copyReplaceAll: ':' with: '-') copyReplaceAll: ' ' with: '-'.
^ self exportJSONTiddlersTagged: aTag in: aFolder named: (self name, '-', aTag, '-', dateNowString) ^ self exportJSONTiddlersTagged: aTag in: aFolder named: (self name, '-tagged-', aTag, '-', dateNowString)
] ]
{ #category : #accessing } { #category : #'export - json' }
TiddlyWiki >> exportJSONTiddlersTagged: aTag in: aFolder named: aFileName [ TiddlyWiki >> exportJSONTiddlersTagged: aTag in: aFolder named: aFileName [
| taggedTiddlers jsonString | | taggedTiddlers jsonString |