Skip to content

Commit

Permalink
add new tests, format code (#157)
Browse files Browse the repository at this point in the history
Co-authored-by: Marie Fischer <zoe23@online.de>
  • Loading branch information
JulianEgbert and Marie Fischer committed Jun 16, 2021
1 parent a30b81e commit d3d70ba
Show file tree
Hide file tree
Showing 285 changed files with 1,768 additions and 84 deletions.
1 change: 1 addition & 0 deletions .squot
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ OrderedDictionary {
'packages/MarkdownEditor-Core.package' : #SquotCypressCodeSerializer,
'packages/MarkdownEditor-Tests.package' : #SquotCypressCodeSerializer,
'packages/MarkdownEditor-Utilities.package' : #SquotCypressCodeSerializer,
'MarkdownEditor-Parsing.package' : #SquotCypressCodeSerializer,
'packages/MarkdownEditor-Parsing.package' : #SquotCypressCodeSerializer
}
4 changes: 4 additions & 0 deletions MarkdownEditor-Parsing.package/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"noMethodMetaData" : true,
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
5 changes: 5 additions & 0 deletions MarkdownEditor-Parsing.package/.squot-contents
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SquotTrackedObjectMetadata {
#objectClassName : #PackageInfo,
#objectsReplacedByNames : true,
#serializer : #SquotCypressCodeSerializer
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
as yet unclassified
newFrom: aString

^ ((self newWithOutClosingTagFrom: aString)
ifNil: [self newWithClosingTagFrom: aString])

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
as yet unclassified
newWithClosingTagFrom: aString

| matcher |
matcher := RxMatcher forString: '\s{0,3}(#{1,6})(\s+(.*\S)\s+#+\s*|[#\s]*)'.
(matcher matches: aString)
ifTrue: [^self new
level: ((matcher subexpressions: 2) first size);
content: (StringUtil unescape: {$#} in: ((matcher subexpressions: 4) at: 1 ifAbsent: ['']));
isOpen: false;
yourself].
^ nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
as yet unclassified
newWithOutClosingTagFrom: aString

| matcher |
matcher := RxMatcher forString: '\s{0,3}(#{1,6})\s+(.*[^#\s])\s*'.
(matcher matches: aString) ifFalse:
[matcher := RxMatcher forString: '\s{0,3}(#{1,6})\s+((\s*#*[^#\s]#*)*)\s*'].
(matcher matches: aString)
ifTrue: [^ self new
level: ((matcher subexpressions: 2) first size);
content: (StringUtil unescape: {$#} in: ((matcher subexpressions: 3) at: 1 ifAbsent: ['']));
isOpen: false;
yourself].
^ nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
applyOnLine: aString

^ nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
level: anObject
level := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
level
^ level
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"class" : {
"newFrom:" : "C.H. 6/14/2021 15:13",
"newWithClosingTagFrom:" : "C.H. 6/14/2021 15:14",
"newWithOutClosingTagFrom:" : "C.H. 6/14/2021 17:09" },
"instance" : {
"applyOnLine:" : "C.H. 6/11/2021 11:57",
"level" : "C.H. 6/5/2021 11:23",
"level:" : "C.H. 6/5/2021 11:23" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "MarkdownEditor-Parsing",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"level" ],
"name" : "MarkdownATXHeading2",
"pools" : [
],
"super" : "MarkdownLeafBlock",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
as yet unclassified
newFrom: aString

| matcher |
matcher := RxMatcher forString: '\s*'.
(matcher matches: aString)
ifTrue: [^self new
content: '';
isOpen: false;
yourself].
^ nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
applyOnLine: aString

^ nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
"newFrom:" : "C.H. 6/14/2021 17:35" },
"instance" : {
"applyOnLine:" : "C.H. 6/14/2021 17:20" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "MarkdownEditor-Parsing",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "MarkdownBlankLine2",
"pools" : [
],
"super" : "MarkdownLeafBlock",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
newFrom: aString

^self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
startsWith: aString

^ self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
nil
applyOnLine: aMakdownLine

^self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
asString

^ self asStringWithIndent: ''
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
close

^ self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialisation
initialize

self isOpen: true.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
isOpen: anObject
isOpen := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
isOpen
^ isOpen
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"class" : {
"newFrom:" : "C.H. 6/3/2021 16:41",
"startsWith:" : "C.H. 6/3/2021 16:36" },
"instance" : {
"applyOnLine:" : "C.H. 6/5/2021 11:12",
"asString" : "C.H. 6/14/2021 16:33",
"close" : "LL 6/15/2021 10:45",
"initialize" : "C.H. 6/6/2021 11:11",
"isOpen" : "C.H. 6/5/2021 11:14",
"isOpen:" : "C.H. 6/5/2021 11:14" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "MarkdownEditor-Parsing",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"isOpen" ],
"name" : "MarkdownBlock2",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
as yet unclassified
newFrom: aString

| matcher |
matcher := RxMatcher forString: '\s{0,3}>\s?(.*)'.
(matcher matches: aString)
ifTrue: [^self new
innerLine: ((matcher subexpressions: 2) first);
yourself].
^ nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
as yet unclassified
applyOnLine: aString

"should also remain open if the line is a simple paragraph"
| matcher |
matcher := RxMatcher forString: '\s{0,3}>\s?(.*)'.
(matcher matches: aString)
ifTrue: [^(matcher subexpressions: 2) first].
^ nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
"newFrom:" : "LL 6/7/2021 18:15" },
"instance" : {
"applyOnLine:" : "LL 6/7/2021 18:30" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "MarkdownEditor-Parsing",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "MarkdownBlockquote2",
"pools" : [
],
"super" : "MarkdownContainerBlock",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
},
"instance" : {
} }
14 changes: 14 additions & 0 deletions MarkdownEditor-Parsing.package/MarkdownBold2.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "MarkdownEditor-Parsing",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "MarkdownBold2",
"pools" : [
],
"super" : "MarkdownEmphasis2",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
accessing
asStringWithIndent: aString

^ (self children
inject: (aString, 'a', self class, ' 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
@@ -0,0 +1,3 @@
accessing
children: anObject
children := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
children
^ children
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
close

self isOpen: false.
self children do: [:child | child close].
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
initialize

super initialize.
self children: OrderedCollection new.
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
@@ -0,0 +1,3 @@
accessing
innerLine
^ innerLine
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"class" : {
},
"instance" : {
"asStringWithIndent:" : "C.H. 6/14/2021 16:32",
"children" : "C.H. 5/31/2021 11:51",
"children:" : "C.H. 5/31/2021 11:51",
"close" : "C.H. 6/12/2021 17:13",
"initialize" : "jh 6/8/2021 08:58",
"innerLine" : "LL 6/7/2021 18:15",
"innerLine:" : "LL 6/7/2021 18:15" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"category" : "MarkdownEditor-Parsing",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"innerLine",
"children" ],
"name" : "MarkdownContainerBlock",
"pools" : [
],
"super" : "MarkdownBlock2",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
creation
newFrom: aString

| type |
type := aString second.
^ self new
count: (aString occurrencesOfRegex: '\',type);
type: type;
setOpenClosePropertyFrom: aString;
beValid;
yourself

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
helpers
= anotherDelimiter

^ (self type = anotherDelimiter type)
and: [self count = anotherDelimiter count]
and: [self isPotentialOpener = anotherDelimiter isPotentialOpener]
and: [self isPotentialCloser = anotherDelimiter isPotentialCloser]
and: [self index = anotherDelimiter index]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
helpers
asMarkdownString

| content |
content := ''.
self count
timesRepeat: [content := content , self type asString].
^ MarkdownString2 newFrom: content
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
beNotPotentialCloser

potentialCloser := false
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
bePotentialCloser

potentialCloser := true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
bePotentialOpener

potentialOpener := true
Loading

0 comments on commit d3d70ba

Please sign in to comment.