Skip to content

Commit

Permalink
Merge pull request #866 from moufort/864-Rename-MicAnnotatedParagraph…
Browse files Browse the repository at this point in the history
…-into-MicAnnotatedParagraphBlock

Rename MicAnnotatedParagraph to MicAnnotatedParagraphBlock
  • Loading branch information
Ducasse authored Aug 23, 2024
2 parents e6cfb92 + 16b8ea3 commit 0587e24
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
Class {
#name : 'MicAnnotatedParagraphTest',
#name : 'MicAnnotatedParagraphBlockTest',
#superclass : 'MicBlockTest',
#category : 'Microdown-Tests-Parser',
#package : 'Microdown-Tests',
#tag : 'Parser'
}

{ #category : 'tests' }
MicAnnotatedParagraphTest >> subjectClass [
^ MicAnnotatedParagraph
MicAnnotatedParagraphBlockTest >> subjectClass [
^ MicAnnotatedParagraphBlock
]

{ #category : 'tests' }
MicAnnotatedParagraphTest >> testBasicAnnotetedParagraph [
MicAnnotatedParagraphBlockTest >> testBasicAnnotetedParagraph [

| root annotatedParagraph |
root := parser parse: '>[! important ]
> This is an important information'.
self assert: root children size equals: 1.
annotatedParagraph := root children first.
self
assert: (annotatedParagraph isKindOf: MicAnnotatedParagraph);
assert: (annotatedParagraph isKindOf: MicAnnotatedParagraphBlock);
assert: annotatedParagraph label equals: 'important';
assert: annotatedParagraph text
equals: 'This is an important information'
]

{ #category : 'tests' }
MicAnnotatedParagraphTest >> testBasicAnnotetedParagraphIgnoreExtraTextInFirstLine [
MicAnnotatedParagraphBlockTest >> testBasicAnnotetedParagraphIgnoreExtraTextInFirstLine [

| root annotatedParagraph |
root := parser parse: '>[! important ] This is an important information
> This is an other information'.
self assert: root children size equals: 1.
annotatedParagraph := root children first.
self
assert: (annotatedParagraph isKindOf: MicAnnotatedParagraph);
assert: (annotatedParagraph isKindOf: MicAnnotatedParagraphBlock);
assert: annotatedParagraph label equals: 'important';
assert: annotatedParagraph text
equals: 'This is an other information'
]

{ #category : 'tests' }
MicAnnotatedParagraphTest >> testBasicAnnotetedParagraphWhitoutClosingBracket [
MicAnnotatedParagraphBlockTest >> testBasicAnnotetedParagraphWhitoutClosingBracket [

| root annotatedParagraph |
root := parser parse: '>[! important
Expand All @@ -54,52 +54,52 @@ MicAnnotatedParagraphTest >> testBasicAnnotetedParagraphWhitoutClosingBracket [
]

{ #category : 'tests' }
MicAnnotatedParagraphTest >> testBasicAnnotetedParagraphWithALineBreak [
MicAnnotatedParagraphBlockTest >> testBasicAnnotetedParagraphWithALineBreak [

| root annotatedParagraph |
root := parser parse: '>[! important ]
> This is an important information'.
self assert: root children size equals: 1.
annotatedParagraph := root children first.
self
assert: (annotatedParagraph isKindOf: MicAnnotatedParagraph);
assert: (annotatedParagraph isKindOf: MicAnnotatedParagraphBlock);
assert: annotatedParagraph label equals: 'important';
assert: annotatedParagraph text
equals: 'This is an important information'
]

{ #category : 'tests' }
MicAnnotatedParagraphTest >> testBasicAnnotetedParagraphWithANonSupportedLabel [
MicAnnotatedParagraphBlockTest >> testBasicAnnotetedParagraphWithANonSupportedLabel [

| root annotatedParagraph |
root := parser parse: '>[! test ]
> This is an important information'.
self assert: root children size equals: 1.
annotatedParagraph := root children first.
self
assert: (annotatedParagraph isKindOf: MicAnnotatedParagraph);
assert: (annotatedParagraph isKindOf: MicAnnotatedParagraphBlock);
assert: annotatedParagraph label equals: 'note';
assert: annotatedParagraph text
equals: 'test This is an important information'
]

{ #category : 'tests' }
MicAnnotatedParagraphTest >> testBasicAnnotetedParagraphWithANonSupportedLabelWithUpperCase [
MicAnnotatedParagraphBlockTest >> testBasicAnnotetedParagraphWithANonSupportedLabelWithUpperCase [

| root annotatedParagraph |
root := parser parse: '>[! Test ]
> This is an important information'.
self assert: root children size equals: 1.
annotatedParagraph := root children first.
self
assert: (annotatedParagraph isKindOf: MicAnnotatedParagraph);
assert: (annotatedParagraph isKindOf: MicAnnotatedParagraphBlock);
assert: annotatedParagraph label equals: 'note';
assert: annotatedParagraph text
equals: 'Test This is an important information'
]

{ #category : 'tests' }
MicAnnotatedParagraphTest >> testBasicAnnotetedParagraphWithBlodText [
MicAnnotatedParagraphBlockTest >> testBasicAnnotetedParagraphWithBlodText [

| root annotatedParagraph |
root := parser parse:
Expand All @@ -108,7 +108,7 @@ MicAnnotatedParagraphTest >> testBasicAnnotetedParagraphWithBlodText [
self assert: root children size equals: 1.
annotatedParagraph := root children first.
self
assert: (annotatedParagraph isKindOf: MicAnnotatedParagraph);
assert: (annotatedParagraph isKindOf: MicAnnotatedParagraphBlock);
assert: annotatedParagraph label equals: 'important';
assert: annotatedParagraph textElements size equals: 3;
assert:
Expand All @@ -119,15 +119,15 @@ MicAnnotatedParagraphTest >> testBasicAnnotetedParagraphWithBlodText [
]

{ #category : 'tests' }
MicAnnotatedParagraphTest >> testBasicAnnotetedParagraphWithLabelHavingUpperCase [
MicAnnotatedParagraphBlockTest >> testBasicAnnotetedParagraphWithLabelHavingUpperCase [

| root annotatedParagraph |
root := parser parse: '>[! ImporTanT ]
> This is an important information'.
self assert: root children size equals: 1.
annotatedParagraph := root children first.
self
assert: (annotatedParagraph isKindOf: MicAnnotatedParagraph);
assert: (annotatedParagraph isKindOf: MicAnnotatedParagraphBlock);
assert: annotatedParagraph label equals: 'important';
assert: annotatedParagraph text
equals: 'This is an important information'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ For example, we cannot currently add lists inside an annotatedBlock.
See [https://github.com/pillar-markup/MicroDown/issues/54](https://github.com/pillar-markup/MicroDown/issues/54)
"
Class {
#name : 'MicAnnotatedParagraph',
#name : 'MicAnnotatedParagraphBlock',
#superclass : 'MicAbstractAnnotatedBlock',
#instVars : [
'validLabels'
Expand All @@ -22,51 +22,51 @@ Class {
}

{ #category : 'visiting' }
MicAnnotatedParagraph >> accept: aVisitor [
MicAnnotatedParagraphBlock >> accept: aVisitor [
^ aVisitor visitAnnotated: self
]

{ #category : 'parse support' }
MicAnnotatedParagraph >> closeMe [
MicAnnotatedParagraphBlock >> closeMe [
super closeMe.
self verifyLabel.
body := self inlineParse: body
]

{ #category : 'testing' }
MicAnnotatedParagraph >> defaultLabel [
MicAnnotatedParagraphBlock >> defaultLabel [

^ #note
]

{ #category : 'testing' }
MicAnnotatedParagraph >> initialize [
MicAnnotatedParagraphBlock >> initialize [

super initialize.
validLabels := { #note. #important. #todo }
]

{ #category : 'testing' }
MicAnnotatedParagraph >> lineMarkup [
MicAnnotatedParagraphBlock >> lineMarkup [

^ AnnotatedParagraphMarkup
]

{ #category : 'accessing' }
MicAnnotatedParagraph >> text [
MicAnnotatedParagraphBlock >> text [

^ String streamContents: [ :s |
self textElements do: [ :each | s nextPutAll: each plainText ] ]
]

{ #category : 'accessing' }
MicAnnotatedParagraph >> textElements [
MicAnnotatedParagraphBlock >> textElements [

^ self body
]

{ #category : 'parse support' }
MicAnnotatedParagraph >> verifyLabel [
MicAnnotatedParagraphBlock >> verifyLabel [

| isValid |
isValid := validLabels includes: label asLowercase.
Expand Down
2 changes: 1 addition & 1 deletion src/Microdown/MicrodownParser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ MicrodownParser >> initialize [
dispatchTable at: AnchorMarkup put: MicAnchorBlock.
dispatchTable at: HeaderMarkup put: MicHeaderBlock.
dispatchTable at: CodeblockMarkup put: MicAbstractCodeBlock.
dispatchTable at: AnnotatedParagraphMarkup put: MicAnnotatedParagraph.
dispatchTable at: AnnotatedParagraphMarkup put: MicAnnotatedParagraphBlock.
dispatchTable at: CommentedLineMarkup put: MicCommentBlock.
dispatchTable at: HorizontalLineMarkup put: MicHorizontalLineBlock.
dispatchTable at: MathOpeningBlockMarkup put: MicMathBlock.
Expand Down

0 comments on commit 0587e24

Please sign in to comment.