Fixing tiddlers, Improving the json file importer from link and creating instace creation class methods.
This commit is contained in:
parent
27fbfe25b0
commit
c1ff0e0243
@ -18,6 +18,26 @@ Class {
|
|||||||
#category : #'TiddlyWiki-Model'
|
#category : #'TiddlyWiki-Model'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ #category : #'instance - creation' }
|
||||||
|
TiddlyWiki class >> createFromRemote: aRemoteTWUrl in: aFolder [
|
||||||
|
|
||||||
|
| wiki |
|
||||||
|
wiki := TiddlyWiki new
|
||||||
|
remote: aRemoteTWUrl;
|
||||||
|
folder: aFolder;
|
||||||
|
file: (aFolder / 'index.html') ensureCreateFile.
|
||||||
|
^ wiki downloadHTML;
|
||||||
|
tiddlers.
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #'instance - creation' }
|
||||||
|
TiddlyWiki class >> createFromRemote: aRemoteTWUrl in: aFolder named: aNameString [
|
||||||
|
|
||||||
|
| wiki |
|
||||||
|
wiki := self createFromRemote: aRemoteTWUrl in: aFolder.
|
||||||
|
^ wiki name: aNameString
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TiddlyWiki class >> fromJSONUrl: anUrlString [
|
TiddlyWiki class >> fromJSONUrl: anUrlString [
|
||||||
| rawContents contentsString |
|
| rawContents contentsString |
|
||||||
@ -363,7 +383,12 @@ TiddlyWiki >> importJSONFile [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TiddlyWiki >> importJSONLink [
|
TiddlyWiki >> importJSONLink [
|
||||||
^ self fromString: (self remote asString, '/tiddlers.json') asUrl retrieveContents
|
|
||||||
|
| tiddlersJson |
|
||||||
|
tiddlersJson := (self remote asString, '/tiddlers.json') asUrl retrieveContents.
|
||||||
|
jsonFile := self folder / 'tiddlers.json'.
|
||||||
|
MarkupFile exportAsFileOn: jsonFile containing: tiddlersJson.
|
||||||
|
^ self fromString: tiddlersJson
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -397,8 +422,9 @@ TiddlyWiki >> isInTiddlyHost [
|
|||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TiddlyWiki >> jsonFile [
|
TiddlyWiki >> jsonFile [
|
||||||
^ jsonFile ifNil: [
|
^ jsonFile ifNil: [
|
||||||
self htmlFileExists.
|
self htmlFileExists ifNotNil:
|
||||||
jsonFile := file parent / 'tiddlers.json'.]
|
[ jsonFile := file parent / 'tiddlers.json' ]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -662,7 +688,7 @@ TiddlyWiki >> taggedWith: aTag [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TiddlyWiki >> tiddlers [
|
TiddlyWiki >> tiddlers [
|
||||||
(self isInTiddlyHost and: [^ tiddlers isNil]) ifTrue: [ ^ self importJSONLink].
|
(self isInTiddlyHost and: [ tiddlers isNil ]) ifTrue: [ ^ self importJSONLink].
|
||||||
^ tiddlers ifNil: [ tiddlers := OrderedCollection new ]
|
^ tiddlers ifNil: [ tiddlers := OrderedCollection new ]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user