Improving wikis creation from remote data.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-11-03 20:49:58 -05:00
parent fd89e60de8
commit 59fb501686
1 changed files with 21 additions and 6 deletions

View File

@ -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 }