Improving Markdeep exportation.
This commit is contained in:
parent
c5f71e8230
commit
abbafcf4e5
24
repository/Grafoscopio-Utils/LeModel.extension.st
Normal file
24
repository/Grafoscopio-Utils/LeModel.extension.st
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
Extension { #name : #LeModel }
|
||||||
|
|
||||||
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||||
|
LeModel >> metadata [
|
||||||
|
^ OrderedDictionary new
|
||||||
|
at: 'id' put: self uidString;
|
||||||
|
at: 'parent' put: self parent uidString;
|
||||||
|
at: 'created' put: self createTime asString;
|
||||||
|
at: 'edited' put: self latestEditTime asString;
|
||||||
|
at: 'creator' put: self createEmail asString;
|
||||||
|
at: 'editor' put: self editEmail asString;
|
||||||
|
yourself.
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||||
|
LeModel >> metadataDiv [
|
||||||
|
| output |
|
||||||
|
output := '' writeStream.
|
||||||
|
output
|
||||||
|
nextPutAll: '<div st-class="', self class asString, '"'; lf;
|
||||||
|
nextPutAll: ' st-data="', (STON toString: self metadata), '">'; lf.
|
||||||
|
^ output contents.
|
||||||
|
]
|
@ -20,6 +20,13 @@ LePage >> asMarkdeep [
|
|||||||
^ markdeep.
|
^ markdeep.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||||
|
LePage >> asMarkdeepFile [
|
||||||
|
| folder |
|
||||||
|
folder := self options at: 'storage' ifAbsent: [ FileLocator temp ].
|
||||||
|
^ self asMarkdeep exportAsFileOn: folder / self markdeepFileName
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||||
LePage >> asMarkdeepInto: aFileLocator [
|
LePage >> asMarkdeepInto: aFileLocator [
|
||||||
|
|
||||||
@ -32,16 +39,16 @@ LePage >> fileName [
|
|||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||||
LePage >> markdeepPreview [
|
LePage >> markdeepFileName [
|
||||||
^ self asMarkdeep exportAsFileOn: self markdeepTemporalFile
|
| sanitized |
|
||||||
|
sanitized := self title asDashedLowercase copyWithoutAll: #($/).
|
||||||
|
^ sanitized, '--',(self uidString copyFrom: 1 to: 5), '.md.html'.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||||
LePage >> markdeepTemporalFile [
|
LePage >> markdeepTemporalFile [
|
||||||
| fileName sanitized |
|
|
||||||
sanitized := self title asDashedLowercase copyWithoutAll: #($/).
|
^ FileLocator temp / self markdeepFileName.
|
||||||
fileName := sanitized, '--',(self uidString copyFrom: 1 to: 5), '.md.html'.
|
|
||||||
^ FileLocator temp / fileName.
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||||
|
26
repository/Grafoscopio-Utils/LePictureSnippet.extension.st
Normal file
26
repository/Grafoscopio-Utils/LePictureSnippet.extension.st
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
Extension { #name : #LePictureSnippet }
|
||||||
|
|
||||||
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||||
|
LePictureSnippet >> asMarkdeep [
|
||||||
|
| output |
|
||||||
|
output := '' writeStream.
|
||||||
|
output
|
||||||
|
nextPutAll: self metadataDiv;
|
||||||
|
nextPutAll: self centeredFigure; lf;
|
||||||
|
nextPutAll: '</div>'; lf; lf.
|
||||||
|
^ output contents
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||||
|
LePictureSnippet >> centeredFigure [
|
||||||
|
|
||||||
|
^ '<center>
|
||||||
|
<figure>
|
||||||
|
<img src="' , self urlString , '"
|
||||||
|
width="' , (self optionAt: 'width' ifAbsent: [ '75%' ]) , '"
|
||||||
|
/>
|
||||||
|
<figcaption>*' , (self optionAt: 'caption' ifAbsent: [ '' ]) , '*
|
||||||
|
</figcaption>
|
||||||
|
</figure>
|
||||||
|
</center>'
|
||||||
|
]
|
@ -30,15 +30,3 @@ LeTextualSnippet >> markdeepCustomCloser [
|
|||||||
LeTextualSnippet >> markdeepCustomOpener [
|
LeTextualSnippet >> markdeepCustomOpener [
|
||||||
^ ''
|
^ ''
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
||||||
LeTextualSnippet >> metadata [
|
|
||||||
^ OrderedDictionary new
|
|
||||||
at: 'id' put: self uidString;
|
|
||||||
at: 'parent' put: self parent uidString;
|
|
||||||
at: 'created' put: self createTime asString;
|
|
||||||
at: 'edited' put: self latestEditTime asString;
|
|
||||||
at: 'creator' put: self createEmail asString;
|
|
||||||
at: 'editor' put: self editEmail asString;
|
|
||||||
yourself.
|
|
||||||
]
|
|
||||||
|
Loading…
Reference in New Issue
Block a user