diff --git a/.project b/.project new file mode 100644 index 0000000..46c7795 --- /dev/null +++ b/.project @@ -0,0 +1,3 @@ +{ + 'srcDirectory' : 'repository' +} \ No newline at end of file diff --git a/repository/.properties b/repository/.properties new file mode 100644 index 0000000..ad0471d --- /dev/null +++ b/repository/.properties @@ -0,0 +1,3 @@ +{ + #format : #tonel +} \ No newline at end of file diff --git a/repository/TiddlyWiki/Tiddler.class.st b/repository/TiddlyWiki/Tiddler.class.st new file mode 100644 index 0000000..cf06d27 --- /dev/null +++ b/repository/TiddlyWiki/Tiddler.class.st @@ -0,0 +1,164 @@ +" +I model a Tiddler object in [TiddlyWiki](https://tiddlywiki.com/). + +I implement the standard fields as described in the standard documentation at: + +" +Class { + #name : #Tiddler, + #superclass : #Object, + #instVars : [ + 'title', + 'text', + 'modified', + 'mofier', + 'created', + 'creator', + 'tags', + 'type', + 'list', + 'caption' + ], + #category : #'TiddlyWiki-Model' +} + +{ #category : #accessing } +Tiddler >> caption [ + + ^ caption +] + +{ #category : #accessing } +Tiddler >> caption: anObject [ + + caption := anObject +] + +{ #category : #accessing } +Tiddler >> created [ + + ^ created +] + +{ #category : #accessing } +Tiddler >> created: anObject [ + + created := anObject +] + +{ #category : #accessing } +Tiddler >> creator [ + + ^ creator +] + +{ #category : #accessing } +Tiddler >> creator: anObject [ + + creator := anObject +] + +{ #category : #'instance creation' } +Tiddler >> fromMarkdownParsedItems: aCollection [ + | outputStream | + outputStream := '' writeStream. + aCollection children do: [ :each | + each children + ifEmpty: [ self itemContentsStringFor: each into: outputStream ] + ifNotEmpty: [ + each children do: [ :child | + self itemContentsStringFor: child into: outputStream ] ] + ] +] + +{ #category : #utilities } +Tiddler >> itemContentsStringFor: item into: stream [ + stream + nextPutAll: item text; + nextPut: Character cr; + nextPut: Character cr +] + +{ #category : #accessing } +Tiddler >> list [ + + ^ list +] + +{ #category : #accessing } +Tiddler >> list: anObject [ + + list := anObject +] + +{ #category : #accessing } +Tiddler >> modified [ + + ^ modified +] + +{ #category : #accessing } +Tiddler >> modified: anObject [ + + modified := anObject +] + +{ #category : #accessing } +Tiddler >> mofier [ + + ^ mofier +] + +{ #category : #accessing } +Tiddler >> mofier: anObject [ + + mofier := anObject +] + +{ #category : #accessing } +Tiddler >> tags [ + + ^ tags +] + +{ #category : #accessing } +Tiddler >> tags: anObject [ + + tags := anObject +] + +{ #category : #accessing } +Tiddler >> text [ + + ^ text +] + +{ #category : #accessing } +Tiddler >> text: anObject [ + + text := anObject +] + +{ #category : #accessing } +Tiddler >> title [ + + ^ title +] + +{ #category : #accessing } +Tiddler >> title: anObject [ + + title := anObject +] + +{ #category : #accessing } +Tiddler >> type [ + + ^ type +] + +{ #category : #accessing } +Tiddler >> type: anObject [ + + type := anObject +] diff --git a/repository/TiddlyWiki/TiddlyWiki.class.st b/repository/TiddlyWiki/TiddlyWiki.class.st new file mode 100644 index 0000000..bb0063e --- /dev/null +++ b/repository/TiddlyWiki/TiddlyWiki.class.st @@ -0,0 +1,45 @@ +" +I model a TiddlyWiki. +More information: + +https://tiddlywiki.com/ +" +Class { + #name : #TiddlyWiki, + #superclass : #Object, + #instVars : [ + 'tiddlers' + ], + #category : #'TiddlyWiki-Model' +} + +{ #category : #'instance creation' } +TiddlyWiki >> fromJSONString: aString [ + | rawData | + rawData := NeoJSONReader fromString: aString. + rawData do: [ :data | | temp | + temp := Tiddler new. + temp + modified: (data at: 'modified'); + created: (data at: 'created' ifAbsent: [ temp created: nil ]); + title: (data at: 'title'); + tags: (data at: 'tags' ifAbsent: [ temp tags: nil ]); + type: (data at: 'type' ifAbsent: [ temp type: nil ]); + caption: (data at: 'caption' ifAbsent: [ temp caption: nil ]); + text: (data at: 'text'). + self tiddlers add: temp. + ]. + +] + +{ #category : #accessing } +TiddlyWiki >> tiddlers [ + + ^ tiddlers ifNil: [ tiddlers := OrderedCollection new ] +] + +{ #category : #accessing } +TiddlyWiki >> tiddlers: anOrderedCollection [ + + tiddlers := anOrderedCollection +] diff --git a/repository/TiddlyWiki/package.st b/repository/TiddlyWiki/package.st new file mode 100644 index 0000000..e18b041 --- /dev/null +++ b/repository/TiddlyWiki/package.st @@ -0,0 +1 @@ +Package { #name : #TiddlyWiki }