Modelling configuration options.
This commit is contained in:
parent
9c7e1c5291
commit
78cf027f39
@ -1,28 +1,28 @@
|
|||||||
Extension { #name : #DateAndTime }
|
Extension { #name : #DateAndTime }
|
||||||
|
|
||||||
{ #category : #'*TiddlyWiki' }
|
{ #category : #'*TiddlyWiki' }
|
||||||
DateAndTime >> asTiddlerFormat [
|
DateAndTime >> asTiddlerFormat [
|
||||||
|
|
||||||
| hours minutes secondsTemp |
|
| hours minutes secondsTemp |
|
||||||
hours := self hours.
|
hours := self hours.
|
||||||
minutes := self minutes.
|
minutes := self minutes.
|
||||||
secondsTemp := self seconds.
|
secondsTemp := self seconds.
|
||||||
^ (self dayMonthYearDo: [ :d :m :y |
|
^ (self dayMonthYearDo: [ :d :m :y |
|
||||||
y asString,
|
y asString,
|
||||||
(m < 10
|
(m < 10
|
||||||
ifTrue: [ '0', m asString ]
|
ifTrue: [ '0', m asString ]
|
||||||
ifFalse: [ m asString]),
|
ifFalse: [ m asString]),
|
||||||
(d < 10
|
(d < 10
|
||||||
ifTrue: [ '0', d asString ]
|
ifTrue: [ '0', d asString ]
|
||||||
ifFalse: [ d asString])]),
|
ifFalse: [ d asString])]),
|
||||||
(hours < 10
|
(hours < 10
|
||||||
ifTrue: [ '0',hours asString ]
|
ifTrue: [ '0',hours asString ]
|
||||||
ifFalse: [ hours asString]),
|
ifFalse: [ hours asString]),
|
||||||
(minutes < 10
|
(minutes < 10
|
||||||
ifTrue: [ '0', minutes asString ]
|
ifTrue: [ '0', minutes asString ]
|
||||||
ifFalse: [ minutes asString]),
|
ifFalse: [ minutes asString]),
|
||||||
(secondsTemp < 10
|
(secondsTemp < 10
|
||||||
ifTrue: [ '0', secondsTemp asString ]
|
ifTrue: [ '0', secondsTemp asString ]
|
||||||
ifFalse: [ secondsTemp asString]),
|
ifFalse: [ secondsTemp asString]),
|
||||||
(self nanoSecond asString copyFrom: 1 to: 3)
|
(self nanoSecond asString copyFrom: 1 to: 3)
|
||||||
]
|
]
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : #FedWikiItem,
|
#name : #FedWikiItem,
|
||||||
#superclass : #Object,
|
#superclass : #Object,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'text',
|
'text',
|
||||||
'id',
|
'id',
|
||||||
'type'
|
'type'
|
||||||
],
|
],
|
||||||
#category : 'TiddlyWiki-Model'
|
#category : 'TiddlyWiki-Model'
|
||||||
}
|
}
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiItem >> fromDictionary: aDictionary [
|
FedWikiItem >> fromDictionary: aDictionary [
|
||||||
text := aDictionary at: 'text'.
|
text := aDictionary at: 'text'.
|
||||||
id := aDictionary at: 'id'.
|
id := aDictionary at: 'id'.
|
||||||
type := aDictionary at: 'type'.
|
type := aDictionary at: 'type'.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiItem >> printOn: aStream [
|
FedWikiItem >> printOn: aStream [
|
||||||
super printOn: aStream.
|
super printOn: aStream.
|
||||||
aStream
|
aStream
|
||||||
nextPutAll: '( ',self type, ' | ', self text, ' )'
|
nextPutAll: '( ',self type, ' | ', self text, ' )'
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiItem >> text [
|
FedWikiItem >> text [
|
||||||
^ text
|
^ text
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiItem >> type [
|
FedWikiItem >> type [
|
||||||
^ type
|
^ type
|
||||||
]
|
]
|
||||||
|
@ -1,98 +1,98 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : #FedWikiPage,
|
#name : #FedWikiPage,
|
||||||
#superclass : #Object,
|
#superclass : #Object,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'url',
|
'url',
|
||||||
'title',
|
'title',
|
||||||
'story',
|
'story',
|
||||||
'journal',
|
'journal',
|
||||||
'importJournal'
|
'importJournal'
|
||||||
],
|
],
|
||||||
#category : #'TiddlyWiki-Model'
|
#category : #'TiddlyWiki-Model'
|
||||||
}
|
}
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> dataDictionary [
|
FedWikiPage >> dataDictionary [
|
||||||
| dataUrl |
|
| dataUrl |
|
||||||
self isView ifFalse: [
|
self isView ifFalse: [
|
||||||
self inform: 'Please provide a view url for the FedWiki page.'.
|
self inform: 'Please provide a view url for the FedWiki page.'.
|
||||||
^ self].
|
^ self].
|
||||||
dataUrl := self scheme , '://', self host, '/', self titleSegmentUrl, '.json'.
|
dataUrl := self scheme , '://', self host, '/', self titleSegmentUrl, '.json'.
|
||||||
^ STONJSON fromString: dataUrl asUrl retrieveContents
|
^ STONJSON fromString: dataUrl asUrl retrieveContents
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> fromDataDictionary [
|
FedWikiPage >> fromDataDictionary [
|
||||||
title := self title.
|
title := self title.
|
||||||
story := self story.
|
story := self story.
|
||||||
self importJournal ifTrue: [ journal := self dataDictionary at: 'journal'].
|
self importJournal ifTrue: [ journal := self dataDictionary at: 'journal'].
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> host [
|
FedWikiPage >> host [
|
||||||
^ self url host
|
^ self url host
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> importJournal [
|
FedWikiPage >> importJournal [
|
||||||
^ importJournal ifNil: [ importJournal := false ]
|
^ importJournal ifNil: [ importJournal := false ]
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> importJournal: aBoolean [
|
FedWikiPage >> importJournal: aBoolean [
|
||||||
importJournal := aBoolean
|
importJournal := aBoolean
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> isView [
|
FedWikiPage >> isView [
|
||||||
^ self url firstPathSegment = 'view'
|
^ self url firstPathSegment = 'view'
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> jsonData [
|
FedWikiPage >> jsonData [
|
||||||
| dataUrl |
|
| dataUrl |
|
||||||
self isView ifFalse: [
|
self isView ifFalse: [
|
||||||
self inform: 'Please provide a view url for the FedWiki page.'.
|
self inform: 'Please provide a view url for the FedWiki page.'.
|
||||||
^ self].
|
^ self].
|
||||||
dataUrl := self scheme , '://', self host, self titleSegmentUrl, '.json'
|
dataUrl := self scheme , '://', self host, self titleSegmentUrl, '.json'
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> printOn: aStream [
|
FedWikiPage >> printOn: aStream [
|
||||||
super printOn: aStream.
|
super printOn: aStream.
|
||||||
aStream
|
aStream
|
||||||
nextPutAll: '( ', self title, ' | ', self story size asString, ' items story )'
|
nextPutAll: '( ', self title, ' | ', self story size asString, ' items story )'
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> scheme [
|
FedWikiPage >> scheme [
|
||||||
^ self url scheme
|
^ self url scheme
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> story [
|
FedWikiPage >> story [
|
||||||
^ self dataDictionary at: 'story'
|
^ self dataDictionary at: 'story'
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> title [
|
FedWikiPage >> title [
|
||||||
^ self dataDictionary at: 'title'
|
^ self dataDictionary at: 'title'
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> titleSegmentUrl [
|
FedWikiPage >> titleSegmentUrl [
|
||||||
self isView ifFalse: [
|
self isView ifFalse: [
|
||||||
self inform: 'Please provide a view url for the FedWiki page.'.
|
self inform: 'Please provide a view url for the FedWiki page.'.
|
||||||
^ self].
|
^ self].
|
||||||
^ self url segments last.
|
^ self url segments last.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> url [
|
FedWikiPage >> url [
|
||||||
^ url
|
^ url
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> url: aString [
|
FedWikiPage >> url: aString [
|
||||||
url := aString asZnUrl
|
url := aString asZnUrl
|
||||||
]
|
]
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
"
|
"
|
||||||
Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
|
Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
|
||||||
"
|
"
|
||||||
Class {
|
Class {
|
||||||
#name : #ManifestTiddlyWiki,
|
#name : #ManifestTiddlyWiki,
|
||||||
#superclass : #PackageManifest,
|
#superclass : #PackageManifest,
|
||||||
#category : #'TiddlyWiki-Manifest'
|
#category : #'TiddlyWiki-Manifest'
|
||||||
}
|
}
|
||||||
|
|
||||||
{ #category : #'code-critics' }
|
{ #category : #'code-critics' }
|
||||||
ManifestTiddlyWiki class >> ruleLongMethodsRuleV1FalsePositive [
|
ManifestTiddlyWiki class >> ruleLongMethodsRuleV1FalsePositive [
|
||||||
^ #(#(#(#RGMethodDefinition #(#Tiddler #fromDictionary: #false)) #'2022-09-01T15:34:03.846371-05:00') )
|
^ #(#(#(#RGMethodDefinition #(#Tiddler #fromDictionary: #false)) #'2022-09-01T15:34:03.846371-05:00') )
|
||||||
]
|
]
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
Extension { #name : #OrderedDictionary }
|
Extension { #name : #OrderedDictionary }
|
||||||
|
|
||||||
{ #category : #'*TiddlyWiki' }
|
{ #category : #'*TiddlyWiki' }
|
||||||
OrderedDictionary >> asTiddler [
|
OrderedDictionary >> asTiddler [
|
||||||
| tiddlerFields response |
|
| tiddlerFields response |
|
||||||
response := Tiddler new.
|
response := Tiddler new.
|
||||||
tiddlerFields := response class slotNames copyWithoutAll: #('wiki' 'customFields').
|
tiddlerFields := response class slotNames copyWithoutAll: #('wiki' 'customFields').
|
||||||
self keysAndValuesDo: [ :key :value |
|
self keysAndValuesDo: [ :key :value |
|
||||||
(tiddlerFields includes: key)
|
(tiddlerFields includes: key)
|
||||||
ifFalse: [
|
ifFalse: [
|
||||||
response customFields at: key put: value ]
|
response customFields at: key put: value ]
|
||||||
ifTrue: [ response writeSlotNamed: key value: value ]
|
ifTrue: [ response writeSlotNamed: key value: value ]
|
||||||
].
|
].
|
||||||
^ response
|
^ response
|
||||||
]
|
]
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
Extension { #name : #String }
|
Extension { #name : #String }
|
||||||
|
|
||||||
{ #category : #'*TiddlyWiki' }
|
{ #category : #'*TiddlyWiki' }
|
||||||
String >> asDateAndTimeForTiddler [
|
String >> asDateAndTimeForTiddler [
|
||||||
|
|
||||||
| date |
|
| date |
|
||||||
date := OrderedCollection new.
|
date := OrderedCollection new.
|
||||||
1 to: 4 do: [ :i | date add: (self at: i) ].
|
1 to: 4 do: [ :i | date add: (self at: i) ].
|
||||||
date add: '-'.
|
date add: '-'.
|
||||||
5 to: 6 do: [ :i | date add: (self at: i) ].
|
5 to: 6 do: [ :i | date add: (self at: i) ].
|
||||||
date add: '-'.
|
date add: '-'.
|
||||||
7 to: 8 do: [ :i | date add: (self at: i) ].
|
7 to: 8 do: [ :i | date add: (self at: i) ].
|
||||||
date add: 'T'.
|
date add: 'T'.
|
||||||
9 to: 10 do: [ :i | date add: (self at: i) ].
|
9 to: 10 do: [ :i | date add: (self at: i) ].
|
||||||
date add: ':'.
|
date add: ':'.
|
||||||
11 to: 12 do: [ :i | date add: (self at: i) ].
|
11 to: 12 do: [ :i | date add: (self at: i) ].
|
||||||
date add: ':'.
|
date add: ':'.
|
||||||
13 to: 14 do: [ :i | date add: (self at: i) ].
|
13 to: 14 do: [ :i | date add: (self at: i) ].
|
||||||
date add: '.'.
|
date add: '.'.
|
||||||
15 to: 17 do: [ :i | date add: (self at: i) ].
|
15 to: 17 do: [ :i | date add: (self at: i) ].
|
||||||
^ ((date joinUsing: ''), '+00:00') asDateAndTime
|
^ ((date joinUsing: ''), '+00:00') asDateAndTime
|
||||||
]
|
]
|
||||||
|
@ -1,139 +1,139 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : #TWSeed,
|
#name : #TWSeed,
|
||||||
#superclass : #Object,
|
#superclass : #Object,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'name',
|
'name',
|
||||||
'demo'
|
'demo'
|
||||||
],
|
],
|
||||||
#classVars : [
|
#classVars : [
|
||||||
'list'
|
'list'
|
||||||
],
|
],
|
||||||
#category : #'TiddlyWiki-Model'
|
#category : #'TiddlyWiki-Model'
|
||||||
}
|
}
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeed class >> default [
|
TWSeed class >> default [
|
||||||
|
|
||||||
^ self selectSeed: 'ProjectifyMod'
|
^ self selectSeed: 'ProjectifyMod'
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeed class >> deleteWikiFileFromFolder: folder andSubfolder: shortName [
|
TWSeed class >> deleteWikiFileFromFolder: folder andSubfolder: shortName [
|
||||||
|
|
||||||
| file |
|
| file |
|
||||||
file := folder / shortName / 'index.html'.
|
file := folder / shortName / 'index.html'.
|
||||||
file exists ifFalse: [^ self].
|
file exists ifFalse: [^ self].
|
||||||
^ file ensureDelete.
|
^ file ensureDelete.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeed class >> initialize [
|
TWSeed class >> initialize [
|
||||||
|
|
||||||
super initialize.
|
super initialize.
|
||||||
list := OrderedCollection new.
|
list := OrderedCollection new.
|
||||||
list
|
list
|
||||||
add: (self new
|
add: (self new
|
||||||
name: 'ProjectifyMod';
|
name: 'ProjectifyMod';
|
||||||
demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/projectify/projectify-mod.html');
|
demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/projectify/projectify-mod.html');
|
||||||
add: (self new
|
add: (self new
|
||||||
name: 'Wikilexias';
|
name: 'Wikilexias';
|
||||||
demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/wikilexias/wikilexias.html');
|
demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/wikilexias/wikilexias.html');
|
||||||
add: (self new
|
add: (self new
|
||||||
name: 'NotebookMod';
|
name: 'NotebookMod';
|
||||||
demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/notebook/notebook-mod.html');
|
demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/notebook/notebook-mod.html');
|
||||||
add: (self new
|
add: (self new
|
||||||
name: 'Grafoscopedia';
|
name: 'Grafoscopedia';
|
||||||
demo: 'https://mutabit.com/repos.fossil/grafoscopedia/uv/');
|
demo: 'https://mutabit.com/repos.fossil/grafoscopedia/uv/');
|
||||||
add: (self new
|
add: (self new
|
||||||
name: 'Holonica';
|
name: 'Holonica';
|
||||||
demo: 'https://mutabit.com/repos.fossil/holonica/uv/');
|
demo: 'https://mutabit.com/repos.fossil/holonica/uv/');
|
||||||
add: (self new
|
add: (self new
|
||||||
name: 'Krystal Whitespace';
|
name: 'Krystal Whitespace';
|
||||||
demo: 'https://krytsal-whitespace.tiddlyhost.com/').
|
demo: 'https://krytsal-whitespace.tiddlyhost.com/').
|
||||||
^ self
|
^ self
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeed class >> install: seedName into: folder as: shortName [
|
TWSeed class >> install: seedName into: folder as: shortName [
|
||||||
|
|
||||||
| file url seedFile subfolder |
|
| file url seedFile subfolder |
|
||||||
seedFile := self selectSeed: seedName.
|
seedFile := self selectSeed: seedName.
|
||||||
subfolder := (folder / shortName) ensureCreateDirectory.
|
subfolder := (folder / shortName) ensureCreateDirectory.
|
||||||
file := subfolder / 'index.html'.
|
file := subfolder / 'index.html'.
|
||||||
file exists
|
file exists
|
||||||
ifTrue: [ self inform: 'Index file in the wiki subfolder already exists. Please choose:
|
ifTrue: [ self inform: 'Index file in the wiki subfolder already exists. Please choose:
|
||||||
1 select another folder + shortName combination or
|
1 select another folder + shortName combination or
|
||||||
2 run:
|
2 run:
|
||||||
self deleteWikiFileFromFolder: folder andSubfolder: shortName.'.
|
self deleteWikiFileFromFolder: folder andSubfolder: shortName.'.
|
||||||
^ self
|
^ self
|
||||||
].
|
].
|
||||||
url := seedFile demo.
|
url := seedFile demo.
|
||||||
url asUrl saveContentsToFile: file.
|
url asUrl saveContentsToFile: file.
|
||||||
^ TiddlyWiki new
|
^ TiddlyWiki new
|
||||||
file: file;
|
file: file;
|
||||||
name: shortName.
|
name: shortName.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeed class >> installDefaultInto: folder as: shortName [
|
TWSeed class >> installDefaultInto: folder as: shortName [
|
||||||
|
|
||||||
^ self install: 'ProjectifyMod' into: folder as: shortName
|
^ self install: 'ProjectifyMod' into: folder as: shortName
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeed class >> list [
|
TWSeed class >> list [
|
||||||
|
|
||||||
^ list
|
^ list
|
||||||
ifNil: [ self initialize.
|
ifNil: [ self initialize.
|
||||||
^ self list.
|
^ self list.
|
||||||
]
|
]
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeed class >> preview: wikiSeedName [
|
TWSeed class >> preview: wikiSeedName [
|
||||||
|
|
||||||
WebBrowser openOn: (self selectSeed: wikiSeedName) demo.
|
WebBrowser openOn: (self selectSeed: wikiSeedName) demo.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeed class >> selectSeed: aSeedName [
|
TWSeed class >> selectSeed: aSeedName [
|
||||||
|
|
||||||
^ (self list select: [ :seed | seed name = aSeedName ]) first
|
^ (self list select: [ :seed | seed name = aSeedName ]) first
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeed >> demo [
|
TWSeed >> demo [
|
||||||
|
|
||||||
^ demo
|
^ demo
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeed >> demo: anUrl [
|
TWSeed >> demo: anUrl [
|
||||||
|
|
||||||
demo := anUrl asZnUrl
|
demo := anUrl asZnUrl
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeed >> name [
|
TWSeed >> name [
|
||||||
^ name
|
^ name
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeed >> name: aString [
|
TWSeed >> name: aString [
|
||||||
name := aString
|
name := aString
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeed >> preview: anObject [
|
TWSeed >> preview: anObject [
|
||||||
|
|
||||||
^ demo := anObject
|
^ demo := anObject
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeed >> printOn: aStream [
|
TWSeed >> printOn: aStream [
|
||||||
super printOn: aStream.
|
super printOn: aStream.
|
||||||
aStream
|
aStream
|
||||||
nextPutAll: '( ', self name, ' )'
|
nextPutAll: '( ', self name, ' )'
|
||||||
]
|
]
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : #TWSeedTest,
|
#name : #TWSeedTest,
|
||||||
#superclass : #TestCase,
|
#superclass : #TestCase,
|
||||||
#category : #'TiddlyWiki-TiddlyWiki'
|
#category : #'TiddlyWiki-TiddlyWiki'
|
||||||
}
|
}
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeedTest >> testCreateAlternativeSeed [
|
TWSeedTest >> testCreateAlternativeSeed [
|
||||||
|
|
||||||
| seed folder |
|
| seed folder |
|
||||||
folder := FileLocator temp / 'Wikilexias'.
|
folder := FileLocator temp / 'Wikilexias'.
|
||||||
folder ensureDeleteAll.
|
folder ensureDeleteAll.
|
||||||
seed := TWSeed install: 'Wikilexias' into: FileLocator temp as: 'Wikilexias'.
|
seed := TWSeed install: 'Wikilexias' into: FileLocator temp as: 'Wikilexias'.
|
||||||
self assert: seed file equals: (FileLocator temp / 'Wikilexias' / 'index.html')
|
self assert: seed file equals: (FileLocator temp / 'Wikilexias' / 'index.html')
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeedTest >> testDefaultIsSeed [
|
TWSeedTest >> testDefaultIsSeed [
|
||||||
|
|
||||||
| seed |
|
| seed |
|
||||||
seed := TWSeed default.
|
seed := TWSeed default.
|
||||||
self assert: seed class equals: TWSeed
|
self assert: seed class equals: TWSeed
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWSeedTest >> testListIsNotEmpty [
|
TWSeedTest >> testListIsNotEmpty [
|
||||||
|
|
||||||
| seed |
|
| seed |
|
||||||
seed := TWSeed list.
|
seed := TWSeed list.
|
||||||
self assert: seed size >= 1
|
self assert: seed size >= 1
|
||||||
]
|
]
|
||||||
|
@ -1,77 +1,77 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : #TWServer,
|
#name : #TWServer,
|
||||||
#superclass : #Object,
|
#superclass : #Object,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'wikis',
|
'wikis',
|
||||||
'webServer'
|
'webServer'
|
||||||
],
|
],
|
||||||
#category : #TiddlyWiki
|
#category : #TiddlyWiki
|
||||||
}
|
}
|
||||||
|
|
||||||
{ #category : #'instance creation' }
|
{ #category : #'instance creation' }
|
||||||
TWServer class >> new [
|
TWServer class >> new [
|
||||||
|
|
||||||
| instance |
|
| instance |
|
||||||
instance := super new.
|
instance := super new.
|
||||||
^ instance
|
^ instance
|
||||||
wikis: Dictionary new;
|
wikis: Dictionary new;
|
||||||
webServer: TLWebserver new
|
webServer: TLWebserver new
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'export - json' }
|
{ #category : #'export - json' }
|
||||||
TWServer >> exportTiddlersFrom: aWikiName tagged: aTag into: aFolder [
|
TWServer >> exportTiddlersFrom: aWikiName tagged: aTag into: aFolder [
|
||||||
|
|
||||||
| wiki |
|
| wiki |
|
||||||
wiki := wikis at: aWikiName.
|
wiki := wikis at: aWikiName.
|
||||||
^ wiki exportJSONTiddlersTagged: aTag in: aFolder
|
^ wiki exportJSONTiddlersTagged: aTag in: aFolder
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWServer >> initWikiTagDynamicRoute [
|
TWServer >> initWikiTagDynamicRoute [
|
||||||
|
|
||||||
webServer teapot
|
webServer teapot
|
||||||
GET: '/<wiki>/<tag>' -> [ :req | (self exportTiddlersFrom: (req at: #wiki) tagged: (req at: #tag) into: FileLocator temp) contents ];
|
GET: '/<wiki>/<tag>' -> [ :req | (self exportTiddlersFrom: (req at: #wiki) tagged: (req at: #tag) into: FileLocator temp) contents ];
|
||||||
output: #text
|
output: #text
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWServer >> port: aPortInteger [
|
TWServer >> port: aPortInteger [
|
||||||
|
|
||||||
webServer configuration: { #port -> aPortInteger };
|
webServer configuration: { #port -> aPortInteger };
|
||||||
refreshTeapot
|
refreshTeapot
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWServer >> removeAllDynamicRoutes [
|
TWServer >> removeAllDynamicRoutes [
|
||||||
|
|
||||||
webServer teapot removeAllDynamicRoutes
|
webServer teapot removeAllDynamicRoutes
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWServer >> startAndBrowse [
|
TWServer >> startAndBrowse [
|
||||||
|
|
||||||
webServer start.
|
webServer start.
|
||||||
webServer teapot browse
|
webServer teapot browse
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWServer >> webServer: aTealightWebServer [
|
TWServer >> webServer: aTealightWebServer [
|
||||||
|
|
||||||
webServer := aTealightWebServer
|
webServer := aTealightWebServer
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWServer >> wikiNames [
|
TWServer >> wikiNames [
|
||||||
|
|
||||||
| return |
|
| return |
|
||||||
return := OrderedCollection new.
|
return := OrderedCollection new.
|
||||||
wikis keysDo: [ :key | return add: key ].
|
wikis keysDo: [ :key | return add: key ].
|
||||||
^ return
|
^ return
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWServer >> wikis: aTiddlyWikisDictionary [
|
TWServer >> wikis: aTiddlyWikisDictionary [
|
||||||
|
|
||||||
wikis := aTiddlyWikisDictionary
|
wikis := aTiddlyWikisDictionary
|
||||||
]
|
]
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,13 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : #TiddlerTest,
|
#name : #TiddlerTest,
|
||||||
#superclass : #TestCase,
|
#superclass : #TestCase,
|
||||||
#category : #'TiddlyWiki-TiddlyWiki'
|
#category : #'TiddlyWiki-TiddlyWiki'
|
||||||
}
|
}
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TiddlerTest >> testTiddlerTimeFormatTrasnformation [
|
TiddlerTest >> testTiddlerTimeFormatTrasnformation [
|
||||||
|
|
||||||
| tiddlerTemp |
|
| tiddlerTemp |
|
||||||
tiddlerTemp := Tiddler new created: '20220101010101123'.
|
tiddlerTemp := Tiddler new created: '20220101010101123'.
|
||||||
self assert: tiddlerTemp created equals: tiddlerTemp created asDateAndTimeForTiddler asTiddlerFormat
|
self assert: tiddlerTemp created equals: tiddlerTemp created asDateAndTimeForTiddler asTiddlerFormat
|
||||||
]
|
]
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,14 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : #TiddlyWikiExamples,
|
#name : #TiddlyWikiExamples,
|
||||||
#superclass : #Object,
|
#superclass : #Object,
|
||||||
#category : #'TiddlyWiki-Model'
|
#category : #'TiddlyWiki-Model'
|
||||||
}
|
}
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TiddlyWikiExamples >> createDefaultWiki [
|
TiddlyWikiExamples >> createDefaultWiki [
|
||||||
<gtExample>
|
<gtExample>
|
||||||
<description: 'I create a wiki with the default seed as a temporal file.'>
|
<description: 'I create a wiki with the default seed as a temporal file.'>
|
||||||
|
|
||||||
TWSeed deleteWikiFileFromFolder: FileLocator temp andSubfolder: 'test'.
|
TWSeed deleteWikiFileFromFolder: FileLocator temp andSubfolder: 'test'.
|
||||||
^ TWSeed installDefaultInto: FileLocator temp as: 'test'
|
^ TWSeed installDefaultInto: FileLocator temp as: 'test'
|
||||||
]
|
]
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
Extension { #name : #WebVideo }
|
Extension { #name : #WebVideo }
|
||||||
|
|
||||||
{ #category : #'*TiddlyWiki' }
|
{ #category : #'*TiddlyWiki' }
|
||||||
WebVideo >> asTiddler [
|
WebVideo >> asTiddler [
|
||||||
| tiddler body |
|
| tiddler body |
|
||||||
tiddler := Tiddler new
|
tiddler := Tiddler new
|
||||||
title: self title.
|
title: self title.
|
||||||
tiddler customFields
|
tiddler customFields
|
||||||
at: 'uid' put: self videoId;
|
at: 'uid' put: self videoId;
|
||||||
at: 'author' put: self author;
|
at: 'author' put: self author;
|
||||||
at: 'authorId' put: self authorId;
|
at: 'authorId' put: self authorId;
|
||||||
at: 'duration' put: self duration.
|
at: 'duration' put: self duration.
|
||||||
body := '' writeStream.
|
body := '' writeStream.
|
||||||
body
|
body
|
||||||
nextPutAll: '<<richlink "https://www.youtube.com/watch?v=', self videoId ,'">>';
|
nextPutAll: '<<richlink "https://www.youtube.com/watch?v=', self videoId ,'">>';
|
||||||
nextPutAll: '
|
nextPutAll: '
|
||||||
|
|
||||||
* ''''Duración:'''' {{!!duration}}
|
* ''''Duración:'''' {{!!duration}}
|
||||||
* ''''Autor/a:'''' {{!!author}}'.
|
* ''''Autor/a:'''' {{!!author}}'.
|
||||||
tiddler text: body contents withInternetLineEndings.
|
tiddler text: body contents withInternetLineEndings.
|
||||||
|
|
||||||
^ tiddler
|
^ tiddler
|
||||||
]
|
]
|
||||||
|
@ -1,53 +1,53 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : #WikiText,
|
#name : #WikiText,
|
||||||
#superclass : #Object,
|
#superclass : #Object,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'content'
|
'content'
|
||||||
],
|
],
|
||||||
#category : 'TiddlyWiki-Model'
|
#category : 'TiddlyWiki-Model'
|
||||||
}
|
}
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
WikiText >> content [
|
WikiText >> content [
|
||||||
^ content
|
^ content
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
WikiText >> content: aString [
|
WikiText >> content: aString [
|
||||||
content := aString
|
content := aString
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #conversions }
|
{ #category : #conversions }
|
||||||
WikiText >> converMarkdownBold [
|
WikiText >> converMarkdownBold [
|
||||||
self content: (self content copyReplaceAll: '**' with: '''''').
|
self content: (self content copyReplaceAll: '**' with: '''''').
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #conversions }
|
{ #category : #conversions }
|
||||||
WikiText >> convertMarkdownBold [
|
WikiText >> convertMarkdownBold [
|
||||||
self content: (self content copyReplaceAll: '**' with: '''''').
|
self content: (self content copyReplaceAll: '**' with: '''''').
|
||||||
^ self.
|
^ self.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #conversions }
|
{ #category : #conversions }
|
||||||
WikiText >> convertMarkdownLinks [
|
WikiText >> convertMarkdownLinks [
|
||||||
| markdownLinks markdownLinksRegex |
|
| markdownLinks markdownLinksRegex |
|
||||||
"\[([\w|\s]+)\]\((\S+)\)"
|
"\[([\w|\s]+)\]\((\S+)\)"
|
||||||
markdownLinksRegex := '\[([\w|\s]+)\]\((\S+)\)'.
|
markdownLinksRegex := '\[([\w|\s]+)\]\((\S+)\)'.
|
||||||
"For the explanation of the Regex details see: http://scottradcliff.com/how-to-parse-urls-in-markdown.html"
|
"For the explanation of the Regex details see: http://scottradcliff.com/how-to-parse-urls-in-markdown.html"
|
||||||
markdownLinks := self content regex: markdownLinksRegex matchesCollect: [:link | link ].
|
markdownLinks := self content regex: markdownLinksRegex matchesCollect: [:link | link ].
|
||||||
markdownLinks ifEmpty: [ ^ self content ].
|
markdownLinks ifEmpty: [ ^ self content ].
|
||||||
markdownLinks do: [:markdownLink | | linkText closingLinkIndex newContent |
|
markdownLinks do: [:markdownLink | | linkText closingLinkIndex newContent |
|
||||||
closingLinkIndex := markdownLink indexOf: $].
|
closingLinkIndex := markdownLink indexOf: $].
|
||||||
linkText := markdownLink copyFrom: 2 to: closingLinkIndex.
|
linkText := markdownLink copyFrom: 2 to: closingLinkIndex.
|
||||||
newContent := self content copyReplaceAll: markdownLink with: '[[', linkText, ']'.
|
newContent := self content copyReplaceAll: markdownLink with: '[[', linkText, ']'.
|
||||||
self content: newContent.
|
self content: newContent.
|
||||||
].
|
].
|
||||||
^ self content
|
^ self content
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
WikiText >> sample [
|
WikiText >> sample [
|
||||||
^ 'The ''quick'' brown ~~flea~~ fox //jumps// over the `lazy` dog.
|
^ 'The ''quick'' brown ~~flea~~ fox //jumps// over the `lazy` dog.
|
||||||
|
|
||||||
This is a link to HelloThere, and one to [[History of TiddlyWiki]] and [[other link]].'
|
This is a link to HelloThere, and one to [[History of TiddlyWiki]] and [[other link]].'
|
||||||
]
|
]
|
||||||
|
@ -1,47 +1,47 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : #WikiTextGrammar,
|
#name : #WikiTextGrammar,
|
||||||
#superclass : #PP2CompositeNode,
|
#superclass : #PP2CompositeNode,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'document',
|
'document',
|
||||||
'link',
|
'link',
|
||||||
'linkOpen',
|
'linkOpen',
|
||||||
'linkContent',
|
'linkContent',
|
||||||
'linkClose'
|
'linkClose'
|
||||||
],
|
],
|
||||||
#category : 'TiddlyWiki-Model'
|
#category : 'TiddlyWiki-Model'
|
||||||
}
|
}
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
WikiTextGrammar >> document [
|
WikiTextGrammar >> document [
|
||||||
^ link islandInSea star
|
^ link islandInSea star
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
WikiTextGrammar >> link [
|
WikiTextGrammar >> link [
|
||||||
^ linkOpen, linkContent, linkClose ==> #second
|
^ linkOpen, linkContent, linkClose ==> #second
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
WikiTextGrammar >> linkClose [
|
WikiTextGrammar >> linkClose [
|
||||||
^ ']]' asPParser
|
^ ']]' asPParser
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
WikiTextGrammar >> linkContent [
|
WikiTextGrammar >> linkContent [
|
||||||
^ #any asPParser starLazy flatten
|
^ #any asPParser starLazy flatten
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
WikiTextGrammar >> linkOpen [
|
WikiTextGrammar >> linkOpen [
|
||||||
^ '[[' asPParser
|
^ '[[' asPParser
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
WikiTextGrammar >> linkSea [
|
WikiTextGrammar >> linkSea [
|
||||||
^ link sea ==> #second
|
^ link sea ==> #second
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
WikiTextGrammar >> start [
|
WikiTextGrammar >> start [
|
||||||
^ document
|
^ document
|
||||||
]
|
]
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : #WikiTextGrammarTest,
|
#name : #WikiTextGrammarTest,
|
||||||
#superclass : #PP2CompositeNodeTest,
|
#superclass : #PP2CompositeNodeTest,
|
||||||
#category : 'TiddlyWiki-Model'
|
#category : 'TiddlyWiki-Model'
|
||||||
}
|
}
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
WikiTextGrammarTest >> parserClass [
|
WikiTextGrammarTest >> parserClass [
|
||||||
^ WikiTextGrammar
|
^ WikiTextGrammar
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
WikiTextGrammarTest >> testDocument [
|
WikiTextGrammarTest >> testDocument [
|
||||||
| input |
|
| input |
|
||||||
input := WikiText new sample.
|
input := WikiText new sample.
|
||||||
self parse: input rule: #document.
|
self parse: input rule: #document.
|
||||||
self assert: result size equals: 2
|
self assert: result size equals: 2
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
WikiTextGrammarTest >> testLink [
|
WikiTextGrammarTest >> testLink [
|
||||||
self
|
self
|
||||||
parse: '[[Just testing]]'
|
parse: '[[Just testing]]'
|
||||||
rule: #link
|
rule: #link
|
||||||
]
|
]
|
||||||
|
@ -1 +1 @@
|
|||||||
Package { #name : #TiddlyWiki }
|
Package { #name : #TiddlyWiki }
|
||||||
|
Loading…
Reference in New Issue
Block a user