-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Acquire all the buildMicroDownUsing: aBuilder withComment: aString me…
…thods from Microdown. It should not be packaged in Microdown but with BeautifulComment. We have old issues about this method in BC so I have no idea why they ended up in Microdown
- Loading branch information
Showing
10 changed files
with
175 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Extension { #name : 'BaselineOf' } | ||
|
||
{ #category : '*BeautifulComments' } | ||
BaselineOf class >> buildMicroDownUsing: aBuilder withComment: aString [ | ||
aBuilder | ||
header: [ aBuilder text: self name ] withLevel: 1; | ||
horizontalLine; | ||
text: 'A baseline is a kind of map to load project.'; | ||
newLine; | ||
header: [ aBuilder text: 'Description' ] withLevel: 3; | ||
text: aString; | ||
newLine; | ||
header: [ aBuilder text: 'Dependencies' ] withLevel: 3. | ||
|
||
(self instanceSide includesLocalSelector: #baseline:) | ||
ifTrue: [ aBuilder | ||
codeblockTag: 'pharo' | ||
withBody: (self instanceSide sourceCodeAt: #baseline:) ] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Extension { #name : 'Class' } | ||
|
||
{ #category : '*BeautifulComments' } | ||
Class >> buildMicroDownUsing: aBuilder withComment: aString [ | ||
|
||
aBuilder | ||
header: [ aBuilder text: 'Class: '. | ||
aBuilder text: self name ] withLevel: 1; | ||
horizontalLine; | ||
text: aString. | ||
|
||
self addDocumentSectionExampleCodeTo: aBuilder. | ||
|
||
self | ||
addDocumentSectionTo: aBuilder | ||
label: 'Examples' | ||
methods: (self class methods select: [ :each | each protocol = self documentExamplesProtocol ]) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Extension { #name : 'MicAnnotationBlock' } | ||
|
||
{ #category : '*BeautifulComments' } | ||
MicAnnotationBlock class >> buildMicroDownUsing: aBuilder withComment: aString [ | ||
|
||
super buildMicroDownUsing: aBuilder withComment: aString. | ||
self addDocumentDefinedAnnotations: aBuilder | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Extension { #name : 'MicElement' } | ||
|
||
{ #category : '*BeautifulComments' } | ||
MicElement class >> buildMicroDownUsing: aBuilder withComment: aComment [ | ||
| visitSelector visitors | | ||
super buildMicroDownUsing: aBuilder withComment: aComment. | ||
visitSelector := ('visit', | ||
((self name withoutSuffix: 'Block') | ||
copyWithoutFirst trimLeft: [ :char | char isLowercase ] ), | ||
':' ) asSymbol. | ||
visitors := MicrodownVisitor allSubclasses | ||
select: [ :class | class includesSelector: visitSelector ]. | ||
aBuilder newLine. | ||
aBuilder header: [ aBuilder text:'Visitors using me:' ] withLevel: 2. | ||
visitors | ||
ifEmpty: [ | ||
aBuilder text: 'I found no one implementing a ', | ||
visitSelector, | ||
' - perhaps I am abstract or the visitor is unconventionally named' ] | ||
ifNotEmpty: [ | ||
aBuilder unorderedListDuring: [ | ||
visitors do: [:class | aBuilder item: [ aBuilder monospace: (class name, '>>#', visitSelector ) ]]]] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Extension { #name : 'MicEnvironmentBlock' } | ||
|
||
{ #category : '*BeautifulComments' } | ||
MicEnvironmentBlock class >> buildMicroDownUsing: aBuilder withComment: aString [ | ||
|
||
super buildMicroDownUsing: aBuilder withComment: aString. | ||
self addDocumentDefinedEnvironments: aBuilder | ||
] |
16 changes: 16 additions & 0 deletions
16
src/BeautifulComments/MicRichTextCodeBlockStyler.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Extension { #name : 'MicRichTextCodeBlockStyler' } | ||
|
||
{ #category : '*BeautifulComments' } | ||
MicRichTextCodeBlockStyler class >> buildMicroDownUsing: aBuilder withComment: aComment [ | ||
super buildMicroDownUsing: aBuilder withComment: aComment. | ||
"Only add this list here, not in my subclasses" | ||
self = MicRichTextCodeBlockStyler ifFalse: [ ^ self ]. | ||
aBuilder newLine. | ||
aBuilder header: [ aBuilder text: 'Subclasses implementing stylers:' ] withLevel: 2. | ||
aBuilder unorderedListDuring: [ | ||
self allSubclasses do: [ :class | | ||
aBuilder item: [ | ||
aBuilder text: (class styleTags joinUsing: ', ' last: ' and '), ' is implemented by ' . | ||
aBuilder monospace: (class name)] | ||
]] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Extension { #name : 'Package' } | ||
|
||
{ #category : '*BeautifulComments' } | ||
Package >> buildMicroDownUsing: aBuilder withComment: aString [ | ||
|
||
"I'm on a package and the package is a baseline package." | ||
self class environment | ||
at: self name | ||
ifPresent: [ :cls | | ||
aBuilder | ||
header: [ aBuilder text: self name ] withLevel: 1; | ||
horizontalLine; | ||
text: 'A baseline is a kind of map to load project.'; | ||
newLine; | ||
header: [ aBuilder text: 'Description' ] withLevel: 3; | ||
text: aString; | ||
newLine; | ||
header: [ aBuilder text: 'Dependencies' ] withLevel: 3; | ||
codeblockTag: 'pharo' | ||
withBody: | ||
(cls | ||
sourceCodeAt: #baseline: | ||
ifAbsent: [ 'No baseline! Houston we have a problem' ]) ] | ||
ifAbsent: [ aBuilder | ||
header: [ | ||
aBuilder | ||
text: 'Package: '; | ||
text: self name ] | ||
withLevel: 1; | ||
horizontalLine; | ||
text: aString ] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Extension { #name : 'RGBehavior' } | ||
|
||
{ #category : '*BeautifulComments' } | ||
RGBehavior >> buildMicroDownUsing: aMicMicrodownTextualBuilder withComment: aString [ | ||
|
||
aMicMicrodownTextualBuilder | ||
header: [ aMicMicrodownTextualBuilder text: 'Class: '. | ||
aMicMicrodownTextualBuilder text: self name ] withLevel: 1; | ||
horizontalLine; | ||
text: aString | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Extension { #name : 'RGPackage' } | ||
|
||
{ #category : '*BeautifulComments' } | ||
RGPackage >> buildMicroDownUsing: aMicMicrodownTextualBuilder withComment: aString [ | ||
|
||
aMicMicrodownTextualBuilder | ||
header: [ aMicMicrodownTextualBuilder text: 'Class: '. | ||
aMicMicrodownTextualBuilder text: self name ] withLevel: 1; | ||
horizontalLine; | ||
text: aString | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Extension { #name : 'TestCase' } | ||
|
||
{ #category : '*BeautifulComments' } | ||
TestCase class >> buildMicroDownUsing: aBuilder withComment: aString [ | ||
|
||
| number | | ||
number := self allTestSelectors size. | ||
aBuilder | ||
header: [ aBuilder text: self name ] withLevel: 1; | ||
horizontalLine; | ||
header: [ aBuilder text: 'Description' ] withLevel: 3; | ||
text: aString; | ||
newLine; | ||
header: [ aBuilder text: 'Tests' ] withLevel: 3; | ||
text: 'This test suite '. | ||
number isZero | ||
ifTrue: [ ^ aBuilder text: 'has no test methods.']. | ||
|
||
aBuilder | ||
text: 'defines ', number asString, ' test method'. | ||
number = 1 | ||
ifFalse: [ aBuilder text: 's' ]. | ||
aBuilder text: ':'. | ||
|
||
aBuilder | ||
newLine; | ||
unorderedListDuring: [ self testSelectors | ||
do: [ :each | aBuilder item: [ aBuilder monospace: (self class instanceSide name , '>>#' , each) asString ] ]] | ||
] |