Skip to content

Commit

Permalink
Merge pull request #45 from demarey/Pharo12
Browse files Browse the repository at this point in the history
Move to Tonel v3
  • Loading branch information
jecisc authored Oct 11, 2023
2 parents 0c92b3c + 77a71e8 commit 2f22501
Show file tree
Hide file tree
Showing 13 changed files with 141 additions and 120 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Class {
#name : #BaselineOfBeautifulComments,
#superclass : #BaselineOf,
#category : #BaselineOfBeautifulComments
#name : 'BaselineOfBeautifulComments',
#superclass : 'BaselineOf',
#category : 'BaselineOfBeautifulComments',
#package : 'BaselineOfBeautifulComments'
}

{ #category : #baselines }
{ #category : 'baselines' }
BaselineOfBeautifulComments >> baseline: spec [
<baseline>

Expand Down
2 changes: 1 addition & 1 deletion src/BaselineOfBeautifulComments/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #BaselineOfBeautifulComments }
Package { #name : 'BaselineOfBeautifulComments' }
22 changes: 12 additions & 10 deletions src/BeautifulComments/BCBeautifulCommentsSettingsTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,32 @@
This class test that two settings CaptureErrors and Rendering works as intended
"
Class {
#name : #BCBeautifulCommentsSettingsTest,
#superclass : #TestCase,
#name : 'BCBeautifulCommentsSettingsTest',
#superclass : 'TestCase',
#instVars : [
'subject'
],
#category : #'BeautifulComments-Tests'
#category : 'BeautifulComments-Tests',
#package : 'BeautifulComments',
#tag : 'Tests'
}

{ #category : #running }
{ #category : 'running' }
BCBeautifulCommentsSettingsTest >> setUp [
super setUp.

subject := BeautifulComments.
BCFailingOnPurposeForTestBlock failOnPurpose: true
]

{ #category : #running }
{ #category : 'running' }
BCBeautifulCommentsSettingsTest >> tearDown [

BCFailingOnPurposeForTestBlock failOnPurpose: false.
super tearDown
]

{ #category : #tests }
{ #category : 'tests' }
BCBeautifulCommentsSettingsTest >> testErrorCatch [
"Chech that capture errors is working is working when true"
| comment capturing|
Expand All @@ -37,7 +39,7 @@ BCBeautifulCommentsSettingsTest >> testErrorCatch [
subject captureErrors: capturing
]

{ #category : #tests }
{ #category : 'tests' }
BCBeautifulCommentsSettingsTest >> testNoErrorCatch [
"Chech that capture errors is working is working when true"
| capturing|
Expand All @@ -52,7 +54,7 @@ BCBeautifulCommentsSettingsTest >> testNoErrorCatch [
subject captureErrors: capturing
]

{ #category : #tests }
{ #category : 'tests' }
BCBeautifulCommentsSettingsTest >> testNotRenderingOfMyOwnComment [
"Chech that rendering is working when false"
| comment rendering|
Expand All @@ -69,7 +71,7 @@ This class test that two settings CaptureErrors and Rendering works as intended'
subject rendering: rendering
]

{ #category : #tests }
{ #category : 'tests' }
BCBeautifulCommentsSettingsTest >> testRenderingOfMyOwnComment [
"Chech that rendering is working when true"
| comment rendering|
Expand All @@ -84,7 +86,7 @@ BCBeautifulCommentsSettingsTest >> testRenderingOfMyOwnComment [
subject rendering: rendering
]

{ #category : #tests }
{ #category : 'tests' }
BCBeautifulCommentsSettingsTest >> testThereAreTwoSettings [
"I am an approximation, just making sure the two class variables exist"
self assert: subject classVarNames equals: #(CaptureErrors Rendering)
Expand Down
16 changes: 9 additions & 7 deletions src/BeautifulComments/BCFailingOnPurposeForTestBlock.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,33 @@ Toggle Edit/View comment to see how this is done.
{!failingOnPurpose!}
"
Class {
#name : #BCFailingOnPurposeForTestBlock,
#superclass : #MicAnnotationBlock,
#name : 'BCFailingOnPurposeForTestBlock',
#superclass : 'MicAnnotationBlock',
#classVars : [
'FailOnPurpose'
],
#category : #'BeautifulComments-Tests'
#category : 'BeautifulComments-Tests',
#package : 'BeautifulComments',
#tag : 'Tests'
}

{ #category : #accessing }
{ #category : 'accessing' }
BCFailingOnPurposeForTestBlock class >> failOnPurpose [
FailOnPurpose ifNil: [ FailOnPurpose := false ].
^ FailOnPurpose
]

{ #category : #accessing }
{ #category : 'accessing' }
BCFailingOnPurposeForTestBlock class >> failOnPurpose: aBoolean [
FailOnPurpose := aBoolean
]

{ #category : #accessing }
{ #category : 'accessing' }
BCFailingOnPurposeForTestBlock class >> tag [
^ #failingOnPurpose
]

{ #category : #visiting }
{ #category : 'visiting' }
BCFailingOnPurposeForTestBlock >> accept: aVisitor [
self class failOnPurpose
ifTrue: [ BCFailingOnPurposeForTestError signal ]
Expand Down
8 changes: 5 additions & 3 deletions src/BeautifulComments/BCFailingOnPurposeForTestError.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
I am a dedicated error used to check the the CaptureErrors setting is working as intended
"
Class {
#name : #BCFailingOnPurposeForTestError,
#superclass : #Error,
#category : #'BeautifulComments-Tests'
#name : 'BCFailingOnPurposeForTestError',
#superclass : 'Error',
#category : 'BeautifulComments-Tests',
#package : 'BeautifulComments',
#tag : 'Tests'
}
28 changes: 15 additions & 13 deletions src/BeautifulComments/BeautifulComments.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ I hold preferences for the BeautifulComments (in class variables and methods on
- As per fall of 2021 microdown and microdown support in Pharo is still in active development. Errors can occour! It is possible to set the comment to be robust to errors in the microdown in class comments. This is controlled by the `capture errors`, or through the class side method: 'captureErrors: aBoolean`.
"
Class {
#name : #BeautifulComments,
#superclass : #Object,
#name : 'BeautifulComments',
#superclass : 'Object',
#classVars : [
'CaptureErrors',
'Rendering'
],
#category : #'BeautifulComments-Core'
#category : 'BeautifulComments-Core',
#package : 'BeautifulComments',
#tag : 'Core'
}

{ #category : #settings }
{ #category : 'settings' }
BeautifulComments class >> beautifulCommentsSettingsOn: aBuilder [
"These settings are added to the settings defined in Microdown>>preferencesSettingsOn:"
<systemsettings>
Expand All @@ -34,23 +36,23 @@ BeautifulComments class >> beautifulCommentsSettingsOn: aBuilder [
description: self captureErrorsDocForSetting
]

{ #category : #settings }
{ #category : 'settings' }
BeautifulComments class >> captureErrors [
^ CaptureErrors ifNil: [ CaptureErrors := true ]
]

{ #category : #settings }
{ #category : 'settings' }
BeautifulComments class >> captureErrors: aBoolean [
CaptureErrors := aBoolean
]

{ #category : #settings }
{ #category : 'settings' }
BeautifulComments class >> captureErrorsDocForSetting [

^ 'By default microdown errors in comment text will not cause debugger to open. Turn this of to get debugger to open on errors'
]

{ #category : #rendering }
{ #category : 'rendering' }
BeautifulComments class >> render: aString [
"Render a string, in case of error, just return it."
|composer|
Expand All @@ -64,7 +66,7 @@ BeautifulComments class >> render: aString [
do: [ aString ]
]

{ #category : #rendering }
{ #category : 'rendering' }
BeautifulComments class >> renderComment: aString of: aClassOrPackage [
"Return aString as part of the templated class comment, when rendering is on.
Else aString."
Expand All @@ -75,23 +77,23 @@ BeautifulComments class >> renderComment: aString of: aClassOrPackage [
^ self render: builder contents
]

{ #category : #settings }
{ #category : 'settings' }
BeautifulComments class >> rendering [
^ Rendering ifNil: [ true ]
]

{ #category : #rendering }
{ #category : 'rendering' }
BeautifulComments class >> rendering: aBoolean [
Rendering := aBoolean
]

{ #category : #settings }
{ #category : 'settings' }
BeautifulComments class >> renderingDocForSetting [

^ 'Comments are by default rendered via microdown. When this setting is on, they are rendered as plain string (showing their Microdown definitions).'
]

{ #category : #rendering }
{ #category : 'rendering' }
BeautifulComments class >> richTextComposer [
^ MicRichTextComposer new
textStyler: BeautifulCommentsTextStyler new;
Expand Down
12 changes: 7 additions & 5 deletions src/BeautifulComments/BeautifulCommentsTextStyler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ I define the parameters of rich text styling for comments. I change two things c
- I keep newlines in paragraphs
"
Class {
#name : #BeautifulCommentsTextStyler,
#superclass : #MicTextStyler,
#category : #'BeautifulComments-UI'
#name : 'BeautifulCommentsTextStyler',
#superclass : 'MicTextStyler',
#category : 'BeautifulComments-UI',
#package : 'BeautifulComments',
#tag : 'UI'
}

{ #category : #public }
{ #category : 'public' }
BeautifulCommentsTextStyler >> headerFontSizes [
^ #(18 16 14 12 11 10)
]

{ #category : #'composer styles' }
{ #category : 'composer styles' }
BeautifulCommentsTextStyler >> postTextTreatment: aText [
"See comment in superclass - keep newlines in paragraphs"
^ aText
Expand Down
16 changes: 9 additions & 7 deletions src/BeautifulComments/ClyEditCommentSwitchMorph.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ I can be activated by the keyboard shortcut defined in `ClyRichTextClassCommentE
"
Class {
#name : #ClyEditCommentSwitchMorph,
#superclass : #ClyStatusBarItemMorph,
#name : 'ClyEditCommentSwitchMorph',
#superclass : 'ClyStatusBarItemMorph',
#instVars : [
'checkbox'
],
#category : #'BeautifulComments-Core'
#category : 'BeautifulComments-Core',
#package : 'BeautifulComments',
#tag : 'Core'
}

{ #category : #building }
{ #category : 'building' }
ClyEditCommentSwitchMorph >> build [

checkbox := CheckboxMorph
Expand All @@ -28,18 +30,18 @@ ClyEditCommentSwitchMorph >> build [
self addMorph: checkbox
]

{ #category : #accessing }
{ #category : 'accessing' }
ClyEditCommentSwitchMorph >> definitionTypeLabel [
^ 'Toggle Edit / View comment'
]

{ #category : #building }
{ #category : 'building' }
ClyEditCommentSwitchMorph >> status [

^ ownerTool isRendering
]

{ #category : #operations }
{ #category : 'operations' }
ClyEditCommentSwitchMorph >> toggle [
ownerTool toggleMode.
ownerTool update
Expand Down
Loading

0 comments on commit 2f22501

Please sign in to comment.