Grafoscopio/src/Grafoscopio/GrafoscopioPillarStyler.cla...

105 lines
2.9 KiB
Smalltalk

Class {
#name : #GrafoscopioPillarStyler,
#superclass : #Object,
#instVars : [
'pharoStyler'
],
#category : #'Grafoscopio-Pillar-Style'
}
{ #category : #accessing }
GrafoscopioPillarStyler class >> defaultStyler [
^ self new
]
{ #category : #'as yet unclassified' }
GrafoscopioPillarStyler >> attributesForCodeBlock: aPRCodeblock at: index [
aPRCodeblock language originalName = 'pharo-image'
ifTrue: [ ^ {(TextAnchor new
anchoredMorph: (self class compiler evaluate: (aPRCodeblock propertyAt: #text)))} ].
aPRCodeblock language originalName = 'pharo'
ifTrue: [ | runs |
runs := (self pharoStyler
privateStyle: aPRCodeblock text asText , '.') runs.
^ runs at: index - aPRCodeblock textStart ].
^{}
]
{ #category : #'as yet unclassified' }
GrafoscopioPillarStyler >> attributesForDocument: aDocument [
^ self default
]
{ #category : #'as yet unclassified' }
GrafoscopioPillarStyler >> attributesForExternalLink: aPRExternalLink [
^ {(TextColor new color: (Color fromHexString: '03A9F4')).
TextEmphasis underlined.
(TextAction new
actOnClickBlock: [ self inform: 'Should be going to ' , aPRExternalLink reference ])}
]
{ #category : #'as yet unclassified' }
GrafoscopioPillarStyler >> attributesForFigure: aPRFigure [
^ self default
]
{ #category : #'as yet unclassified' }
GrafoscopioPillarStyler >> attributesForFormatText: aGrafoscopioFormatTextNode [
^ self attributesForText: aGrafoscopioFormatTextNode
]
{ #category : #'as yet unclassified' }
GrafoscopioPillarStyler >> attributesForHeader: aPRHeader [
^ {(TextFontReference
toFont:
(LogicalFont
familyName: 'Source Code Pro'
pointSize: (20 - (aPRHeader level * 5) max: 10))) . TextEmphasis bold}
]
{ #category : #'as yet unclassified' }
GrafoscopioPillarStyler >> attributesForInternalLink: aPRInternalLink [
^ self attributesForExternalLink: aPRInternalLink
]
{ #category : #'as yet unclassified' }
GrafoscopioPillarStyler >> attributesForLineBreak: aPRLineBreak [
^ self default
]
{ #category : #'as yet unclassified' }
GrafoscopioPillarStyler >> attributesForListItem: aPRListItem at: index [
^ (aPRListItem text at: index - aPRListItem textStart + 1) = Character home
ifTrue: [ {(TextIndent tabs: aPRListItem level).
(TextAnchor new
anchoredMorph: (self iconNamed: #menuPin);
yourself)} ] ifFalse: [ { } ]
]
{ #category : #'as yet unclassified' }
GrafoscopioPillarStyler >> attributesForParagraph: aParagraph [
^ self default
]
{ #category : #'as yet unclassified' }
GrafoscopioPillarStyler >> attributesForText: aText [
^ self default
]
{ #category : #'as yet unclassified' }
GrafoscopioPillarStyler >> attributesForUnorderedList: aList [
^ self default
]
{ #category : #'as yet unclassified' }
GrafoscopioPillarStyler >> default [
^ Array empty
]
{ #category : #'as yet unclassified' }
GrafoscopioPillarStyler >> pharoStyler [
^ pharoStyler
ifNil: [ pharoStyler := SHRBTextStyler new isForWorkspace: true; yourself]
]