Skip to content

Commit

Permalink
most features working, added positions for styling to the blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
cdfhalle committed Jul 4, 2021
1 parent 379114b commit cfba4ab
Show file tree
Hide file tree
Showing 83 changed files with 264 additions and 269 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ createNew: aParsingState
newHeading := ((self newWithOutClosingTagFrom: aParsingState currentLine)
ifNil: [self newWithClosingTagFrom: aParsingState currentLine])
ifNil: [^ 0].
aParsingState
newBlock: newHeading;
reduceCurrentLineTo: ''.
newHeading startPosition: aParsingState charPos.
aParsingState newBlock: newHeading.
aParsingState newBlock innerLine: ''.
^ 2.


Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"class" : {
"createNew:" : "C.H. 6/30/2021 16:05",
"newFrom:" : "C.H. 6/14/2021 15:13",
"createNew:" : "C.H. 7/3/2021 21:05",
"newWithClosingTagFrom:" : "C.H. 6/30/2021 20:50",
"newWithOutClosingTagFrom:" : "C.H. 6/30/2021 20:51" },
"instance" : {
Expand Down
Empty file.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
newStrat
accessing
acceptsLines

^ self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
accessing
applying
adaptToDocumentWith: aParsingState

aParsingState tip addChild: self.
aParsingState tip: self.

aParsingState tip addChild: self withState: aParsingState.
aParsingState tip: self.
aParsingState reduceCurrentLineTo: self innerLine.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
applying
addChild: aBlock withState: aParsingState

(self canContain: aBlock)
ifFalse: [self finalize: aParsingState.
self beClosed.
^ self container addChild: aBlock withState: aParsingState].
self appendChild: aBlock.
^ aBlock.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
debugging
asString

^ self asStringWithIndent: ''
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
applying
closeUnsuitableFor: aBlock withState: aParsingState

(self canContain: aBlock)
ifFalse: [self finalize: aParsingState.
self beClosed.
^ self container closeUnsuitableFor: aBlock withState: aParsingState].
^ aBlock.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
newStrat
applying
continue: aParserState

^ self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
endPosition: anObject
endPosition := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
endPosition
^ endPosition
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
applying
finalize: aParsingState

^ self
self endPosition: aParsingState charPos - 1.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
innerLine: anObject
innerLine := anObject
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
accessing
innerLine

^ innerLine
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
lastChild

^ self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
startPosition: anObject
startPosition := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
startPosition
^ startPosition
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,23 @@
"createNew:" : "C.H. 7/1/2021 12:02" },
"instance" : {
"acceptsLines" : "C.H. 6/29/2021 09:50",
"adaptToDocumentWith:" : "C.H. 7/1/2021 12:17",
"addChild:" : "C.H. 7/1/2021 15:21",
"adaptToDocumentWith:" : "C.H. 7/3/2021 21:10",
"addChild:withState:" : "C.H. 7/3/2021 20:21",
"asString" : "C.H. 6/14/2021 16:33",
"beClosed" : "JE 6/16/2021 13:07",
"beOpen" : "JE 6/16/2021 13:07",
"canContain:" : "C.H. 6/30/2021 15:32",
"closeUnsuitableFor:withState:" : "C.H. 7/3/2021 20:41",
"container" : "C.H. 6/23/2021 17:13",
"container:" : "C.H. 6/23/2021 17:13",
"continue:" : "C.H. 6/26/2021 20:23",
"finalize:" : "C.H. 6/29/2021 10:13",
"endPosition" : "C.H. 7/2/2021 15:55",
"endPosition:" : "C.H. 7/2/2021 15:55",
"finalize:" : "C.H. 7/4/2021 10:26",
"initialize" : "C.H. 7/1/2021 14:53",
"isOpen" : "JE 6/16/2021 13:06" } }
"innerLine" : "C.H. 7/3/2021 21:02",
"innerLine:" : "C.H. 7/3/2021 21:02",
"isOpen" : "JE 6/16/2021 13:06",
"lastChild" : "C.H. 7/3/2021 13:44",
"startPosition" : "C.H. 7/2/2021 15:55",
"startPosition:" : "C.H. 7/2/2021 15:55" } }
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"commentStamp" : "",
"instvars" : [
"isOpen",
"container" ],
"container",
"startPosition",
"endPosition",
"innerLine" ],
"name" : "MarkdownBlock2",
"pools" : [
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ createNew: aParsingState
| matcher |
matcher := RxMatcher forString: '\s{0,3}>\s?(.*)'.
(matcher matches: aParsingState currentLine)
ifTrue: [aParsingState newBlock: self new.
aParsingState reduceCurrentLineTo: (matcher subexpressions: 2) first.
ifTrue: [aParsingState newBlock:
(self new
startPosition: aParsingState charPos;
yourself).
aParsingState newBlock innerLine: (matcher subexpressions: 2) first.
^ 1].
^ 0

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"class" : {
"createNew:" : "C.H. 7/1/2021 15:25",
"newFrom:" : "LL 6/7/2021 18:15" },
"createNew:" : "C.H. 7/3/2021 21:06" },
"instance" : {
"acceptsLines" : "C.H. 6/29/2021 09:50",
"canContain:" : "C.H. 6/30/2021 15:34",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
accessing
appendChild: aMarkdownBlock

aMarkdownBlock container: self.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
accessing
debugging
asStringWithIndent: aString

^ (self children
inject: (aString, 'a', self class, ' with subelements: ', Character cr, aString, '{ ', Character cr)
inject: (aString, 'a', self class, ' range: (', self startPosition, ', ', self endPosition, ') with subelements: ', Character cr, aString, '{ ', Character cr)
into: [:text :child | text, (child asStringWithIndent: aString, ' '), ',', Character cr])
,aString, '}'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
initialisation
initialize

super initialize.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
lastChild

self children ifEmpty: [^nil].
^ self children last.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
},
"instance" : {
"appendChild:" : "C.H. 6/25/2021 08:22",
"asStringWithIndent:" : "C.H. 6/14/2021 16:32",
"asStringWithIndent:" : "C.H. 7/2/2021 19:17",
"children" : "JE 6/16/2021 13:11",
"children:" : "JE 6/16/2021 13:11",
"initialize" : "JE 6/16/2021 13:12",
"innerLine" : "JE 6/16/2021 13:11",
"innerLine:" : "JE 6/16/2021 13:12",
"lastChild" : "C.H. 7/3/2021 13:46",
"leafBlocks" : "LL 6/16/2021 15:02" } }
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
],
"commentStamp" : "",
"instvars" : [
"innerLine",
"children" ],
"name" : "MarkdownContainerBlock",
"pools" : [
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
applying
acceptsLines

^ false
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
applying
canContain: aMarkdownBlock

^ aMarkdownBlock class ~= MarkdownListItem2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
applying
continue: aParsingState

^ 0
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"newFrom:" : "JE 6/16/2021 13:15" },
},
"instance" : {
"acceptsLines" : "C.H. 6/29/2021 09:51",
"canContain:" : "C.H. 6/30/2021 15:34",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ instance creation
createNew: aParsingState

| matcher |
"((\s*)(`{3,1000}(?!.*`)|~{3,1000}))(.*)"
matcher := RxMatcher forString: '((\s*)(`{3,1000}|~{3,1000}))(.*)'.
matcher := RxMatcher forString: '((\s*)(`{3,1000}(?!.*`)|~{3,1000}))(.*)'.
(matcher matches: aParsingState currentLine)
ifTrue: [aParsingState newBlock:
(self new
indention: ((matcher subexpressions: 3) first size);
openingFence: ((matcher subexpressions: 4) first);
startPosition: aParsingState charPos;
yourself).
aParsingState reduceCurrentLineTo: (matcher subexpressions: 5) first.
aParsingState newBlock innerLine: (matcher subexpressions: 7) first.
^ 2].
^ 0
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
applying
continue: aParsingState


(aParsingState currentLine
matchesRegex: '\s{0,3}', self openingFence, self openingFence first, '*')
ifTrue: [self finalize.
matchesRegex: '\s{0,3}', self openingFence, self openingFence first, '*\s*')
ifTrue: [self finalize: aParsingState.
self beClosed.
aParsingState tip: self container.
^ 2]
ifFalse: [aParsingState reduceCurrentLineTo:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
applying
finalize: aParsingState

super finalize: aParsingState.
(self content lines)
ifNotEmpty: [self info: (self content lines) first]
ifNotEmpty: [self info: (self content lines) first].
Loading

0 comments on commit cfba4ab

Please sign in to comment.