diff --git a/src/MiniDocs/LeTextualSnippet.extension.st b/src/MiniDocs/LeTextualSnippet.extension.st index 4fcbd35..b7bcf48 100644 --- a/src/MiniDocs/LeTextualSnippet.extension.st +++ b/src/MiniDocs/LeTextualSnippet.extension.st @@ -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: ''; @@ -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: '', value,''. + ]. + exported := self contentAsString. + substitutions keysAndValuesDo: [:k :v | + exported := exported copyReplaceAll: k with: v. + ]. + ^ exported +] + { #category : #'*MiniDocs' } LeTextualSnippet >> contentAsStringCustomized [ (self contentAsString beginsWith: '#')