MiniDocs/src/MiniDocs/LeTextualSnippet.extension.st

48 lines
1.2 KiB
Smalltalk

Extension { #name : #LeTextualSnippet }
{ #category : #'*MiniDocs' }
LeTextualSnippet >> asMarkdown [
"Inspired by Alpine.js and Assembler CSS 'x-' properties, we are going to use
'st-' properties as a way to extend divs metadata regarding its contents."
| output |
output := '' writeStream.
output
nextPutAll: '<div st-class="', self class asString, '"'; lf;
nextPutAll: ' st-data="', (STON toString: self metadata), '">'; lf;
nextPutAll: self markdownCustomOpener;
nextPutAll: self contentAsStringCustomized; lf;
nextPutAll: self markdownCustomCloser;
nextPutAll: '</div>'; lf; lf.
^ output contents
]
{ #category : #'*MiniDocs' }
LeTextualSnippet >> contentAsStringCustomized [
^ self contentAsString
]
{ #category : #'*MiniDocs' }
LeTextualSnippet >> markdeepCustomCloser [
^ ''
]
{ #category : #'*MiniDocs' }
LeTextualSnippet >> markdeepCustomOpener [
^ ''
]
{ #category : #'*MiniDocs' }
LeTextualSnippet >> markdownCustomCloser [
^ self markdeepCustomCloser
]
{ #category : #'*MiniDocs' }
LeTextualSnippet >> markdownCustomOpener [
^ self markdeepCustomOpener
]
{ #category : #'*MiniDocs' }
LeTextualSnippet >> tags [
^ self metadata at: 'tags'
]