diff --git a/src/MiniDocs/LeTextualSnippet.extension.st b/src/MiniDocs/LeTextualSnippet.extension.st
index f83aa95..734fe39 100644
--- a/src/MiniDocs/LeTextualSnippet.extension.st
+++ b/src/MiniDocs/LeTextualSnippet.extension.st
@@ -45,33 +45,8 @@ LeTextualSnippet >> asMarkdownWithMetadataWrappers [
{ #category : #'*MiniDocs' }
LeTextualSnippet >> contentAsStringAnnotated [
- | annotations substitutions exported pageConfig|
- self ast ifNil: [ ^ self contentAsString ].
- annotations := self ast parts select: [:each | each className includesSubstring: 'AnnotationNode' ].
- annotations ifEmpty: [ ^ self contentAsString ].
- substitutions := OrderedDictionary new.
- pageConfig := self page config.
- annotations do: [ :each | | key type value color |
- key := each source.
- type := (key splitOn: ':') first copyWithoutAll: '{{'.
- value := key copyFrom: type size + 4 to: key size - 2.
- pageConfig
- ifNil: [ color := 'default' ]
- ifNotNil: [ | colors |
- colors := pageConfig at: 'annotationColors' ifAbsent: [ nil ].
- colors ifNotNil: [
- color := colors at: type ifAbsent: [ colors at: 'defaultColor' ifAbsentPut: ['default'] ]
- ]
- ].
- substitutions
- at: key
- put: '', value,''.
- ].
- exported := self contentAsString.
- substitutions keysAndValuesDo: [:k :v |
- exported := exported copyReplaceAll: k with: v.
- ].
- ^ exported
+ self ast ifNotNil: [ ^ self processSnippetAnnotations ].
+ ^ self contentAsString
]
{ #category : #'*MiniDocs' }
@@ -143,6 +118,37 @@ LeTextualSnippet >> metadataUpdate [
yourself
]
+{ #category : #'*MiniDocs' }
+LeTextualSnippet >> processSnippetAnnotations [
+ | exported substitutions annotations pageConfig |
+ annotations := self ast parts
+ select: [ :each | each className includesSubstring: 'AnnotationNode' ].
+ annotations ifEmpty: [ ^ self contentAsString ].
+ substitutions := OrderedDictionary new.
+ pageConfig := self page config.
+ annotations
+ do: [ :each |
+ | key type value color |
+ key := each source.
+ type := (key splitOn: ':') first copyWithoutAll: '{{'.
+ value := key copyFrom: type size + 4 to: key size - 2.
+ pageConfig
+ ifNil: [ color := 'default' ]
+ ifNotNil: [ | colors |
+ colors := pageConfig at: 'annotationColors' ifAbsent: [ nil ].
+ colors
+ ifNotNil: [ color := colors
+ at: type
+ ifAbsent: [ colors at: 'defaultColor' ifAbsentPut: [ 'default' ] ] ] ].
+ substitutions
+ at: key
+ put: '' , value , '' ].
+ exported := self contentAsString.
+ substitutions
+ keysAndValuesDo: [ :k :v | exported := exported copyReplaceAll: k with: v ].
+ ^ exported
+]
+
{ #category : #'*MiniDocs' }
LeTextualSnippet >> sanitizeMetadata [
self options ifNil: [^ self ].