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

View File

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