-
Notifications
You must be signed in to change notification settings - Fork 31
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 #887 from pillar-markup/revert-844-lineBreak
Revert "Line break"
- Loading branch information
Showing
23 changed files
with
258 additions
and
239 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,18 @@ | ||
" | ||
Constants to be used on the extended parser. | ||
" | ||
Class { | ||
#name : 'MacConstants', | ||
#superclass : 'SharedPool', | ||
#classVars : [ | ||
'InlineParagraphDelimiter' | ||
], | ||
#category : 'Microdown-Macrodown', | ||
#package : 'Microdown-Macrodown' | ||
} | ||
|
||
{ #category : 'initialization' } | ||
MacConstants class >> initialize [ | ||
|
||
InlineParagraphDelimiter := ' ' | ||
] |
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,55 @@ | ||
" | ||
Inline parser to detect and parse extended parse functionality. | ||
- line break with two (or more) spaces. | ||
" | ||
Class { | ||
#name : 'MacInlineParser', | ||
#superclass : 'MicInlineParser', | ||
#pools : [ | ||
'MacConstants' | ||
], | ||
#category : 'Microdown-Macrodown', | ||
#package : 'Microdown-Macrodown' | ||
} | ||
|
||
{ #category : 'adding' } | ||
MacInlineParser >> addLineBreakInlineBlock: indexOfAssociateOpener [ | ||
| startIndex endIndex | | ||
|
||
startIndex := opener index + opener size. | ||
endIndex := string indexOf: Character cr startingAt: startIndex. | ||
(endIndex = 0 | ||
or: [ (endIndex - startIndex) = 0 ]) | ||
ifTrue: [ ^ self ]. | ||
|
||
self | ||
addInlineBlock: indexOfAssociateOpener | ||
from: startIndex | ||
to: endIndex | ||
] | ||
|
||
{ #category : 'private' } | ||
MacInlineParser >> extentedDelimiters [ | ||
|
||
^ { MacLineBreakDelimiter } | ||
] | ||
|
||
{ #category : 'actions' } | ||
MacInlineParser >> identifyMarkupFor: aString [ | ||
|
||
^ self extentedDelimiters | ||
detect: [ :each | each matches: aString ] | ||
ifFound: [ :aDelimiterClass | | ||
delimiterClass := aDelimiterClass. | ||
aDelimiterClass applyOn: self ] | ||
ifNone: [ super identifyMarkupFor: aString ] | ||
] | ||
|
||
{ #category : 'applying' } | ||
MacInlineParser >> processLineBreak [ | ||
|
||
self delimiterFoundProcess. | ||
self addInlineBlock: (self findType: delimiterClass type). | ||
^ result last text size | ||
] |
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,76 @@ | ||
" | ||
Delimiter definition for line break. | ||
" | ||
Class { | ||
#name : 'MacLineBreakDelimiter', | ||
#superclass : 'MicAbstractDelimiter', | ||
#category : 'Microdown-Macrodown', | ||
#package : 'Microdown-Macrodown' | ||
} | ||
|
||
{ #category : 'applying' } | ||
MacLineBreakDelimiter class >> applyOn: inlineParser [ | ||
|
||
^ inlineParser processLineBreak | ||
] | ||
|
||
{ #category : 'accessing' } | ||
MacLineBreakDelimiter class >> associatedInlineBlock [ | ||
|
||
^ MacLineBreakBlock | ||
] | ||
|
||
{ #category : 'accessing' } | ||
MacLineBreakDelimiter class >> isCloser [ | ||
|
||
^ true | ||
] | ||
|
||
{ #category : 'accessing' } | ||
MacLineBreakDelimiter class >> isOpener [ | ||
|
||
^ true | ||
] | ||
|
||
{ #category : 'accessing' } | ||
MacLineBreakDelimiter class >> markup [ | ||
|
||
^ #lineBreak | ||
] | ||
|
||
{ #category : 'testing' } | ||
MacLineBreakDelimiter class >> matches: aString [ | ||
| indexOfCr | | ||
|
||
(aString size >= 3) ifFalse: [ ^ false ]. | ||
|
||
indexOfCr := (aString indexOf: Character cr) - 1. | ||
indexOfCr < 2 ifTrue: [ ^ false ]. | ||
|
||
^ (aString first: indexOfCr) allSatisfy: [ :each | each = Character space ] | ||
] | ||
|
||
{ #category : 'accessing' } | ||
MacLineBreakDelimiter class >> size [ | ||
|
||
^ 1 | ||
] | ||
|
||
{ #category : 'accessing' } | ||
MacLineBreakDelimiter class >> type [ | ||
|
||
^ #lineBreak | ||
] | ||
|
||
{ #category : 'adding' } | ||
MacLineBreakDelimiter >> addInlineBlock: anIndex to: inlineParser [ | ||
|
||
inlineParser addLineBreakInlineBlock: anIndex | ||
|
||
] | ||
|
||
{ #category : 'accessing' } | ||
MacLineBreakDelimiter >> endIndex [ | ||
|
||
^ self index + self size | ||
] |
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,53 @@ | ||
" | ||
A raw paragraph block is a block that containes raw content (e.g. plain HTML) | ||
" | ||
Class { | ||
#name : 'MacRawParagraphBlock', | ||
#superclass : 'MicParagraphBlock', | ||
#category : 'Microdown-Macrodown', | ||
#package : 'Microdown-Macrodown' | ||
} | ||
|
||
{ #category : 'private' } | ||
MacRawParagraphBlock class >> htmlTags [ | ||
|
||
^ #('!--' 'a' 'abbr' 'address' 'area' 'article' 'aside' 'audio' 'b' 'base' 'bdi' 'bdo' 'blockquote' 'body' 'br' 'button' 'canvas' 'caption' 'cite' 'code' 'col' 'colgroup' 'data' 'datalist' 'dd' 'del' 'details' 'dfn' 'dialog' 'div' 'dl' 'dt' 'em' 'embed' 'fieldset' 'figcaption' 'figure' 'footer' 'form' 'h1' 'h2' 'h3' 'h4' 'h5' 'h6' 'head' 'header' 'hgroup' 'hr' 'html' 'i' 'iframe' 'img' 'input' 'ins' 'kbd' 'label' 'legend' 'li' 'link' 'main' 'map' 'mark' 'menu' 'meta' 'meter' 'nav' 'noscript' 'object' 'ol' 'optgroup' 'option' 'output' 'p' 'param' 'picture' 'pre' 'progress' 'q' 'rb' 'rp' 'rt' 'rtc' 'ruby' 's' 'samp' 'script' 'section' 'select' 'slot' 'small' 'source' 'span' 'strong' 'style' 'sub' 'summary' 'sup' 'table' 'tbody' 'td' 'template' 'textarea' 'tfoot' 'th' 'thead' 'time' 'title' 'tr' 'track' 'u' 'ul' 'var' 'video' 'wbr') | ||
] | ||
|
||
{ #category : 'testing' } | ||
MacRawParagraphBlock class >> matches: aString [ | ||
|
||
^ self matches: aString trimLeft withAnyOf: self htmlTags | ||
] | ||
|
||
{ #category : 'private' } | ||
MacRawParagraphBlock class >> matches: aString withAnyOf: htmlTags [ | ||
|
||
aString ifEmpty: [ ^ false ]. | ||
^ (aString first = $<) | ||
and: [ htmlTags includes: (aString readStream upToAnyOf: '> ') allButFirst ] | ||
] | ||
|
||
{ #category : 'testing' } | ||
MacRawParagraphBlock class >> matchesComment: aString [ | ||
|
||
^ self | ||
matches: aString trimLeft | ||
withAnyOf: { self htmlTags first } | ||
] | ||
|
||
{ #category : 'visiting' } | ||
MacRawParagraphBlock >> accept: aVisitor [ | ||
|
||
^ aVisitor visitRawParagraph: self | ||
] | ||
|
||
{ #category : 'parse support' } | ||
MacRawParagraphBlock >> closeMe [ | ||
|
||
self children: { | ||
MicRawBlock | ||
from: 1 | ||
to: text size | ||
withSubstring: text } | ||
] |
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,13 @@ | ||
Extension { #name : 'MicAbstractDelimiter' } | ||
|
||
{ #category : '*Microdown-Macrodown' } | ||
MicAbstractDelimiter classSide >> applyOn: inlineParser [ | ||
|
||
self subclassResponsibility | ||
] | ||
|
||
{ #category : '*Microdown-Macrodown' } | ||
MicAbstractDelimiter classSide >> matches: aString [ | ||
|
||
^ false | ||
] |
13 changes: 13 additions & 0 deletions
13
src/Microdown-Macrodown/MicMicrodownObjectToPillarObjectConverter.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,13 @@ | ||
Extension { #name : 'MicMicrodownObjectToPillarObjectConverter' } | ||
|
||
{ #category : '*Microdown-Macrodown' } | ||
MicMicrodownObjectToPillarObjectConverter >> visitLineBreak: aBreak [ | ||
|
||
^ PRLineBreak new | ||
] | ||
|
||
{ #category : '*Microdown-Macrodown' } | ||
MicMicrodownObjectToPillarObjectConverter >> visitRawParagraph: aRawParagraph [ | ||
|
||
^ PRRaw content: aRawParagraph text | ||
] |
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 @@ | ||
Extension { #name : 'MicrodownVisitor' } | ||
|
||
{ #category : '*Microdown-Macrodown' } | ||
MicrodownVisitor >> visitLineBreak: aBreak [ | ||
|
||
] | ||
|
||
{ #category : '*Microdown-Macrodown' } | ||
MicrodownVisitor >> visitRawParagraph: aRawParagraph [ | ||
|
||
^ self visitChildrenOf: aRawParagraph | ||
] |
33 changes: 0 additions & 33 deletions
33
src/Microdown-NewMacrodown/MacMicrodownSharedPool.class.st
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.