2022-01-22 15:23:56 +00:00
|
|
|
Extension { #name : #LePage }
|
|
|
|
|
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
|
|
LePage >> asMarkdeep [
|
|
|
|
| bodyStream |
|
|
|
|
bodyStream := '' writeStream.
|
|
|
|
self preorderTraversal do: [:snippet |
|
2022-01-24 01:38:07 +00:00
|
|
|
bodyStream nextPutAll: snippet asMarkdeep
|
2022-01-22 15:23:56 +00:00
|
|
|
].
|
|
|
|
^ Markdeep new
|
2022-01-24 01:38:07 +00:00
|
|
|
title: self title;
|
2022-01-22 15:23:56 +00:00
|
|
|
body: bodyStream contents
|
|
|
|
contents.
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
|
|
LePage >> asMarkdeepInto: aFileLocator [
|
|
|
|
|
|
|
|
self preorderTraversal
|
|
|
|
]
|
2022-01-24 01:38:07 +00:00
|
|
|
|
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
|
|
LePage >> fileName [
|
|
|
|
^ self title asDashedLowercase, '.', ((self uidString copyFrom: 1 to: 5 ) copyWithoutAll: '/'), '.md.html'
|
|
|
|
]
|
|
|
|
|
2022-01-28 19:30:56 +00:00
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
|
|
LePage >> markdeepPreview [
|
|
|
|
^ self asMarkdeep exportAsFileOn: self markdeepTemporalFile
|
|
|
|
]
|
|
|
|
|
2022-01-24 01:38:07 +00:00
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
|
|
LePage >> markdeepTemporalFile [
|
2022-01-27 14:23:34 +00:00
|
|
|
| fileName sanitized |
|
|
|
|
sanitized := self title asDashedLowercase copyWithoutAll: #($/).
|
|
|
|
fileName := sanitized, '--',(self uidString copyFrom: 1 to: 5), '.md.html'.
|
2022-01-24 01:38:07 +00:00
|
|
|
^ FileLocator temp / fileName.
|
|
|
|
]
|
2022-01-27 14:23:34 +00:00
|
|
|
|
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
|
|
LePage >> metadata [
|
|
|
|
^ OrderedDictionary new
|
|
|
|
at: 'id' put: self uidString;
|
|
|
|
at: 'created' put: self createTime asString;
|
|
|
|
at: 'modified' put: self latestEditTime asString;
|
|
|
|
at: 'creator' put: self createEmail asString;
|
|
|
|
at: 'editor' put: self editEmail asString;
|
|
|
|
yourself.
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
|
|
LePage >> options [
|
|
|
|
^ options
|
|
|
|
]
|
2022-01-28 20:33:05 +00:00
|
|
|
|
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
|
|
LePage >> preorderTraversal [
|
|
|
|
| output |
|
|
|
|
output := OrderedCollection new.
|
|
|
|
self withDeepCollect: [:each | each allChildrenBreadthFirstDo: [:child | output add: child ] ].
|
|
|
|
^ output.
|
|
|
|
]
|