diff --git a/repository/Grafoscopio-Utils/LeModel.extension.st b/repository/Grafoscopio-Utils/LeModel.extension.st new file mode 100644 index 0000000..410098f --- /dev/null +++ b/repository/Grafoscopio-Utils/LeModel.extension.st @@ -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: '
'; lf. + ^ output contents. +] diff --git a/repository/Grafoscopio-Utils/LePage.extension.st b/repository/Grafoscopio-Utils/LePage.extension.st index 83ec762..a213181 100644 --- a/repository/Grafoscopio-Utils/LePage.extension.st +++ b/repository/Grafoscopio-Utils/LePage.extension.st @@ -20,6 +20,13 @@ LePage >> asMarkdeep [ ^ 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' } LePage >> asMarkdeepInto: aFileLocator [ @@ -32,16 +39,16 @@ LePage >> fileName [ ] { #category : #'*Grafoscopio-Utils-Core' } -LePage >> markdeepPreview [ - ^ self asMarkdeep exportAsFileOn: self markdeepTemporalFile +LePage >> markdeepFileName [ + | sanitized | + sanitized := self title asDashedLowercase copyWithoutAll: #($/). + ^ sanitized, '--',(self uidString copyFrom: 1 to: 5), '.md.html'. ] { #category : #'*Grafoscopio-Utils-Core' } LePage >> markdeepTemporalFile [ - | fileName sanitized | - sanitized := self title asDashedLowercase copyWithoutAll: #($/). - fileName := sanitized, '--',(self uidString copyFrom: 1 to: 5), '.md.html'. - ^ FileLocator temp / fileName. + + ^ FileLocator temp / self markdeepFileName. ] { #category : #'*Grafoscopio-Utils-Core' } diff --git a/repository/Grafoscopio-Utils/LePictureSnippet.extension.st b/repository/Grafoscopio-Utils/LePictureSnippet.extension.st new file mode 100644 index 0000000..f689d32 --- /dev/null +++ b/repository/Grafoscopio-Utils/LePictureSnippet.extension.st @@ -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: '
'; lf; lf. + ^ output contents +] + +{ #category : #'*Grafoscopio-Utils-Core' } +LePictureSnippet >> centeredFigure [ + + ^ '
+
+ +
*' , (self optionAt: 'caption' ifAbsent: [ '' ]) , '* +
+
+
' +] diff --git a/repository/Grafoscopio-Utils/LeTextualSnippet.extension.st b/repository/Grafoscopio-Utils/LeTextualSnippet.extension.st index b201e4c..13c5e0f 100644 --- a/repository/Grafoscopio-Utils/LeTextualSnippet.extension.st +++ b/repository/Grafoscopio-Utils/LeTextualSnippet.extension.st @@ -30,15 +30,3 @@ LeTextualSnippet >> markdeepCustomCloser [ 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. -]