Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename MicAnnotatedParagraph to MicAnnotatedParagraphBlock #866

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading