2022-09-09 17:36:30 +00:00
|
|
|
Extension { #name : #LePictureSnippet }
|
|
|
|
|
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LePictureSnippet >> asMarkdeep [
|
2023-07-10 03:26:09 +00:00
|
|
|
| output curatedCaption captionLines |
|
2023-07-30 17:44:56 +00:00
|
|
|
captionLines := self caption lines.
|
|
|
|
(captionLines size <= 1)
|
2023-07-10 03:26:09 +00:00
|
|
|
ifTrue: [ curatedCaption := caption ]
|
|
|
|
ifFalse: [
|
|
|
|
curatedCaption := WriteStream on: ''.
|
|
|
|
curatedCaption nextPutAll: captionLines first.
|
|
|
|
captionLines allButFirstDo: [:line |
|
|
|
|
curatedCaption nextPutAll: ' ', line.
|
|
|
|
curatedCaption := curatedCaption contents.
|
|
|
|
]
|
|
|
|
].
|
2022-09-09 17:36:30 +00:00
|
|
|
output := WriteStream on: ''.
|
|
|
|
output
|
|
|
|
nextPutAll: self metadataDiv;
|
2023-07-10 03:26:09 +00:00
|
|
|
nextPutAll: '![ ', curatedCaption ,' ](', self urlString, ')';
|
2022-09-09 17:36:30 +00:00
|
|
|
nextPut: Character lf;
|
|
|
|
nextPutAll: '</div>';
|
|
|
|
nextPut: Character lf;
|
|
|
|
nextPut: Character lf.
|
|
|
|
^ output contents
|
|
|
|
]
|
2022-12-20 14:25:49 +00:00
|
|
|
|
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LePictureSnippet >> metadata [
|
|
|
|
^ self optionAt: 'metadata' ifAbsentPut: [ self metadataInit ]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LePictureSnippet >> metadataDiv [
|
|
|
|
| output |
|
|
|
|
output := WriteStream on: ''.
|
|
|
|
output
|
|
|
|
nextPutAll: '<div st-class="' , self class greaseString , '"';
|
|
|
|
nextPut: Character lf;
|
|
|
|
nextPutAll: ' st-data="' , (STON toString: self metadata) , '">'.
|
|
|
|
^ output.
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LePictureSnippet >> metadataInit [
|
|
|
|
| surrogate |
|
|
|
|
self parent
|
|
|
|
ifNil: [ surrogate := nil]
|
|
|
|
ifNotNil: [ surrogate := self parent uidString ].
|
|
|
|
^ 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
|
|
|
|
]
|