LePictureSnippets from Markdeep: importing from plain content strings (not yet tested with multiline captions).

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-10-31 14:28:05 -05:00
parent eda63bfc3a
commit 5c4f6ab55b
2 changed files with 16 additions and 1 deletions

View File

@ -30,6 +30,21 @@ LePictureSnippet >> fromMarkdeep: markdeepDiv [
^ markdeepDiv asSnippetDictionary asLepiterSnippet ^ markdeepDiv asSnippetDictionary asLepiterSnippet
] ]
{ #category : #'*MiniDocs' }
LePictureSnippet >> fromString: aString [
"aString should be a valid Markdown/Markdeep image string"
| args captionTemp urlTemp |
args := aString splitOn: ']('.
captionTemp := args first.
captionTemp := captionTemp copyFrom: 3 to: captionTemp size.
urlTemp := args second.
urlTemp := urlTemp copyFrom: 1 to: urlTemp size - 1.
self caption: captionTemp.
self urlString: urlTemp.
^ self
]
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
LePictureSnippet >> metadata [ LePictureSnippet >> metadata [
^ self optionAt: 'metadata' ifAbsentPut: [ self metadataInit ] ^ self optionAt: 'metadata' ifAbsentPut: [ self metadataInit ]

View File

@ -22,7 +22,7 @@ OrderedDictionary >> asLepiterSnippet [
(self at: 'className') = 'LePictureSnippet' (self at: 'className') = 'LePictureSnippet'
ifTrue: [ ifTrue: [
response := LePictureSnippet new. response := LePictureSnippet new.
"response code: (self at: 'content')" response fromString: (self at: 'content')
]. ].
response response
uid: (LeUID new uidString: (self at: 'id')); uid: (LeUID new uidString: (self at: 'id'));