2022-04-05 14:43:37 +00:00
|
|
|
Extension { #name : #LeTextualSnippet }
|
|
|
|
|
2022-09-09 17:36:30 +00:00
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LeTextualSnippet >> asMarkdeep [
|
|
|
|
"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 on: ''.
|
|
|
|
output
|
|
|
|
nextPutAll: '<div st-class="' , self class greaseString , '"';
|
|
|
|
nextPut: Character lf;
|
|
|
|
nextPutAll: ' st-data="' , (STON toString: self metadata) , '">';
|
|
|
|
nextPut: Character lf;
|
|
|
|
nextPutAll: self markdeepCustomOpener;
|
|
|
|
nextPutAll: self contentAsString;
|
|
|
|
nextPut: Character lf;
|
|
|
|
nextPutAll: self markdeepCustomCloser;
|
|
|
|
nextPutAll: '</div>';
|
|
|
|
nextPut: Character lf;
|
|
|
|
nextPut: Character lf.
|
|
|
|
^ output contents
|
|
|
|
]
|
|
|
|
|
2022-07-19 21:41:40 +00:00
|
|
|
{ #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;
|
2022-07-26 22:59:22 +00:00
|
|
|
nextPutAll: self contentAsStringCustomized; lf;
|
2022-07-19 21:41:40 +00:00
|
|
|
nextPutAll: self markdownCustomCloser;
|
|
|
|
nextPutAll: '</div>'; lf; lf.
|
|
|
|
^ output contents
|
|
|
|
]
|
|
|
|
|
2022-07-26 22:59:22 +00:00
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LeTextualSnippet >> contentAsStringCustomized [
|
|
|
|
^ self contentAsString
|
|
|
|
]
|
|
|
|
|
2022-07-16 17:29:57 +00:00
|
|
|
{ #category : #'*MiniDocs' }
|
2022-04-05 14:43:37 +00:00
|
|
|
LeTextualSnippet >> markdeepCustomCloser [
|
|
|
|
^ ''
|
|
|
|
]
|
|
|
|
|
2022-07-16 17:29:57 +00:00
|
|
|
{ #category : #'*MiniDocs' }
|
2022-04-05 14:43:37 +00:00
|
|
|
LeTextualSnippet >> markdeepCustomOpener [
|
|
|
|
^ ''
|
|
|
|
]
|
2022-07-19 21:44:54 +00:00
|
|
|
|
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LeTextualSnippet >> markdownCustomCloser [
|
|
|
|
^ self markdeepCustomCloser
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LeTextualSnippet >> markdownCustomOpener [
|
|
|
|
^ self markdeepCustomOpener
|
|
|
|
]
|
2022-07-26 22:59:22 +00:00
|
|
|
|
2022-09-21 17:37:50 +00:00
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LeTextualSnippet >> metadata [
|
|
|
|
|
|
|
|
^ self optionAt: 'metadata' ifAbsentPut: [ self metadataInit ]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LeTextualSnippet >> metadataInit [
|
|
|
|
| surrogate |
|
|
|
|
self parent
|
|
|
|
ifNil: [ surrogate := nil]
|
2023-10-20 18:23:28 +00:00
|
|
|
ifNotNil: [
|
|
|
|
self parent isString
|
|
|
|
ifTrue: [ surrogate := self parent]
|
|
|
|
ifFalse: [ surrogate := self parent uidString ]
|
|
|
|
].
|
2022-09-21 17:37:50 +00:00
|
|
|
^ OrderedDictionary new
|
|
|
|
at: 'id' put: self uidString;
|
|
|
|
at: 'parent' put: surrogate;
|
|
|
|
at: 'created' put: self createTime asString;
|
|
|
|
at: 'modified' put: self latestEditTime asString;
|
|
|
|
at: 'creator' put: self createEmail asString;
|
|
|
|
at: 'modifier' put: self editEmail asString;
|
|
|
|
yourself
|
|
|
|
]
|
|
|
|
|
2022-07-26 22:59:22 +00:00
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LeTextualSnippet >> tags [
|
2022-07-27 17:11:51 +00:00
|
|
|
^ self metadata at: 'tags' ifAbsentPut: [ Set new ]
|
2022-07-26 22:59:22 +00:00
|
|
|
]
|