161 lines
4.6 KiB
Smalltalk
161 lines
4.6 KiB
Smalltalk
Class {
|
|
#name : #GrafoscopioAttributeBranchVisitor,
|
|
#superclass : #Object,
|
|
#instVars : [
|
|
'attributes',
|
|
'level',
|
|
'listLevel',
|
|
'index',
|
|
'text',
|
|
'styler'
|
|
],
|
|
#category : #'Grafoscopio-Pillar-Style'
|
|
}
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAttributeBranchVisitor >> analyzeBranch: aBranch at: anIndex [
|
|
index := anIndex.
|
|
^ [ aBranch
|
|
inject: OrderedCollection new
|
|
into: [ :attrs :node |
|
|
node accept: self.
|
|
attrs addAll: (self attributesAt: node).
|
|
attrs ] ]
|
|
ensure: [ index := 0 ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> attributes [
|
|
^ attributes
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAttributeBranchVisitor >> attributesAt: aNode [
|
|
^ (attributes detect: [ :a | a first = aNode ]) second
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> attributesAt: aNode force: aBlock [
|
|
^ attributes
|
|
detect: [ :a | a first = aNode ]
|
|
ifFound: [ :a | a at:2 put: aBlock value ]
|
|
ifNone: [ | val |
|
|
val := aBlock value.
|
|
attributes
|
|
add:
|
|
{aNode.
|
|
val}.
|
|
val ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> attributesAt: aNode ifAbsentPut: aBlock [
|
|
^ attributes
|
|
detect: [ :a | a first = aNode ]
|
|
ifFound: [ :a | a second ]
|
|
ifNone: [ | val |
|
|
val := aBlock value.
|
|
attributes
|
|
add:
|
|
{aNode.
|
|
val}.
|
|
val ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> index: anIndex [
|
|
index := anIndex
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> initialize [
|
|
attributes := OrderedCollection new.
|
|
styler := GrafoscopioPillarStyler defaultStyler.
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> text: aGrafoscopioPillarASText [
|
|
text := aGrafoscopioPillarASText
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> visitCodeblock: aPRCodeblock [
|
|
self
|
|
attributesAt: aPRCodeblock
|
|
ifAbsentPut: [ styler attributesForCodeBlock: aPRCodeblock at: index ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> visitCommentedLine: aPRCommentedLine [
|
|
self attributesAt: aPRCommentedLine ifAbsentPut: [ styler default ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> visitDocument: aPRDocument [
|
|
self attributesAt: aPRDocument ifAbsentPut: [ styler attributesForDocument: aPRDocument ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> visitExternalLink: aPRExternalLink [
|
|
self
|
|
attributesAt: aPRExternalLink
|
|
ifAbsentPut: [ styler attributesForExternalLink: aPRExternalLink ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> visitFigure: aPRFigure [
|
|
self attributesAt: aPRFigure ifAbsentPut: [ styler attributesForFigure: aPRFigure ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> visitFormatText: aGrafoscopioFormatTextNode [
|
|
self attributesAt: aGrafoscopioFormatTextNode
|
|
ifAbsentPut: [ styler attributesForFormatText: aGrafoscopioFormatTextNode ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> visitHeader: aPRHeader [
|
|
self
|
|
attributesAt: aPRHeader
|
|
ifAbsentPut: [ styler attributesForHeader: aPRHeader ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> visitInternalLink: aPRInternalLink [
|
|
self
|
|
attributesAt: aPRInternalLink
|
|
ifAbsentPut: [ styler attributesForInternalLink: aPRInternalLink ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> visitLineBreak: aPRLineBreak [
|
|
self attributesAt: aPRLineBreak
|
|
ifAbsentPut: [ styler attributesForLineBreak: aPRLineBreak ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> visitListItem: aPRListItem [
|
|
self
|
|
attributesAt: aPRListItem
|
|
force: [ styler attributesForListItem: aPRListItem at: index ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> visitParagraph: aPRParagraph [
|
|
self
|
|
attributesAt: aPRParagraph
|
|
ifAbsentPut: [ styler attributesForParagraph: aPRParagraph ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> visitText: aPRText [
|
|
self attributesAt: aPRText
|
|
ifAbsentPut: [ styler attributesForText: aPRText ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAttributeBranchVisitor >> visitUnorderedList: aPRUnorderedList [
|
|
self attributesAt: aPRUnorderedList
|
|
ifAbsentPut: [ styler attributesForUnorderedList: aPRUnorderedList ]
|
|
]
|