2021-08-04 16:36:20 +00:00
|
|
|
Class {
|
|
|
|
#name : #FedWikiPage,
|
|
|
|
#superclass : #Object,
|
|
|
|
#instVars : [
|
2021-08-04 17:30:36 +00:00
|
|
|
'url',
|
|
|
|
'title',
|
|
|
|
'story',
|
|
|
|
'journal'
|
2021-08-04 16:36:20 +00:00
|
|
|
],
|
|
|
|
#category : #'TiddlyWiki-Model'
|
|
|
|
}
|
|
|
|
|
2021-08-04 17:30:36 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
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
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
FedWikiPage >> fromDataDictionary [
|
|
|
|
title := self dataDictionary at: 'title'.
|
|
|
|
story := self dataDictionary at: 'story'.
|
|
|
|
journal := self dataDictionary at: 'journal'.
|
|
|
|
]
|
|
|
|
|
2021-08-04 16:36:20 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FedWikiPage >> host [
|
|
|
|
^ self url host
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
FedWikiPage >> isView [
|
|
|
|
^ self url firstPathSegment = 'view'
|
|
|
|
]
|
|
|
|
|
2021-08-04 17:30:36 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
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'
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
FedWikiPage >> printOn: aStream [
|
|
|
|
super printOn: aStream.
|
|
|
|
aStream
|
|
|
|
nextPutAll: '( ', self title, ' | ', self story size asString, ' items story )'
|
|
|
|
]
|
|
|
|
|
2021-08-04 16:36:20 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FedWikiPage >> scheme [
|
|
|
|
^ self url scheme
|
|
|
|
]
|
|
|
|
|
2021-08-04 17:30:36 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FedWikiPage >> story [
|
|
|
|
^ story
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
FedWikiPage >> title [
|
|
|
|
^ title.
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
FedWikiPage >> titleSegmentUrl [
|
|
|
|
self isView ifFalse: [
|
|
|
|
self inform: 'Please provide a view url for the FedWiki page.'.
|
|
|
|
^ self].
|
|
|
|
^ self url segments second.
|
|
|
|
]
|
|
|
|
|
2021-08-04 16:36:20 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FedWikiPage >> url [
|
|
|
|
^ url
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
FedWikiPage >> url: aString [
|
|
|
|
url := aString asZnUrl
|
|
|
|
]
|