2021-08-04 16:36:20 +00:00
|
|
|
Class {
|
2021-10-19 23:23:57 +00:00
|
|
|
#name : #FedWikiPage,
|
|
|
|
#superclass : #Object,
|
2021-08-04 16:36:20 +00:00
|
|
|
#instVars : [
|
2021-08-04 17:30:36 +00:00
|
|
|
'url',
|
|
|
|
'title',
|
|
|
|
'story',
|
2021-08-04 22:56:05 +00:00
|
|
|
'journal',
|
|
|
|
'importJournal'
|
2021-08-04 16:36:20 +00:00
|
|
|
],
|
2021-08-29 22:50:17 +00:00
|
|
|
#category : 'TiddlyWiki-Model'
|
2021-08-04 16:36:20 +00:00
|
|
|
}
|
|
|
|
|
2021-10-19 23:23:57 +00:00
|
|
|
{ #category : #accessing }
|
2021-08-04 17:30:36 +00:00
|
|
|
FedWikiPage >> dataDictionary [
|
|
|
|
| dataUrl |
|
|
|
|
self isView ifFalse: [
|
|
|
|
self inform: 'Please provide a view url for the FedWiki page.'.
|
|
|
|
^ self].
|
|
|
|
dataUrl := self scheme , '://', self host, '/', self titleSegmentUrl, '.json'.
|
|
|
|
^ STONJSON fromString: dataUrl asUrl retrieveContents
|
|
|
|
]
|
|
|
|
|
2021-10-19 23:23:57 +00:00
|
|
|
{ #category : #accessing }
|
2021-08-04 17:30:36 +00:00
|
|
|
FedWikiPage >> fromDataDictionary [
|
|
|
|
title := self dataDictionary at: 'title'.
|
|
|
|
story := self dataDictionary at: 'story'.
|
2021-08-04 22:56:05 +00:00
|
|
|
self importJournal ifTrue: [ journal := self dataDictionary at: 'journal'].
|
2021-08-04 17:30:36 +00:00
|
|
|
]
|
|
|
|
|
2021-10-19 23:23:57 +00:00
|
|
|
{ #category : #accessing }
|
2021-08-04 16:36:20 +00:00
|
|
|
FedWikiPage >> host [
|
|
|
|
^ self url host
|
|
|
|
]
|
|
|
|
|
2021-10-19 23:23:57 +00:00
|
|
|
{ #category : #accessing }
|
2021-08-04 22:56:05 +00:00
|
|
|
FedWikiPage >> importJournal [
|
|
|
|
^ importJournal ifNil: [ importJournal := false ]
|
|
|
|
]
|
|
|
|
|
2021-10-19 23:23:57 +00:00
|
|
|
{ #category : #accessing }
|
2021-08-04 22:56:05 +00:00
|
|
|
FedWikiPage >> importJournal: aBoolean [
|
|
|
|
importJournal := aBoolean
|
|
|
|
]
|
|
|
|
|
2021-10-19 23:23:57 +00:00
|
|
|
{ #category : #accessing }
|
2021-08-04 16:36:20 +00:00
|
|
|
FedWikiPage >> isView [
|
|
|
|
^ self url firstPathSegment = 'view'
|
|
|
|
]
|
|
|
|
|
2021-10-19 23:23:57 +00:00
|
|
|
{ #category : #accessing }
|
2021-08-04 17:30:36 +00:00
|
|
|
FedWikiPage >> jsonData [
|
|
|
|
| dataUrl |
|
|
|
|
self isView ifFalse: [
|
|
|
|
self inform: 'Please provide a view url for the FedWiki page.'.
|
|
|
|
^ self].
|
|
|
|
dataUrl := self scheme , '://', self host, self titleSegmentUrl, '.json'
|
|
|
|
]
|
|
|
|
|
2021-10-19 23:23:57 +00:00
|
|
|
{ #category : #accessing }
|
2021-08-04 17:30:36 +00:00
|
|
|
FedWikiPage >> printOn: aStream [
|
|
|
|
super printOn: aStream.
|
|
|
|
aStream
|
|
|
|
nextPutAll: '( ', self title, ' | ', self story size asString, ' items story )'
|
|
|
|
]
|
|
|
|
|
2021-10-19 23:23:57 +00:00
|
|
|
{ #category : #accessing }
|
2021-08-04 16:36:20 +00:00
|
|
|
FedWikiPage >> scheme [
|
|
|
|
^ self url scheme
|
|
|
|
]
|
|
|
|
|
2021-10-19 23:23:57 +00:00
|
|
|
{ #category : #accessing }
|
2021-08-04 17:30:36 +00:00
|
|
|
FedWikiPage >> story [
|
|
|
|
^ story
|
|
|
|
]
|
|
|
|
|
2021-10-19 23:23:57 +00:00
|
|
|
{ #category : #accessing }
|
2021-08-04 17:30:36 +00:00
|
|
|
FedWikiPage >> title [
|
|
|
|
^ title.
|
|
|
|
]
|
|
|
|
|
2021-10-19 23:23:57 +00:00
|
|
|
{ #category : #accessing }
|
2021-08-04 17:30:36 +00:00
|
|
|
FedWikiPage >> titleSegmentUrl [
|
|
|
|
self isView ifFalse: [
|
|
|
|
self inform: 'Please provide a view url for the FedWiki page.'.
|
|
|
|
^ self].
|
2021-08-04 22:56:05 +00:00
|
|
|
^ self url segments last.
|
2021-08-04 17:30:36 +00:00
|
|
|
]
|
|
|
|
|
2021-10-19 23:23:57 +00:00
|
|
|
{ #category : #accessing }
|
2021-08-04 16:36:20 +00:00
|
|
|
FedWikiPage >> url [
|
|
|
|
^ url
|
|
|
|
]
|
|
|
|
|
2021-10-19 23:23:57 +00:00
|
|
|
{ #category : #accessing }
|
2021-08-04 16:36:20 +00:00
|
|
|
FedWikiPage >> url: aString [
|
|
|
|
url := aString asZnUrl
|
|
|
|
]
|