From b09f2310ef2443026f7fc51e837f51087fb23478 Mon Sep 17 00:00:00 2001 From: Offray Date: Tue, 2 Jan 2024 13:17:06 -0500 Subject: [PATCH] Adding configuration files to pages for granular control of exportation. --- src/MiniDocs/LeTextualSnippet.extension.st | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/MiniDocs/LeTextualSnippet.extension.st b/src/MiniDocs/LeTextualSnippet.extension.st index 0a279e3..6b36d00 100644 --- a/src/MiniDocs/LeTextualSnippet.extension.st +++ b/src/MiniDocs/LeTextualSnippet.extension.st @@ -40,17 +40,27 @@ LeTextualSnippet >> asMarkdown [ { #category : #'*MiniDocs' } LeTextualSnippet >> contentAsStringAnnotated [ - | annotations substitutions exported | + | 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. - annotations do: [ :each | | key type value | + 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: [ 'default' ] + ] + ]. substitutions - at: key put: '', value,''. + at: key + put: '', value,''. ]. exported := self contentAsString. substitutions keysAndValuesDo: [:k :v |