-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- implement alternative syntax for italic and bold
- added more tests
- Loading branch information
Finn Schöllkopf
committed
May 26, 2021
1 parent
423a656
commit 439918d
Showing
41 changed files
with
109 additions
and
50 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
packages/MarkdownEditor-Core.package/MarkdownEmphasisDelimiter.class/class/newFor.at..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,8 @@ | ||
instance creation | ||
newFor: aString at: startPosition | ||
|
||
^ self new | ||
content: aString; | ||
startPosition: startPosition; | ||
delimiter: (aString at: 1); | ||
yourself |
4 changes: 4 additions & 0 deletions
4
packages/MarkdownEditor-Core.package/MarkdownEmphasisDelimiter.class/instance/delimiter..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,4 @@ | ||
accessing | ||
delimiter: anObject | ||
|
||
delimiter := anObject. |
4 changes: 4 additions & 0 deletions
4
packages/MarkdownEditor-Core.package/MarkdownEmphasisDelimiter.class/instance/delimiter.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,4 @@ | ||
accessing | ||
delimiter | ||
|
||
^ delimiter |
12 changes: 4 additions & 8 deletions
12
packages/MarkdownEditor-Core.package/MarkdownEmphasisDelimiter.class/instance/matches..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 |
---|---|---|
@@ -1,10 +1,6 @@ | ||
testing | ||
matches: aMarkdownEmphasisDelimiter | ||
matches: aMarkdownEmphasisDelimiter | ||
|
||
^ aMarkdownEmphasisDelimiter type = self type | ||
and: [((self isOpener and: [aMarkdownEmphasisDelimiter isCloser]) | ||
or: [self isCloser and: [aMarkdownEmphasisDelimiter isOpener]]) | ||
and: [(self isOpenerAndCloser or: [aMarkdownEmphasisDelimiter isOpenerAndCloser]) | ||
==> [((self length + aMarkdownEmphasisDelimiter length) isDivisibleBy: 3) | ||
==> [(self length isDivisibleBy: 3) | ||
and: [aMarkdownEmphasisDelimiter length isDivisibleBy: 3]]]]] | ||
^ (self matchesType: aMarkdownEmphasisDelimiter) | ||
and: [(self matchesDelimiter: aMarkdownEmphasisDelimiter) | ||
and: [self matchesOpenClose: aMarkdownEmphasisDelimiter]] |
4 changes: 4 additions & 0 deletions
4
...MarkdownEditor-Core.package/MarkdownEmphasisDelimiter.class/instance/matchesDelimiter..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,4 @@ | ||
testing | ||
matchesDelimiter: aMarkdownEmphasisDelimiter | ||
|
||
^ aMarkdownEmphasisDelimiter delimiter = self delimiter |
5 changes: 5 additions & 0 deletions
5
...MarkdownEditor-Core.package/MarkdownEmphasisDelimiter.class/instance/matchesOpenClose..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,5 @@ | ||
testing | ||
matchesOpenClose: aMarkdownEmphasisDelimiter | ||
|
||
^ (self matchesOpenerOrCloser: aMarkdownEmphasisDelimiter) | ||
and: [self matchesOpenerAndCloser: aMarkdownEmphasisDelimiter] |
8 changes: 8 additions & 0 deletions
8
...wnEditor-Core.package/MarkdownEmphasisDelimiter.class/instance/matchesOpenerAndCloser..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,8 @@ | ||
testing | ||
matchesOpenerAndCloser: aMarkdownEmphasisDelimiter | ||
|
||
^ (self isOpenerAndCloser | ||
or: [aMarkdownEmphasisDelimiter isOpenerAndCloser]) | ||
==> [(self length + aMarkdownEmphasisDelimiter length isDivisibleBy: 3) | ||
==> [(self length isDivisibleBy: 3) | ||
and: [aMarkdownEmphasisDelimiter length isDivisibleBy: 3]]] |
7 changes: 7 additions & 0 deletions
7
...ownEditor-Core.package/MarkdownEmphasisDelimiter.class/instance/matchesOpenerOrCloser..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,7 @@ | ||
testing | ||
matchesOpenerOrCloser: aMarkdownEmphasisDelimiter | ||
|
||
^ (self isOpener | ||
and: [aMarkdownEmphasisDelimiter isCloser]) | ||
or: [self isCloser | ||
and: [aMarkdownEmphasisDelimiter isOpener]] |
4 changes: 4 additions & 0 deletions
4
...ages/MarkdownEditor-Core.package/MarkdownEmphasisDelimiter.class/instance/matchesType..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,4 @@ | ||
testing | ||
matchesType: aMarkdownEmphasisDelimiter | ||
|
||
^ aMarkdownEmphasisDelimiter type = self type |
2 changes: 1 addition & 1 deletion
2
...downEditor-Core.package/MarkdownEmphasisDelimiter.class/instance/punctuationCharacters.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
constants | ||
punctuationCharacters | ||
|
||
self subclassResponsibility | ||
^ #($! $" $# $$ $% $& $' $( $) $* $+ $, $- $. $/ $: $; $< $= $> $? $@ $[ $] $\ $^ $_ $` ${ $} $| $~) |
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
2 changes: 1 addition & 1 deletion
2
...ages/MarkdownEditor-Core.package/MarkdownItalicBoldDelimiter.class/class/mayBeginWith..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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
testing | ||
mayBeginWith: aCharacter | ||
|
||
^ aCharacter = $* | ||
^ (aCharacter = $*) or: [aCharacter = $_] |
2 changes: 1 addition & 1 deletion
2
...rkdownEditor-Core.package/MarkdownItalicBoldDelimiter.class/instance/isExtendableWith..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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
testing | ||
isExtendableWith: aCharacter | ||
|
||
^ aCharacter = $* | ||
^ aCharacter = self delimiter |
4 changes: 0 additions & 4 deletions
4
...wnEditor-Core.package/MarkdownItalicBoldDelimiter.class/instance/punctuationCharacters.st
This file was deleted.
Oops, something went wrong.
5 changes: 2 additions & 3 deletions
5
packages/MarkdownEditor-Core.package/MarkdownItalicBoldDelimiter.class/methodProperties.json
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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
{ | ||
"class" : { | ||
"mayBeginWith:" : "F.S 5/6/2021 15:19" }, | ||
"mayBeginWith:" : "F.S 5/26/2021 15:42" }, | ||
"instance" : { | ||
"boldLength" : "jh 5/7/2021 10:46", | ||
"delimiterLengthForEmphasisWith:" : "jh 5/7/2021 10:46", | ||
"emphasisFrom:to:delimiterLength:" : "F.S 5/6/2021 15:20", | ||
"isExtendableWith:" : "F.S 5/6/2021 15:21", | ||
"punctuationCharacters" : "F.S 5/6/2021 15:22", | ||
"isExtendableWith:" : "F.S 5/26/2021 15:47", | ||
"type" : "F.S 5/6/2021 15:36" } } |
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
4 changes: 0 additions & 4 deletions
4
...rkdownEditor-Core.package/MarkdownStrikeDelimiter.class/instance/punctuationCharacters.st
This file was deleted.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
...ditor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertBasicParagraph.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - blocks | ||
testConvertBasicParagraph | ||
|
||
| paragraph html | | ||
|
2 changes: 1 addition & 1 deletion
2
...downEditor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertBlockList.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - blocks | ||
testConvertBlockList | ||
|
||
| blocks html expectedHtml | | ||
|
2 changes: 1 addition & 1 deletion
2
...ownEditor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertBlockquote.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - blocks | ||
testConvertBlockquote | ||
|
||
| blockquote html | | ||
|
2 changes: 1 addition & 1 deletion
2
...Editor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertBoldParagraph.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - inline | ||
testConvertBoldParagraph | ||
|
||
| paragraph html result | | ||
|
2 changes: 1 addition & 1 deletion
2
...downEditor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertCodeBlock.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - blocks | ||
testConvertCodeBlock | ||
|
||
| codeBlock html | | ||
|
2 changes: 1 addition & 1 deletion
2
...nEditor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertCommentBlock.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - blocks | ||
testConvertCommentBlock | ||
|
||
| comment html | | ||
|
2 changes: 1 addition & 1 deletion
2
...kdownEditor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertHeadings.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - blocks | ||
testConvertHeadings | ||
|
||
| heading html | | ||
|
2 changes: 1 addition & 1 deletion
2
...itor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertItalicParagraph.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - inline | ||
testConvertItalicParagraph | ||
|
||
| paragraph html result | | ||
|
2 changes: 1 addition & 1 deletion
2
.../MarkdownEditor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertLink.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - inline | ||
testConvertLink | ||
|
||
| link | | ||
|
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
9 changes: 9 additions & 0 deletions
9
...tor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertMixedDelimiters2.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,9 @@ | ||
tests - inline | ||
testConvertMixedDelimiters2 | ||
|
||
| paragraph html result | | ||
|
||
result := '<p>_<em>italic</em><strong>bold</strong></p>', Character cr. | ||
paragraph := self createBlockFrom: '_*italic*__bold__'. | ||
html := htmlConverter convertParagraph: paragraph. | ||
self assert: result equals: html |
9 changes: 9 additions & 0 deletions
9
...tor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertMixedDelimiters3.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,9 @@ | ||
tests - inline | ||
testConvertMixedDelimiters3 | ||
|
||
| paragraph html result | | ||
|
||
result := '<p><em><em>italic</em><strong>bold</strong></em></p>', Character cr. | ||
paragraph := self createBlockFrom: '_*italic*__bold___'. | ||
html := htmlConverter convertParagraph: paragraph. | ||
self assert: result equals: html |
2 changes: 1 addition & 1 deletion
2
...sts.package/MarkdownHtmlConverterTest.class/instance/testConvertMixedDelimitersFailure.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - inline | ||
testConvertMixedDelimitersFailure | ||
|
||
| paragraph html result | | ||
|
2 changes: 1 addition & 1 deletion
2
...wnEditor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertMixedItalic.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - inline | ||
testConvertMixedItalic | ||
|
||
| paragraph html result | | ||
|
2 changes: 1 addition & 1 deletion
2
...wnEditor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertOrderedList.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - blocks | ||
testConvertOrderedList | ||
"not implemented yet" | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...itor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertStrikeParagraph.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - inline | ||
testConvertStrikeParagraph | ||
|
||
| paragraph html | | ||
|
2 changes: 1 addition & 1 deletion
2
...arkdownEditor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertToRGBA.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - color | ||
testConvertToRGBA | ||
|
||
| color convertedColor | | ||
|
2 changes: 1 addition & 1 deletion
2
...Editor-Tests.package/MarkdownHtmlConverterTest.class/instance/testConvertUnorderedList.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tests | ||
tests - blocks | ||
testConvertUnorderedList | ||
|
||
| block html expectedHtml | | ||
|
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
2 changes: 1 addition & 1 deletion
2
...ckage/MarkdownStringTest.class/instance/testIsExtendableWithAnyCharacterExceptAsterisk.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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
tests - recognition | ||
testIsExtendableWithAnyCharacterExceptAsterisk | ||
|
||
(Character allByteCharacters copyWithoutAll: {$* . $[ . $] . $( . $) . $~}) | ||
(Character allByteCharacters copyWithoutAll: {$*. $[. $]. $(. $). $~. $_}) | ||
do: [:character | | token | | ||
token := MarkdownString newFor: 'a' at: 1. | ||
self assert: (token isExtendableWith: character)] |
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