Starting support for custom annotations.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-01-01 09:06:40 -05:00
parent efd11cc44c
commit 349c314318

View File

@ -13,7 +13,7 @@ LeTextualSnippet >> asMarkdeep [
nextPutAll: ' st-data="' , (STON toStringPretty: self metadata) , '">';
nextPut: Character lf;
nextPutAll: self markdeepCustomOpener;
nextPutAll: self contentAsString;
nextPutAll: self contentAsStringAnnotated;
nextPut: Character lf;
nextPutAll: self markdeepCustomCloser;
nextPutAll: '</div>';
@ -38,6 +38,27 @@ LeTextualSnippet >> asMarkdown [
^ output contents
]
{ #category : #'*MiniDocs' }
LeTextualSnippet >> contentAsStringAnnotated [
| annotations substitutions exported |
self ast ifNil: [ ^ self contentAsString ].
annotations := self ast parts select: [:each | each className includesSubstring: 'AnnotationNode' ].
annotations ifEmpty: [ ^ self contentAsString ].
substitutions := OrderedDictionary new.
annotations do: [ :each | | key type value |
key := each source.
type := (key splitOn: ':') first copyWithoutAll: '{{'.
value := key copyFrom: type size + 4 to: key size - 2.
substitutions
at: key put: '<span st-class="',type,'">', value,'</span>'.
].
exported := self contentAsString.
substitutions keysAndValuesDo: [:k :v |
exported := exported copyReplaceAll: k with: v.
].
^ exported
]
{ #category : #'*MiniDocs' }
LeTextualSnippet >> contentAsStringCustomized [
(self contentAsString beginsWith: '#')