-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #889 from pillar-markup/IntroduceRawParagraph
Introduce raw paragraph
- Loading branch information
Showing
30 changed files
with
215 additions
and
59 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
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
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
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
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
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
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
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
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
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,74 @@ | ||
Class { | ||
#name : 'MicRawParagraphBlockTest', | ||
#superclass : 'MicBlockTest', | ||
#category : 'Microdown-Tests', | ||
#package : 'Microdown-Tests' | ||
} | ||
|
||
{ #category : 'tests' } | ||
MicRawParagraphBlockTest >> subjectClass [ | ||
^ MicRawParagraphBlock | ||
] | ||
|
||
{ #category : 'tests' } | ||
MicRawParagraphBlockTest >> testASimpleRawParagraph [ | ||
| mic | | ||
mic := (parser parse: '<title> | ||
No idea what it is :) | ||
</title>') children first. | ||
self assert: mic class equals: MicRawParagraphBlock. | ||
self assert: mic label equals: 'title'. | ||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
MicRawParagraphBlockTest >> testNotASimpleRawParagraph [ | ||
| mic | | ||
mic := (parser parse: '<toto> | ||
No idea what it is :) | ||
</toto>') children first. | ||
self assert: mic class equals: MicParagraphBlock. | ||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
MicRawParagraphBlockTest >> testNotASimpleRawParagraphNoSpaceInFrontToClose [ | ||
| children | | ||
children := (parser parse: '<title> | ||
No idea what it is :) | ||
</title> | ||
And after we get a paragraph') children. | ||
self assert: children size equals: 1. | ||
"so far we eat as much as we can and put everything in the raw" | ||
|
||
|
||
self assert: children first class equals: MicRawParagraphBlock. | ||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
MicRawParagraphBlockTest >> testRawParagraphCannotBeNested [ | ||
| children | | ||
children := (parser parse: '<title> | ||
No idea what it is :) | ||
<button> | ||
hkhkjhkj | ||
</button> | ||
</title>') children. | ||
self assert: children size equals: 1. | ||
self assert: children first class equals: MicRawParagraphBlock. | ||
self assert: children first label equals: 'title'. | ||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
MicRawParagraphBlockTest >> testThereIsNoValidationIfThetagStartWithAKnowHtml [ | ||
| mic | | ||
mic := (parser parse: '<titleunkniw> | ||
No idea what it is :) | ||
</titleunkniw>') children first. | ||
self assert: mic class equals: MicRawParagraphBlock. | ||
|
||
] |
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
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
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
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
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
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
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
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
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
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
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
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
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
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,12 @@ | ||
Class { | ||
#name : 'MicMailtoResourceReference', | ||
#superclass : 'MicAbsoluteResourceReference', | ||
#category : 'Microdown-Core', | ||
#package : 'Microdown', | ||
#tag : 'Core' | ||
} | ||
|
||
{ #category : 'instance creation' } | ||
MicMailtoResourceReference class >> handlesUriScheme: scheme [ | ||
^ scheme beginsWith: 'mailto' | ||
] |
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
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,37 @@ | ||
Class { | ||
#name : 'MicRawParagraphBlock', | ||
#superclass : 'MicStartStopMarkupBlock', | ||
#instVars : [ | ||
'label' | ||
], | ||
#category : 'Microdown-Extensions', | ||
#package : 'Microdown', | ||
#tag : 'Extensions' | ||
} | ||
|
||
{ #category : 'handle' } | ||
MicRawParagraphBlock >> bodyFromLine: line [ | ||
|
||
(self doesLineStartWithStopMarkup: line) | ||
ifTrue: [ isClosed := true ] | ||
ifFalse: [ body := body ifNil: [ line ] ifNotNil: [ body , String cr , line ] ] | ||
] | ||
|
||
{ #category : 'handle' } | ||
MicRawParagraphBlock >> extractFirstLineFrom: line [ | ||
"we cannot know in advance the markup so we have to guess and store it for closing." | ||
|
||
label := line allButFirst copyUpToSubstring: '>' | ||
|
||
] | ||
|
||
{ #category : 'accessing' } | ||
MicRawParagraphBlock >> label [ | ||
^ label | ||
] | ||
|
||
{ #category : 'markups' } | ||
MicRawParagraphBlock >> lineStopMarkup [ | ||
|
||
^ '</', label, '>' | ||
] |
Oops, something went wrong.