Improving importation and printing.
This commit is contained in:
parent
5b7fe3406d
commit
af8b05295e
@ -86,6 +86,20 @@ Tiddler >> creator: anObject [
|
||||
creator := anObject
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Tiddler >> fromDictionary: aDictionary [
|
||||
self
|
||||
title: (aDictionary at: 'title');
|
||||
text: (aDictionary at: 'text');
|
||||
tags: (aDictionary at: 'tags' ifAbsentPut: [ nil ]);
|
||||
created: (aDictionary at: 'created' ifAbsentPut: [ nil ]);
|
||||
creator: (aDictionary at: 'creator' ifAbsentPut: [ nil ]);
|
||||
modified: (aDictionary at: 'modified' ifAbsentPut: [ nil ]);
|
||||
modifier: (aDictionary at: 'modifier' ifAbsentPut: [ nil ]);
|
||||
type: (aDictionary at: 'type' ifAbsentPut: [ nil ]);
|
||||
caption: (aDictionary at: 'caption' ifAbsentPut: [ nil ]).
|
||||
]
|
||||
|
||||
{ #category : #'instance creation' }
|
||||
Tiddler >> fromMarkdownParsedItems: aCollection [
|
||||
| outputStream |
|
||||
|
@ -24,23 +24,19 @@ TiddlyWiki >> file: anObject [
|
||||
file := anObject
|
||||
]
|
||||
|
||||
{ #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 >> importJSONTiddlers [
|
||||
| tiddlersDict |
|
||||
self tiddlersJSONFile ifNil: [ ^ self ].
|
||||
tiddlersDict := STONJSON fromString: self tiddlersJSONFile contents.
|
||||
self tiddlers: (tiddlersDict collect: [:each | Tiddler new fromDictionary: each ])
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> printOn: aStream [
|
||||
super printOn: aStream.
|
||||
aStream
|
||||
nextPutAll: '( ', self file basename ,' )'
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
Loading…
Reference in New Issue
Block a user