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

View File

@ -440,6 +440,13 @@ TiddlyWiki >> getRemoteTiddlers [
^ self recentCommonTiddlersChanged ^ self recentCommonTiddlersChanged
] ]
{ #category : #accessing }
TiddlyWiki >> hasTemplateInTiddlyHost [
self template ifNil: [ ^ false ].
^ self template asZnUrl host endsWith: 'tiddlyhost.com'
]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> htmlFileExists [ TiddlyWiki >> htmlFileExists [
self file ifNil: [ self file ifNil: [
@ -802,11 +809,29 @@ TiddlyWiki >> taggedWith: aTag [
] ]
] ]
{ #category : #accessing }
TiddlyWiki >> template [
^ template
]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> template: anUrl [ TiddlyWiki >> template: anUrl [
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 } { #category : #accessing }
TiddlyWiki >> tiddlers [ TiddlyWiki >> tiddlers [
tiddlers ifNotNil: [ ^ tiddlers ]. tiddlers ifNotNil: [ ^ tiddlers ].