Improved CodiMD support and abstracting operations with markup files.
This commit is contained in:
parent
9c7a9bb280
commit
b632b72da1
@ -38,6 +38,19 @@ CodiMD >> defaultServer [
|
||||
self server: 'https://docutopia.tupale.co'.
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
CodiMD >> htmlUrl [
|
||||
| link |
|
||||
link := self url copy.
|
||||
link segments insert: 's' before: 1.
|
||||
^ link
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
CodiMD >> importContents [
|
||||
self contents: self retrieveContents
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
CodiMD >> pad [
|
||||
^ pad
|
||||
@ -48,6 +61,32 @@ CodiMD >> pad: anObject [
|
||||
pad := anObject
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
CodiMD >> retrieveContents [
|
||||
self url ifNil: [ ^ self ].
|
||||
^ (self url addPathSegment: 'download') retrieveContents
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
CodiMD >> retrieveHtmlContents [
|
||||
| htmlContents |
|
||||
self url ifNil: [ ^ self ].
|
||||
htmlContents := self htmlUrl.
|
||||
^ htmlContents retrieveContents
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
CodiMD >> saveContentsToFile: aFileLocator [
|
||||
self url ifNil: [ ^ self ].
|
||||
^ (self url addPathSegment: 'download') saveContentsToFile: aFileLocator
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
CodiMD >> saveHtmlContentsToFile: aFileLocator [
|
||||
self url ifNil: [ ^ self ].
|
||||
^ self htmlUrl saveContentsToFile: aFileLocator
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
CodiMD >> server [
|
||||
^ server
|
||||
@ -60,7 +99,7 @@ CodiMD >> server: aUrlString [
|
||||
|
||||
{ #category : #accessing }
|
||||
CodiMD >> url [
|
||||
^ url
|
||||
^ url asUrl
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
@ -8,9 +8,11 @@ Class {
|
||||
}
|
||||
|
||||
{ #category : #persistence }
|
||||
MarkupFile class >> exportAsFileOn: aFileReference containing: contents [
|
||||
aFileReference exists ifFalse: [ aFileReference ensureCreateFile ].
|
||||
aFileReference writeStreamDo: [ :stream |
|
||||
MarkupFile class >> exportAsFileOn: aFileReferenceOrFileName containing: contents [
|
||||
| file |
|
||||
file := aFileReferenceOrFileName asFileReference.
|
||||
file exists ifFalse: [ file ensureCreateFile ].
|
||||
file writeStreamDo: [ :stream |
|
||||
stream nextPutAll: contents ].
|
||||
self inform: 'Exported as: ', String cr, aFileReference fullName
|
||||
self inform: 'Exported as: ', String cr, file fullName
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user