Skip to content

Commit

Permalink
Merge 4154485 into 809c596
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaskordt committed Jul 1, 2019
2 parents 809c596 + 4154485 commit 64d7c05
Show file tree
Hide file tree
Showing 95 changed files with 365 additions and 137 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
parsing
determineMatchingBlockClass: aString

(MarkdownHeading matches: aString)
ifTrue: [^ MarkdownHeading]
ifFalse: [(MarkdownCodeBlock matches: aString)
ifTrue: [^ MarkdownCodeBlock]
ifFalse: [^ MarkdownParagraph]]
^ {MarkdownHeading. MarkdownCodeBlock. MarkdownCommentBlock}
detect: [:blockClass | blockClass mayBeginWith: aString]
ifNone: [MarkdownParagraph]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parsing
isLastBlockIn: aCollectionOfMarkdownBlocks extendableWith: aString andNotInterruptedBy: aMarkdownBlockClass

self flag: #refactor. "This will get nicer obnce we have the MarkdownLine"
self flag: #refactor. "This will get nicer once we have the MarkdownLine"
^ aCollectionOfMarkdownBlocks notEmpty
and: [aCollectionOfMarkdownBlocks last isExtendableWith: aString]
and: [(aCollectionOfMarkdownBlocks last isInterruptedBy: aMarkdownBlockClass) not]
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"buildAttributeRunsFrom:" : "jst 6/28/2019 14:06",
"buildBlockStructureFrom:" : "jko 6/21/2019 14:11",
"createLines:" : "jko 6/21/2019 14:06",
"determineMatchingBlockClass:" : "jst 6/7/2019 14:55",
"isLastBlockIn:extendableWith:andNotInterruptedBy:" : "jko 6/21/2019 14:21",
"determineMatchingBlockClass:" : "jko 6/29/2019 16:21",
"isLastBlockIn:extendableWith:andNotInterruptedBy:" : "jko 6/29/2019 16:21",
"parse:" : "jko 6/21/2019 14:20",
"privateFormat:" : "jst 6/28/2019 14:02",
"privateStyle:" : "jko 6/22/2019 17:42",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
testing
mayBeginWith: aString

^ (aString beginsWith: ' ') not
and: [aString matchesRegex: ' *```+[^`]*']
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"matches:" : "jst 6/10/2019 12:25" },
"mayBeginWith:" : "jko 6/29/2019 16:20" },
"instance" : {
"asText" : "jst 6/25/2019 12:19",
"codeContent" : "jst 6/10/2019 11:23",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
closingTag

^ '-->'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
testing
mayBeginWith: aString

^ (aString beginsWith: ' ') not
and: [aString withBlanksTrimmed beginsWith: self openingTag]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
openingTag

^ '<!--'
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
converting
asText

| text |
text := self content asText.
text
addAttribute: self textAttribute
from: self commentStart
to: self commentEnd.
^ text
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
closingTag

^ self class closingTag
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
commentEnd

^ self isClosed
ifTrue: [(self content findString: self closingTag) + self closingTag size - 1]
ifFalse: [self content size]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
commentStart

^ self firstLine findString: self openingTag
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
isClosed

^ self lastLine includesSubstring: self closingTag
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
isExtendableWith: aString

^ self isClosed not
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
isInterruptedBy: aMarkdownBlockClass

^ false
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
openingTag

^ self class openingTag
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
textAttribute

^ TextColor color: Color lightGray
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"class" : {
"closingTag" : "jko 6/27/2019 21:41",
"mayBeginWith:" : "jko 6/29/2019 16:20",
"openingTag" : "jko 6/27/2019 21:40" },
"instance" : {
"asText" : "jko 6/28/2019 23:54",
"closingTag" : "jko 6/29/2019 00:16",
"commentEnd" : "jko 7/1/2019 10:45",
"commentStart" : "jko 6/29/2019 00:16",
"isClosed" : "jko 6/29/2019 00:16",
"isExtendableWith:" : "jko 6/24/2019 14:42",
"isInterruptedBy:" : "jko 6/24/2019 15:44",
"openingTag" : "jko 6/29/2019 00:16",
"textAttribute" : "jko 6/28/2019 23:54" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "MarkdownEditor-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "MarkdownCommentBlock",
"pools" : [
],
"super" : "MarkdownBlock",
"type" : "normal" }

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"class" : {
"asterisk" : "fgo 5/10/2019 14:40",
"mayBeginWith:" : "fgo 5/21/2019 16:36",
"precedence" : "jko 5/6/2019 14:45" },
"mayBeginWith:" : "fgo 5/21/2019 16:36" },
"instance" : {
"attributeStartingAt:" : "jko 5/23/2019 12:44",
"attributeTypeFor:" : "jko 5/21/2019 23:34",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
testing
matches: aString
mayBeginWith: aString

| chunks |
chunks := aString subStrings: {Character space. Character cr}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"matches:" : "fgo 5/21/2019 16:37" },
"mayBeginWith:" : "jko 6/29/2019 16:21" },
"instance" : {
"asText" : "jko 6/25/2019 20:40",
"font" : "kgr 6/10/2019 13:39",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@ initialize-release
initialize

super initialize.
self
clean;
tokenClasses: {MarkdownEmphasisDelimiter. MarkdownString} asSortedCollection.
self tokenClasses sortBlock: [:a :b | a precedence > b precedence]
self clean
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ parsing
nextTokenIn: aMarkdownReadStream

| tokenClass |
tokenClass := self tokenClasses detect: [:aTokenClass |
tokenClass := {MarkdownEmphasisDelimiter. MarkdownString} detect: [:aTokenClass |
aTokenClass mayBeginWith: aMarkdownReadStream peek asString].
^ tokenClass newFor: aMarkdownReadStream

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@
"cutCloser:to:" : "lpf 5/23/2019 10:27",
"cutOpener:to:" : "lpf 5/23/2019 10:28",
"findOpenerFor:ifFound:" : "jko 5/16/2019 17:34",
"initialize" : "jko 5/23/2019 14:44",
"initialize" : "jko 6/24/2019 15:59",
"interpretTokens" : "jko 6/21/2019 14:00",
"nextTokenIn:" : "fgo 5/21/2019 16:36",
"nextTokenIn:" : "jko 6/24/2019 16:00",
"parse:" : "jko 6/21/2019 14:45",
"privateFormat:" : "jst 6/28/2019 14:02",
"privateStyle:" : "jko 6/25/2019 22:04",
"process:and:" : "jko 5/23/2019 14:38",
"removeDelimitersBetween:and:" : "lpf 5/23/2019 10:28",
"reset" : "jst 6/28/2019 14:03",
"tokenClasses" : "jko 5/6/2019 14:43",
"tokenClasses:" : "jko 5/6/2019 14:44",
"tokenize:" : "jko 6/21/2019 14:44",
"tokens" : "jko 5/6/2019 15:10",
"tokens:" : "jko 5/6/2019 15:11" } }
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
],
"commentStamp" : "fgo 5/21/2019 15:43",
"instvars" : [
"tokenClasses",
"tokens",
"attributes" ],
"name" : "MarkdownInlineTextStyler",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"class" : {
"mayBeginWith:" : "fgo 5/21/2019 16:36",
"precedence" : "jko 5/6/2019 14:46" },
"mayBeginWith:" : "fgo 5/21/2019 16:36" },
"instance" : {
"fillContentFrom:" : "fgo 5/21/2019 15:18",
"isDelimiter" : "jko 5/6/2019 14:52" } }

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"class" : {
"<=" : "jko 5/6/2019 14:49",
"mayBeginWith:" : "fgo 5/21/2019 16:36",
"newFor:" : "fgo 5/21/2019 15:21",
"precedence" : "jko 5/6/2019 14:45" },
"newFor:" : "fgo 5/21/2019 15:21" },
"instance" : {
"asStringToken" : "fgo 5/21/2019 15:21",
"content" : "fgo 5/4/2019 14:53",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tests - blocks
testBlockStructureCodeBlockNotInterruptedByCommentBlock

self
assert: {MarkdownCodeBlock}
isParsedStructureOf: '```', Character cr, '<!-- Not a comment -->', Character cr, '```'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tests - blocks
testBlockStructureCommentBlock

self
assert: {MarkdownCommentBlock}
isParsedStructureOf: '<!-- -->'
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tests - blocks
testBlockStructureCommentBlockFollowedByParagraph

self
assert: {MarkdownCommentBlock. MarkdownParagraph}
isParsedStructureOf: '<!-- Comment about MiniMetro being amazing -->', Character cr,
'Paragraph describing the game'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tests - blocks
testBlockStructureCommentBlockNotInterruptedByCodeBlock

self
assert: {MarkdownCommentBlock}
isParsedStructureOf: '<!--', Character cr, '```', Character cr, 'not code', Character cr, '```', Character cr, '-->'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tests - blocks
testBlockStructureCommentBlockNotInterruptedByHeading

self
assert: {MarkdownCommentBlock}
isParsedStructureOf: '<!--', Character cr, '# Not a heading', Character cr, '-->'
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
"setUp" : "jko 6/22/2019 17:37",
"testBlockStructureCodeBlock" : "jst 6/7/2019 14:47",
"testBlockStructureCodeBlockFollowedByParagraph" : "jst 6/10/2019 11:31",
"testBlockStructureCodeBlockNotInterruptedByCommentBlock" : "jko 6/29/2019 00:01",
"testBlockStructureCodeBlockNotInterruptedByHeading" : "jst 6/7/2019 14:42",
"testBlockStructureCodeBlockWithLongFences" : "jst 6/10/2019 13:28",
"testBlockStructureCommentBlock" : "jko 6/25/2019 21:24",
"testBlockStructureCommentBlockFollowedByParagraph" : "jko 6/25/2019 21:26",
"testBlockStructureCommentBlockNotInterruptedByCodeBlock" : "jko 6/29/2019 00:01",
"testBlockStructureCommentBlockNotInterruptedByHeading" : "jko 6/25/2019 21:25",
"testBlockStructureEmptyCodeBlock" : "jst 6/7/2019 14:47",
"testBlockStructureHeading" : "jst 6/3/2019 18:19",
"testBlockStructureHeadingFollowedByParagraph" : "jst 6/10/2019 13:27",
Expand Down

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
@@ -0,0 +1,7 @@
tests - matching
testMayBeginWith1To3Indentation

{' ```'. ' ```'. ' ```'} do: [:openingLine |
self assert: (MarkdownCodeBlock mayBeginWith: openingLine)]


Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tests - matching
testMayBeginWith3Backticks

self assert: (MarkdownCodeBlock mayBeginWith: '```')
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tests - matching
testMayBeginWith3BackticksWithInfoString

self assert: (MarkdownCodeBlock mayBeginWith: '```smalltalk')
Loading

0 comments on commit 64d7c05

Please sign in to comment.