Adding FedWikiItems and making Journal importing optional.
This commit is contained in:
parent
638cb79d00
commit
d3a2ad15a3
34
repository/TiddlyWiki/FedWikiItem.class.st
Normal file
34
repository/TiddlyWiki/FedWikiItem.class.st
Normal file
@ -0,0 +1,34 @@
|
||||
Class {
|
||||
#name : #FedWikiItem,
|
||||
#superclass : #Object,
|
||||
#instVars : [
|
||||
'text',
|
||||
'id',
|
||||
'type'
|
||||
],
|
||||
#category : #'TiddlyWiki-Model'
|
||||
}
|
||||
|
||||
{ #category : #accessing }
|
||||
FedWikiItem >> fromDictionary: aDictionary [
|
||||
text := aDictionary at: 'text'.
|
||||
id := aDictionary at: 'id'.
|
||||
type := aDictionary at: 'type'.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FedWikiItem >> printOn: aStream [
|
||||
super printOn: aStream.
|
||||
aStream
|
||||
nextPutAll: '( ',self type, ' | ', self text, ' )'
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FedWikiItem >> text [
|
||||
^ text
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FedWikiItem >> type [
|
||||
^ type
|
||||
]
|
@ -5,7 +5,8 @@ Class {
|
||||
'url',
|
||||
'title',
|
||||
'story',
|
||||
'journal'
|
||||
'journal',
|
||||
'importJournal'
|
||||
],
|
||||
#category : #'TiddlyWiki-Model'
|
||||
}
|
||||
@ -24,7 +25,7 @@ FedWikiPage >> dataDictionary [
|
||||
FedWikiPage >> fromDataDictionary [
|
||||
title := self dataDictionary at: 'title'.
|
||||
story := self dataDictionary at: 'story'.
|
||||
journal := self dataDictionary at: 'journal'.
|
||||
self importJournal ifTrue: [ journal := self dataDictionary at: 'journal'].
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
@ -32,6 +33,16 @@ FedWikiPage >> host [
|
||||
^ self url host
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> importJournal [
|
||||
^ importJournal ifNil: [ importJournal := false ]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> importJournal: aBoolean [
|
||||
importJournal := aBoolean
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> isView [
|
||||
^ self url firstPathSegment = 'view'
|
||||
@ -73,7 +84,7 @@ FedWikiPage >> titleSegmentUrl [
|
||||
self isView ifFalse: [
|
||||
self inform: 'Please provide a view url for the FedWiki page.'.
|
||||
^ self].
|
||||
^ self url segments second.
|
||||
^ self url segments last.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
Loading…
Reference in New Issue
Block a user