Using templates for wiki creation.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-11-28 13:39:43 -05:00
parent 005e128ce0
commit 0f6bcbe6b2
1 changed files with 25 additions and 0 deletions

View File

@ -440,6 +440,13 @@ TiddlyWiki >> getRemoteTiddlers [
^ self recentCommonTiddlersChanged
]
{ #category : #accessing }
TiddlyWiki >> hasTemplateInTiddlyHost [
self template ifNil: [ ^ false ].
^ self template asZnUrl host endsWith: 'tiddlyhost.com'
]
{ #category : #accessing }
TiddlyWiki >> htmlFileExists [
self file ifNil: [
@ -802,11 +809,29 @@ TiddlyWiki >> taggedWith: aTag [
]
]
{ #category : #accessing }
TiddlyWiki >> template [
^ template
]
{ #category : #accessing }
TiddlyWiki >> template: anUrl [
template := anUrl
]
{ #category : #accessing }
TiddlyWiki >> templateTiddlersContentsString [
self hasTemplateInTiddlyHost ifFalse: [ ^ self ].
^ (self template asString, '/tiddlers.json') asZnUrl retrieveContents.
]
{ #category : #accessing }
TiddlyWiki >> templateWiki [
^ (TiddlyWiki new fromString: self templateTiddlersContentsString)
name: 'Template Wiki';
remote: self template
]
{ #category : #accessing }
TiddlyWiki >> tiddlers [
tiddlers ifNotNil: [ ^ tiddlers ].