Markdeep exportation support for YouTube snippets.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-01-07 19:23:06 -05:00
parent 40703573ed
commit 2f3fa9a4d3
2 changed files with 48 additions and 1 deletions

View File

@ -26,7 +26,7 @@ BaselineOfMiniDocs >> baseline: spec [
{ #category : #accessing }
BaselineOfMiniDocs >> semanticVersion [
^ '0.1.1'
^ '0.2.0'
]
{ #category : #accessing }

View File

@ -0,0 +1,47 @@
Extension { #name : #LeYoutubeReferenceSnippet }
{ #category : #'*MiniDocs' }
LeYoutubeReferenceSnippet >> asMarkdeep [
| output |
output := WriteStream on: ''.
output
nextPutAll: self metadataDiv;
nextPutAll: '![ ', self title, ' | ', self authorName, ' ](',self urlString, ')';
nextPut: Character lf;
nextPutAll: '</div>';
nextPut: Character lf;
nextPut: Character lf.
^ output contents
]
{ #category : #'*MiniDocs' }
LeYoutubeReferenceSnippet >> metadata [
^ self optionAt: 'metadata' ifAbsentPut: [ self metadataInit ]
]
{ #category : #'*MiniDocs' }
LeYoutubeReferenceSnippet >> 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' }
LeYoutubeReferenceSnippet >> 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
]