Adding configuration files to pages for granular control of exportation.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-01-02 13:17:06 -05:00
parent 979facfd86
commit b09f2310ef

View File

@ -40,17 +40,27 @@ LeTextualSnippet >> asMarkdown [
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
LeTextualSnippet >> contentAsStringAnnotated [ LeTextualSnippet >> contentAsStringAnnotated [
| annotations substitutions exported | | annotations substitutions exported pageConfig|
self ast ifNil: [ ^ self contentAsString ]. self ast ifNil: [ ^ self contentAsString ].
annotations := self ast parts select: [:each | each className includesSubstring: 'AnnotationNode' ]. annotations := self ast parts select: [:each | each className includesSubstring: 'AnnotationNode' ].
annotations ifEmpty: [ ^ self contentAsString ]. annotations ifEmpty: [ ^ self contentAsString ].
substitutions := OrderedDictionary new. substitutions := OrderedDictionary new.
annotations do: [ :each | | key type value | pageConfig := self page config.
annotations do: [ :each | | key type value color |
key := each source. key := each source.
type := (key splitOn: ':') first copyWithoutAll: '{{'. type := (key splitOn: ':') first copyWithoutAll: '{{'.
value := key copyFrom: type size + 4 to: key size - 2. 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 substitutions
at: key put: '<span st-class="',type,'" style="color:blue">', value,'</span>'. at: key
put: '<span st-class="',type,'" style="color:', color, '">', value,'</span>'.
]. ].
exported := self contentAsString. exported := self contentAsString.
substitutions keysAndValuesDo: [:k :v | substitutions keysAndValuesDo: [:k :v |