diff --git a/repository/TiddlyWiki/TiddlyWiki.class.st b/repository/TiddlyWiki/TiddlyWiki.class.st index fc03890..8a65a2f 100644 --- a/repository/TiddlyWiki/TiddlyWiki.class.st +++ b/repository/TiddlyWiki/TiddlyWiki.class.st @@ -16,6 +16,14 @@ Class { #category : #'TiddlyWiki-Model' } +{ #category : #accessing } +TiddlyWiki class >> fromJSONUrl: anUrlString [ + + ^ self new + fromDictionary: (STONJSON fromString: anUrlString asUrl retrieveContents); + name: anUrlString +] + { #category : #accessing } TiddlyWiki >> addToConfigFile [ | cleaned | @@ -72,20 +80,27 @@ TiddlyWiki >> file: anObject [ file := anObject ] +{ #category : #accessing } +TiddlyWiki >> fromDictionary: tiddlersDict [ + + self tiddlers: (tiddlersDict collect: [ :each | + Tiddler new + fromDictionary: each; + wiki: self ]) +] + { #category : #accessing } TiddlyWiki >> importJSONFile [ + "I import a JSON representation of my tiddlers data, that has been previosly exported by the TiddlyWiki HTML self contained file. Such file is called, by convention, 'tiddlers.json' and stored in the same folder where the HTML file is located." + | tiddlersDict | self tiddlersJSONFile ifNil: [ ^ self ]. tiddlersDict := STONJSON fromString: self tiddlersJSONFile contents. - self tiddlers: (tiddlersDict collect: [:each | - Tiddler new - fromDictionary: each; - wiki: self - ]) + self fromDictionary: tiddlersDict ] { #category : #accessing } @@ -147,7 +162,7 @@ TiddlyWiki >> networkView [ TiddlyWiki >> printOn: aStream [ super printOn: aStream. aStream - nextPutAll: '( ', self file basename ,' )' + nextPutAll: '( ', self name ,' )' ] { #category : #accessing }