Creating a method to populate tiddlers from de html file and a method to get the core tiddler of the wiki.
This commit is contained in:
parent
c5386a275f
commit
41ce14934c
@ -184,6 +184,12 @@ TiddlyWiki >> contentTiddlers [
|
||||
^ self tiddlers copyWithoutAll: self shadow
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> core [
|
||||
|
||||
^ STONJSON fromString:(self shadow select: [ :tid | tid title = '$:/core']) first text
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> detectRepositoryLocal [
|
||||
|
||||
@ -813,6 +819,21 @@ TiddlyWiki >> tiddlersFolder [
|
||||
^ self folder / 'tiddlers'
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> tiddlersFromHTMLFile [
|
||||
"I process and set the tiddlers from de HTML wiki file."
|
||||
| html tiddlerStore tiddlerDict |
|
||||
|
||||
self file isNil
|
||||
ifTrue: [ ^ self inform: 'This wiki HTML file is nil.',
|
||||
(Character cr asString), 'Please provide an HTML file to the TW.' ].
|
||||
|
||||
html := XMLHTMLParser parse: self file.
|
||||
tiddlerStore := (html xpath: '//script[@class="tiddlywiki-tiddler-store"]') stringValue.
|
||||
tiddlerDict := STONJSON fromString: tiddlerStore.
|
||||
^ self tiddlers: (tiddlerDict collect: [ :dic | Tiddler new fromDictionary: dic ])
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> tiddlersJSONFile [
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user