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
1 changed files with 13 additions and 3 deletions

View File

@ -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: '<span st-class="',type,'" style="color:blue">', value,'</span>'.
at: key
put: '<span st-class="',type,'" style="color:', color, '">', value,'</span>'.
].
exported := self contentAsString.
substitutions keysAndValuesDo: [:k :v |