Multihosted wiki syncronization started: preparations.
This commit is contained in:
parent
f083d7df47
commit
3d75e2729d
@ -12,7 +12,8 @@ Class {
|
|||||||
'file',
|
'file',
|
||||||
'remote',
|
'remote',
|
||||||
'jsonFile',
|
'jsonFile',
|
||||||
'tiddlers'
|
'tiddlers',
|
||||||
|
'folder'
|
||||||
],
|
],
|
||||||
#category : #'TiddlyWiki-Model'
|
#category : #'TiddlyWiki-Model'
|
||||||
}
|
}
|
||||||
@ -150,6 +151,22 @@ TiddlyWiki >> detectRepositoryLocal [
|
|||||||
^ folder
|
^ folder
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
TiddlyWiki >> downloadHTML [
|
||||||
|
| htmlLink localCopy |
|
||||||
|
self isInTiddlyHost ifTrue: [
|
||||||
|
htmlLink := self remote asString
|
||||||
|
].
|
||||||
|
localCopy := self folder / 'index.html'.
|
||||||
|
localCopy exists ifTrue: [ | timestamp |
|
||||||
|
timestamp := (DateAndTime now asString) copyReplaceAll: ':' with: '_'.
|
||||||
|
localCopy renameTo: 'index', timestamp, '.html'].
|
||||||
|
ZnClient new
|
||||||
|
url: htmlLink;
|
||||||
|
downloadTo: self folder / 'index.html'.
|
||||||
|
^ self folder
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TiddlyWiki >> exportCommonTiddlers [
|
TiddlyWiki >> exportCommonTiddlers [
|
||||||
|
|
||||||
@ -274,7 +291,16 @@ TiddlyWiki >> file: anObject [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TiddlyWiki >> folder [
|
TiddlyWiki >> folder [
|
||||||
^ self file parent
|
folder ifNotNil: [ ^ folder ].
|
||||||
|
self file
|
||||||
|
ifNotNil: [ folder := self file parent ]
|
||||||
|
ifNil: [ folder := FileLocator temp ]
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
TiddlyWiki >> folder: anObject [
|
||||||
|
folder := anObject
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -338,6 +364,11 @@ TiddlyWiki >> installJsonExporter [
|
|||||||
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
TiddlyWiki >> isInTiddlyHost [
|
||||||
|
^ self remote host endsWith: 'tiddlyhost.com'
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TiddlyWiki >> jsonFile [
|
TiddlyWiki >> jsonFile [
|
||||||
^ jsonFile ifNil: [
|
^ jsonFile ifNil: [
|
||||||
@ -411,8 +442,11 @@ TiddlyWiki >> name [
|
|||||||
name ifNotNil: [ ^ name ].
|
name ifNotNil: [ ^ name ].
|
||||||
self file ifNotNil: [ ^ name := self file basenameWithoutExtension ].
|
self file ifNotNil: [ ^ name := self file basenameWithoutExtension ].
|
||||||
self remote ifNil: [ ^ name := nil ].
|
self remote ifNil: [ ^ name := nil ].
|
||||||
|
(self remote host endsWith: 'tiddlyhost.com')
|
||||||
|
ifTrue: [ ^ name := (self remote host splitOn: '.') first ].
|
||||||
tempName := self remote file.
|
tempName := self remote file.
|
||||||
(tempName endsWithAnyOf: #('.html' '.htm')) ifTrue: [
|
(tempName endsWithAnyOf: #('.html' '.htm'))
|
||||||
|
ifTrue: [
|
||||||
suffix := (tempName splitOn: '.') last.
|
suffix := (tempName splitOn: '.') last.
|
||||||
tempName := tempName removeSuffix: '.', suffix.
|
tempName := tempName removeSuffix: '.', suffix.
|
||||||
].
|
].
|
||||||
|
Loading…
Reference in New Issue
Block a user