Improving FedWiki <--> TiddlyWiki interaction.
This commit is contained in:
parent
f317287ed6
commit
638cb79d00
@ -2,11 +2,31 @@ Class {
|
|||||||
#name : #FedWikiPage,
|
#name : #FedWikiPage,
|
||||||
#superclass : #Object,
|
#superclass : #Object,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'url'
|
'url',
|
||||||
|
'title',
|
||||||
|
'story',
|
||||||
|
'journal'
|
||||||
],
|
],
|
||||||
#category : #'TiddlyWiki-Model'
|
#category : #'TiddlyWiki-Model'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ #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'.
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> host [
|
FedWikiPage >> host [
|
||||||
^ self url host
|
^ self url host
|
||||||
@ -17,11 +37,45 @@ FedWikiPage >> isView [
|
|||||||
^ self url firstPathSegment = 'view'
|
^ self url firstPathSegment = 'view'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #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 )'
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> scheme [
|
FedWikiPage >> scheme [
|
||||||
^ self url scheme
|
^ self url scheme
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #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.
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FedWikiPage >> url [
|
FedWikiPage >> url [
|
||||||
^ url
|
^ url
|
||||||
|
Loading…
Reference in New Issue
Block a user