Improved Markdeep exporter for LePictureSnippets.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-10-31 13:04:47 -05:00
parent 55e786f01c
commit 9163d0b145
5 changed files with 23 additions and 7 deletions

View File

@ -123,7 +123,7 @@ LeDatabase >> errorCardFor: error [
| keepButton overwriteButton loadCopyButton errorMessageUI localPage errorKey |
errorKey := error keys first.
errorKey := error keys last.
localPage := self pageWithID: errorKey.
keepButton := BrButton new
aptitude: BrGlamorousButtonWithIconAndLabelAptitude;
@ -186,7 +186,7 @@ LeDatabase >> gtViewErrorDetailsOn: aView [
LeDatabase >> gtViewErrorDetailsOn: aView withKey: erroKey [
<gtView>
^ aView explicit
title: 'Errors' translated;
title: 'Errors beta' translated;
priority: 5;
stencil: [ | container |
container := BlElement new

View File

@ -9,7 +9,7 @@ LePharoSnippet >> contentAsStringCustomized [
]
{ #category : #'*MiniDocs' }
LePharoSnippet >> contentFrom: markdeepDiv [
LePharoSnippet >> fromMarkdeep: markdeepDiv [
^ markdeepDiv asSnippetDictionary asLepiterSnippet
]

View File

@ -25,6 +25,11 @@ LePictureSnippet >> asMarkdeep [
^ output contents
]
{ #category : #'*MiniDocs' }
LePictureSnippet >> fromMarkdeep: markdeepDiv [
^ markdeepDiv asSnippetDictionary asLepiterSnippet
]
{ #category : #'*MiniDocs' }
LePictureSnippet >> metadata [
^ self optionAt: 'metadata' ifAbsentPut: [ self metadataInit ]
@ -37,8 +42,9 @@ LePictureSnippet >> metadataDiv [
output
nextPutAll: '<div st-class="' , self class greaseString , '"';
nextPut: Character lf;
nextPutAll: ' st-data="' , (STON toString: self metadata) , '">'.
^ output.
nextPutAll: ' st-data="' , (STON toStringPretty: self metadata) , '">';
nextPut: Character lf.
^ output contents withInternetLineEndings.
]

View File

@ -7,7 +7,7 @@ LeSnippet class >> fromMetaMarkdeep: div [
metadata := STON fromString:(div xpath: '@st-data') stringValue.
snippet := className asClass new.
snippet injectMetadataFrom: metadata.
snippet contentFrom: div.
snippet fromMarkdeep: div.
^ snippet.
]
@ -21,3 +21,13 @@ LeSnippet >> moveToPageTitled: pageName [
origin removeSnippet: thisSnippet.
destination addSnippet: thisSnippet.
]
{ #category : #'*MiniDocs' }
LeSnippet >> sanitizeMetadata [
self metadata keysAndValuesDo: [:k :v |
(v includesAny: #($< $>))
ifTrue: [
self metadata at: k put: (v copyWithoutAll: #($< $>))
]
]
]

View File

@ -14,7 +14,7 @@ LeTextSnippet >> asLePage [
]
{ #category : #'*MiniDocs' }
LeTextSnippet >> contentFrom: markdeepDiv [
LeTextSnippet >> fromMarkdeep: markdeepDiv [
^ markdeepDiv asSnippetDictionary asLepiterSnippet
]