Adding configuration files to pages for granular control of exportation.
This commit is contained in:
parent
979facfd86
commit
b09f2310ef
@ -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 |
|
||||
|
Loading…
Reference in New Issue
Block a user