56 lines
1.5 KiB
Smalltalk
56 lines
1.5 KiB
Smalltalk
Extension { #name : #LePictureSnippet }
|
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
LePictureSnippet >> asMarkdeep [
|
|
| output extraData |
|
|
output := '' writeStream.
|
|
output
|
|
nextPutAll: self metadataDiv;
|
|
nextPutAll: self centeredFigure; lf;
|
|
nextPutAll: '</div>'; lf; lf.
|
|
^ output contents
|
|
]
|
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
LePictureSnippet >> centeredFigure [
|
|
|
|
^ '<center>
|
|
<figure>
|
|
<img src="' , self urlString , '"
|
|
width="' , (self optionAt: 'width' ifAbsent: [ '75%' ]) , '"
|
|
/>
|
|
<figcaption>*' , (self optionAt: 'caption' ifAbsent: [ '' ]) , '*
|
|
</figcaption>
|
|
</figure>
|
|
</center>'
|
|
]
|
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
LePictureSnippet >> contentFrom: markdeepDiv [
|
|
| caption width |
|
|
caption := markdeepDiv contentString.
|
|
width := (markdeepDiv // 'img' @ 'width') stringValue.
|
|
self
|
|
optionAt: 'caption' put: caption;
|
|
optionAt: 'width' put: width.
|
|
^ self urlString: (markdeepDiv // 'img' @ 'src') stringValue.
|
|
]
|
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
LePictureSnippet >> metadataInit [
|
|
^ OrderedDictionary new
|
|
at: 'id' put: self uidString;
|
|
at: 'parent' put: self parent uidString;
|
|
at: 'url' put: self contentAsString;
|
|
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
|
|
]
|
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
LePictureSnippet >> metatada [
|
|
self optionAt: 'metadata' ifAbsent: [ self metadataInit ]
|
|
]
|