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

View File

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

View File

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

View File

@ -7,7 +7,7 @@ LeSnippet class >> fromMetaMarkdeep: div [
metadata := STON fromString:(div xpath: '@st-data') stringValue. metadata := STON fromString:(div xpath: '@st-data') stringValue.
snippet := className asClass new. snippet := className asClass new.
snippet injectMetadataFrom: metadata. snippet injectMetadataFrom: metadata.
snippet contentFrom: div. snippet fromMarkdeep: div.
^ snippet. ^ snippet.
] ]
@ -21,3 +21,13 @@ LeSnippet >> moveToPageTitled: pageName [
origin removeSnippet: thisSnippet. origin removeSnippet: thisSnippet.
destination addSnippet: 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' } { #category : #'*MiniDocs' }
LeTextSnippet >> contentFrom: markdeepDiv [ LeTextSnippet >> fromMarkdeep: markdeepDiv [
^ markdeepDiv asSnippetDictionary asLepiterSnippet ^ markdeepDiv asSnippetDictionary asLepiterSnippet
] ]