From 6daf8cbb1c1dbb6950109af2814df4309158968b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phaneDucasse?= Date: Mon, 6 May 2024 09:53:37 +0200 Subject: [PATCH 1/2] Fixes #706 Rename MicArgumentsSplitterTest --- ....class.st => MicArgumentListTest.class.st} | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) rename src/Microdown-Tests/{MicArgumentsSplitterTest.class.st => MicArgumentListTest.class.st} (76%) diff --git a/src/Microdown-Tests/MicArgumentsSplitterTest.class.st b/src/Microdown-Tests/MicArgumentListTest.class.st similarity index 76% rename from src/Microdown-Tests/MicArgumentsSplitterTest.class.st rename to src/Microdown-Tests/MicArgumentListTest.class.st index 38b7846f..5cf1d762 100644 --- a/src/Microdown-Tests/MicArgumentsSplitterTest.class.st +++ b/src/Microdown-Tests/MicArgumentListTest.class.st @@ -2,7 +2,7 @@ A MicArgumentsSplitterTest is a test class for testing the behavior of MicArgumentsSplitter " Class { - #name : 'MicArgumentsSplitterTest', + #name : 'MicArgumentListTest', #superclass : 'TestCase', #category : 'Microdown-Tests-Parser', #package : 'Microdown-Tests', @@ -10,24 +10,24 @@ Class { } { #category : 'helpers' } -MicArgumentsSplitterTest >> splitter [ +MicArgumentListTest >> splitter [ ^ MicArgumentList ] { #category : 'helpers' } -MicArgumentsSplitterTest >> subjectUnderTestWith: aString [ +MicArgumentListTest >> subjectUnderTestWith: aString [ ^ MicArgumentList withString: aString ] { #category : 'tests' } -MicArgumentsSplitterTest >> testArguments [ +MicArgumentListTest >> testArguments [ | subject | subject := self subjectUnderTestWith: 'foo=bar'. self assert: (subject at: #foo) equals: 'bar' ] { #category : 'tests' } -MicArgumentsSplitterTest >> testArgumentsForMath [ +MicArgumentListTest >> testArgumentsForMath [ | subject | subject := self subjectUnderTestWith: '%foo=bar'. self assert: (subject at: #foo) equals: 'bar'. @@ -40,14 +40,14 @@ MicArgumentsSplitterTest >> testArgumentsForMath [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testCanInstantiate [ +MicArgumentListTest >> testCanInstantiate [ | subject | subject := self subjectUnderTestWith: 'bla'. self assert: (subject isNotNil) ] { #category : 'tests' } -MicArgumentsSplitterTest >> testDefaultWithEmptyInput [ +MicArgumentListTest >> testDefaultWithEmptyInput [ | subject | subject := self splitter split: '' defaultArg: #language defaultValue: 'smalltalk'. self assert: subject size equals: 1. @@ -57,7 +57,7 @@ MicArgumentsSplitterTest >> testDefaultWithEmptyInput [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testDefaultWithNoValue [ +MicArgumentListTest >> testDefaultWithNoValue [ | subject | subject := self splitter split: 'pharo' defaultArg: #language. self assert: subject size equals: 1. @@ -66,7 +66,7 @@ MicArgumentsSplitterTest >> testDefaultWithNoValue [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testDefaultWithValue [ +MicArgumentListTest >> testDefaultWithValue [ | subject | subject := self splitter split: 'pharo' defaultArg: #language defaultValue: #smalltalk. self assert: subject size equals: 1. @@ -75,28 +75,28 @@ MicArgumentsSplitterTest >> testDefaultWithValue [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testEmpty [ +MicArgumentListTest >> testEmpty [ | subject | subject := self subjectUnderTestWith: ''. self assert: subject size equals: 0. ] { #category : 'tests' } -MicArgumentsSplitterTest >> testFirstTag [ +MicArgumentListTest >> testFirstTag [ | subject | subject := self subjectUnderTestWith: 'bla'. self assert: (subject defaultValue) equals: 'bla' ] { #category : 'tests' } -MicArgumentsSplitterTest >> testFirstTagWithDelimiter [ +MicArgumentListTest >> testFirstTagWithDelimiter [ | subject | subject := self subjectUnderTestWith: 'foo|bar=99'. self assert: (subject defaultValue) equals: 'foo' ] { #category : 'tests' } -MicArgumentsSplitterTest >> testHasNonDefaultArguments [ +MicArgumentListTest >> testHasNonDefaultArguments [ | subject | subject := self splitter split: '' defaultArg: #language. subject at: #foo put: 'bar'. @@ -104,14 +104,14 @@ MicArgumentsSplitterTest >> testHasNonDefaultArguments [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testHasNonDefaultArguments_no [ +MicArgumentListTest >> testHasNonDefaultArguments_no [ | subject | subject := self splitter split: '' defaultArg: #language. self deny: subject hasNonDefaultArguments ] { #category : 'tests' } -MicArgumentsSplitterTest >> testHasNonDefaultArguments_nonDefault [ +MicArgumentListTest >> testHasNonDefaultArguments_nonDefault [ | subject | subject := self splitter split: '' defaultArg: #language defaultValue: 'Pharo'. subject at: #language put: 'Fortran'. @@ -119,42 +119,42 @@ MicArgumentsSplitterTest >> testHasNonDefaultArguments_nonDefault [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testHasNonDefaultValue [ +MicArgumentListTest >> testHasNonDefaultValue [ | subject | subject := self splitter split: 'fortran' defaultArg: #language. self assert: subject hasNonDefaultValue ] { #category : 'tests' } -MicArgumentsSplitterTest >> testHasNonDefaultValue_AndSomeArgs [ +MicArgumentListTest >> testHasNonDefaultValue_AndSomeArgs [ | subject | subject := self splitter split: 'fortran|wasOnce=cool' defaultArg: #language. self assert: subject hasNonDefaultValue ] { #category : 'tests' } -MicArgumentsSplitterTest >> testHasNonDefaultValue_Default [ +MicArgumentListTest >> testHasNonDefaultValue_Default [ | subject | subject := self splitter split: '' defaultArg: #language defaultValue: 'pharo'. self deny: subject hasNonDefaultValue ] { #category : 'tests' } -MicArgumentsSplitterTest >> testHasNonDefaultValue_DefaultOverridden [ +MicArgumentListTest >> testHasNonDefaultValue_DefaultOverridden [ | subject | subject := self splitter split: 'fortran' defaultArg: #language defaultValue: 'pharo'. self assert: subject hasNonDefaultValue ] { #category : 'tests' } -MicArgumentsSplitterTest >> testHasNonDefaultValue_NoDefault [ +MicArgumentListTest >> testHasNonDefaultValue_NoDefault [ | subject | subject := self splitter split: '' defaultArg: #language. self deny: subject hasNonDefaultValue ] { #category : 'tests' } -MicArgumentsSplitterTest >> testJustTheArguments [ +MicArgumentListTest >> testJustTheArguments [ | subject input | input := 'joe|foo=bar&aaa=bbb ccc&pip='. subject := self splitter split: input defaultArg: #personName. @@ -162,7 +162,7 @@ MicArgumentsSplitterTest >> testJustTheArguments [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testJustTheArguments_NoDefault [ +MicArgumentListTest >> testJustTheArguments_NoDefault [ | subject input | input := 'foo=bar&aaa=bbb ccc&pip='. subject := self splitter split: input defaultArg: #personName. @@ -170,7 +170,7 @@ MicArgumentsSplitterTest >> testJustTheArguments_NoDefault [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testNameAndArguments [ +MicArgumentListTest >> testNameAndArguments [ | subject | subject := self subjectUnderTestWith: 'aName|foo=bar'. self assert: (subject includesKey: #foo). @@ -178,14 +178,14 @@ MicArgumentsSplitterTest >> testNameAndArguments [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testNameWithDelimiter [ +MicArgumentListTest >> testNameWithDelimiter [ | subject | subject := self subjectUnderTestWith: 'fooName|bar=foe'. self assert: (subject defaultValue) equals: 'fooName' ] { #category : 'tests' } -MicArgumentsSplitterTest >> testPrintString [ +MicArgumentListTest >> testPrintString [ | subject input | input := 'joe|foo=bar&aaa=bbb ccc&pip='. subject := self splitter split: input defaultArg: #personName. @@ -193,7 +193,7 @@ MicArgumentsSplitterTest >> testPrintString [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testPrintString_AssignDefaultUsingEquals [ +MicArgumentListTest >> testPrintString_AssignDefaultUsingEquals [ | subject input | input := 'language=fortran'. subject := self splitter split: input defaultArg: 'language'. @@ -201,7 +201,7 @@ MicArgumentsSplitterTest >> testPrintString_AssignDefaultUsingEquals [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testPrintString_Empty [ +MicArgumentListTest >> testPrintString_Empty [ | subject input | input := ''. subject := self splitter split: input. @@ -209,7 +209,7 @@ MicArgumentsSplitterTest >> testPrintString_Empty [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testPrintString_defaultValue [ +MicArgumentListTest >> testPrintString_defaultValue [ | subject input | input := 'foo'. subject := self splitter split: input. @@ -217,7 +217,7 @@ MicArgumentsSplitterTest >> testPrintString_defaultValue [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testPrintString_oneParam [ +MicArgumentListTest >> testPrintString_oneParam [ | subject input | input := 'foo=bar'. subject := self splitter split: input. @@ -225,7 +225,7 @@ MicArgumentsSplitterTest >> testPrintString_oneParam [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testPrintString_onlyParams [ +MicArgumentListTest >> testPrintString_onlyParams [ | subject input | input := 'foo=bar&a=b'. subject := self splitter split: input. @@ -233,7 +233,7 @@ MicArgumentsSplitterTest >> testPrintString_onlyParams [ ] { #category : 'tests' } -MicArgumentsSplitterTest >> testSeveralArguments [ +MicArgumentListTest >> testSeveralArguments [ | subject | subject := self subjectUnderTestWith: 'foo=bar&caption=this is lovely&aaa=99'. self assert: subject size equals: 3. From a6c29856a765d85dfe5b2884767edd7548f3dd9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phaneDucasse?= Date: Mon, 6 May 2024 10:00:55 +0200 Subject: [PATCH 2/2] Add super comments --- .../MicArgumentListTest.class.st | 8 +++++++- src/Microdown/MicArgumentList.class.st | 20 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Microdown-Tests/MicArgumentListTest.class.st b/src/Microdown-Tests/MicArgumentListTest.class.st index 5cf1d762..3708b6cd 100644 --- a/src/Microdown-Tests/MicArgumentListTest.class.st +++ b/src/Microdown-Tests/MicArgumentListTest.class.st @@ -1,5 +1,11 @@ " -A MicArgumentsSplitterTest is a test class for testing the behavior of MicArgumentsSplitter +A MicArgumentsSplitterTest is a test class for testing the behavior of MicArgumentList. +This list is used in figures, code, and math equation for now + +In the following anchor=fig1&width=70 is an argument list. +``` +![this is a caption](figures/f.png anchor=fig1&width=70) +``` " Class { #name : 'MicArgumentListTest', diff --git a/src/Microdown/MicArgumentList.class.st b/src/Microdown/MicArgumentList.class.st index b24b2094..4d6b245e 100644 --- a/src/Microdown/MicArgumentList.class.st +++ b/src/Microdown/MicArgumentList.class.st @@ -1,5 +1,25 @@ " I am intended to provide arguments to annotations, codeblocks and environments. +I'm used in figures, code, and math equation for now + +In the following anchor=fig1&width=70 is an argument list. +``` +![this is a caption](figures/f.png anchor=fig1&width=70) +``` + +``` + ```pharo + ... + ``` +``` + +is equivalent to the set pharo as value to the default tag which is for blocks language + +``` + ```language=pharo + ... + ``` +``` My syntax is of the following form: