2019-05-29 12:31:04 +00:00
|
|
|
"
|
|
|
|
I model the interface between a CodiMD (https://demo.codimd.org) documentation
|
|
|
|
server and Grafoscopio.
|
|
|
|
I enable the interaction between Grafoscopio notebooks and CodiMD documents,
|
|
|
|
so one document can start online (as a CodiMD pad) and continue as a Grafoscopio
|
|
|
|
notebook or viceversa.
|
|
|
|
"
|
|
|
|
Class {
|
2020-11-20 00:02:37 +00:00
|
|
|
#name : #HedgeDoc,
|
2019-05-29 12:31:04 +00:00
|
|
|
#superclass : #Object,
|
|
|
|
#instVars : [
|
|
|
|
'server',
|
2020-05-02 23:59:57 +00:00
|
|
|
'pad',
|
|
|
|
'contents',
|
|
|
|
'url'
|
2019-05-29 12:31:04 +00:00
|
|
|
],
|
|
|
|
#category : #'Grafoscopio-Utils'
|
|
|
|
}
|
|
|
|
|
|
|
|
{ #category : #'as yet unclassified' }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc class >> newDefault [
|
2019-05-29 12:31:04 +00:00
|
|
|
^ self new
|
|
|
|
defaultServer.
|
|
|
|
]
|
|
|
|
|
2020-08-29 01:24:25 +00:00
|
|
|
{ #category : #accessing }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> contents [
|
2020-08-29 01:24:25 +00:00
|
|
|
^ contents
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> contents: anObject [
|
2020-08-29 01:24:25 +00:00
|
|
|
contents := anObject
|
|
|
|
]
|
|
|
|
|
2019-05-29 12:31:04 +00:00
|
|
|
{ #category : #'as yet unclassified' }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> defaultServer [
|
2019-05-29 12:31:04 +00:00
|
|
|
self server: 'https://docutopia.tupale.co'.
|
|
|
|
]
|
|
|
|
|
2020-06-08 21:08:39 +00:00
|
|
|
{ #category : #'as yet unclassified' }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> htmlUrl [
|
2020-06-08 21:08:39 +00:00
|
|
|
| link |
|
|
|
|
link := self url copy.
|
|
|
|
link segments insert: 's' before: 1.
|
|
|
|
^ link
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'as yet unclassified' }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> importContents [
|
2020-06-08 21:08:39 +00:00
|
|
|
self contents: self retrieveContents
|
|
|
|
]
|
|
|
|
|
2019-05-29 12:31:04 +00:00
|
|
|
{ #category : #accessing }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> pad [
|
2019-05-29 12:31:04 +00:00
|
|
|
^ pad
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> pad: anObject [
|
2019-05-29 12:31:04 +00:00
|
|
|
pad := anObject
|
|
|
|
]
|
|
|
|
|
2020-06-08 21:08:39 +00:00
|
|
|
{ #category : #'as yet unclassified' }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> retrieveContents [
|
2020-06-08 21:08:39 +00:00
|
|
|
self url ifNil: [ ^ self ].
|
|
|
|
^ (self url addPathSegment: 'download') retrieveContents
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'as yet unclassified' }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> retrieveHtmlContents [
|
2020-06-08 21:08:39 +00:00
|
|
|
| htmlContents |
|
|
|
|
self url ifNil: [ ^ self ].
|
|
|
|
htmlContents := self htmlUrl.
|
|
|
|
^ htmlContents retrieveContents
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'as yet unclassified' }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> saveContentsToFile: aFileLocator [
|
2020-06-08 21:08:39 +00:00
|
|
|
self url ifNil: [ ^ self ].
|
|
|
|
^ (self url addPathSegment: 'download') saveContentsToFile: aFileLocator
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'as yet unclassified' }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> saveHtmlContentsToFile: aFileLocator [
|
2020-06-08 21:08:39 +00:00
|
|
|
self url ifNil: [ ^ self ].
|
|
|
|
^ self htmlUrl saveContentsToFile: aFileLocator
|
|
|
|
]
|
|
|
|
|
2019-05-29 12:31:04 +00:00
|
|
|
{ #category : #accessing }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> server [
|
2019-05-29 12:31:04 +00:00
|
|
|
^ server
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> server: aUrlString [
|
2019-05-29 12:31:04 +00:00
|
|
|
server := aUrlString
|
|
|
|
]
|
|
|
|
|
2020-05-02 23:59:57 +00:00
|
|
|
{ #category : #accessing }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> url [
|
2020-06-08 21:08:39 +00:00
|
|
|
^ url asUrl
|
2020-05-02 23:59:57 +00:00
|
|
|
]
|
|
|
|
|
2020-08-29 01:24:25 +00:00
|
|
|
{ #category : #accessing }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> url: anObject [
|
2020-08-29 01:24:25 +00:00
|
|
|
url := anObject
|
|
|
|
]
|
|
|
|
|
2019-05-29 12:31:04 +00:00
|
|
|
{ #category : #visiting }
|
2020-11-20 00:02:37 +00:00
|
|
|
HedgeDoc >> visit [
|
2020-06-14 18:19:41 +00:00
|
|
|
WebBrowser openOn: self server, '/', self pad.
|
2019-05-29 12:31:04 +00:00
|
|
|
]
|