-
Notifications
You must be signed in to change notification settings - Fork 31
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
Issue 846 better syntax for annotated paragraph #865
Changes from 5 commits
d53eea5
39cd94f
86f06a1
dd2a0ec
360964d
6c3bce6
f67f140
14d2c52
d199cee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,14 +18,18 @@ MicAbstractAnnotatedBlock >> addLineAndReturnNextNode: line [ | |
ifTrue: [ ^ self ]. | ||
label | ||
ifNil: [ | ||
| indexOfFirstSpace | | ||
indexOfFirstSpace := line indexOf: Character space. | ||
label := indexOfFirstSpace = 0 | ||
ifTrue: [ '' ] | ||
ifFalse: [line copyFrom: self lineMarkup size + 1 to: indexOfFirstSpace - 1.]. | ||
body := (line copyFrom: indexOfFirstSpace + 1 to: line size) trim.] | ||
ifNotNil: [ body = '' ifTrue: [ body := body , line ] | ||
ifFalse: [ body := body , String cr , line ]] | ||
| indexOfFirstClosingBracket | | ||
indexOfFirstClosingBracket := line indexOf: $]. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder what is the impact if the line does not contain ] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After getting the index of the first ], I test if he egal to 0. indexOfFirstClosingBracket = 0 |
||
label := indexOfFirstClosingBracket = 0 | ||
ifTrue: [ parent children removeLast. ^ self createMicBlockQuoteBlock: line ] | ||
ifFalse: [line copyFrom: self lineMarkup size + 1 to: indexOfFirstClosingBracket - 1. | ||
]. | ||
label := label trim] | ||
ifNotNil: [ | treatedLine | | ||
treatedLine := self extractLine: line. | ||
body := body | ||
ifNil: [ treatedLine ] | ||
ifNotNil: [ body , String cr , treatedLine ]] | ||
] | ||
|
||
{ #category : 'accessing' } | ||
|
@@ -41,6 +45,22 @@ MicAbstractAnnotatedBlock >> canConsumeLine: line [ | |
^ line isNotEmpty | ||
] | ||
|
||
{ #category : 'as yet unclassified' } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could categorize the method. |
||
MicAbstractAnnotatedBlock >> createMicBlockQuoteBlock: line [ | ||
|
||
^ MicBlockQuoteBlock new | ||
setParser: parser; | ||
parent: parent; | ||
addLineAndReturnNextNode: line | ||
|
||
|
||
] | ||
|
||
{ #category : 'actions' } | ||
MicAbstractAnnotatedBlock >> extractLine: line [ | ||
^ (line copyFrom: 2 to: line size) trim | ||
] | ||
|
||
{ #category : 'initialization' } | ||
MicAbstractAnnotatedBlock >> initialize [ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nice test :)