2022-01-30 18:57:25 +00:00
|
|
|
Extension { #name : #LePictureSnippet }
|
|
|
|
|
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
|
|
LePictureSnippet >> asMarkdeep [
|
2022-02-02 23:35:39 +00:00
|
|
|
| output extraData |
|
2022-01-30 18:57:25 +00:00
|
|
|
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>'
|
|
|
|
]
|
2022-02-02 23:35:39 +00:00
|
|
|
|
|
|
|
{ #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.
|
|
|
|
]
|