From c1da7f8b3cad79f850a94b0d8f71aec3231fd09b Mon Sep 17 00:00:00 2001 From: kasperosterbye Date: Wed, 11 Feb 2026 10:35:01 +0100 Subject: [PATCH 1/2] MicLatexPathUpdateVisitor deleted. It its key funtion is "copyReplaceAll: '\' with: '/'", which now is in MicLaTeXWriter class >> toLatexPath: --- .../MicLatexPathUpdateVisitor.class.st | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 src/Microdown-LaTeXExporter/MicLatexPathUpdateVisitor.class.st diff --git a/src/Microdown-LaTeXExporter/MicLatexPathUpdateVisitor.class.st b/src/Microdown-LaTeXExporter/MicLatexPathUpdateVisitor.class.st deleted file mode 100644 index 77a15ecd..00000000 --- a/src/Microdown-LaTeXExporter/MicLatexPathUpdateVisitor.class.st +++ /dev/null @@ -1,40 +0,0 @@ -" -I am a pillar visitor that updates all references to be latex compatible. I am particularly useful in windows platforms that use the \ delimiter, which is not correctly parsed by the latex compiler. - -Latex Paths have to use the / delimiter, even in windows. The following are examples of correct paths: - -/usr/lib/bla - -C:/Program Files/Something - -For now I'm a copy and paste from Pillar (to avoid to have to patch all the visit API). -" -Class { - #name : 'MicLatexPathUpdateVisitor', - #superclass : 'MicrodownVisitor', - #category : 'Microdown-LaTeXExporter', - #package : 'Microdown-LaTeXExporter' -} - -{ #category : 'visiting' } -MicLatexPathUpdateVisitor class >> key [ - - ^ #latexPathUpdate -] - -{ #category : 'visiting' } -MicLatexPathUpdateVisitor class >> start: aDocument [ - ^ self new start: aDocument -] - -{ #category : 'instance creation' } -MicLatexPathUpdateVisitor >> newReferenceFor: aReference [ - - ^ aReference reference copyReplaceAll: '\' with: '/' -] - -{ #category : 'visiting' } -MicLatexPathUpdateVisitor >> visitFigure: aFigure [ - aFigure reference: (self newReferenceFor: aFigure). - super visitFigure: aFigure -] From ab30c280c728e4b3ec7ca85e618ef57dac82dbdc Mon Sep 17 00:00:00 2001 From: kasperosterbye Date: Thu, 19 Feb 2026 09:33:03 +0100 Subject: [PATCH 2/2] Fixed 132, and added some tests --- .../MicMicrodownTextualBuilderTest.class.st | 125 +++++++++++++++++- .../MicMicrodownTextualBuilder.class.st | 9 ++ 2 files changed, 129 insertions(+), 5 deletions(-) diff --git a/src/Microdown-Tests/MicMicrodownTextualBuilderTest.class.st b/src/Microdown-Tests/MicMicrodownTextualBuilderTest.class.st index f389d28b..cb357341 100644 --- a/src/Microdown-Tests/MicMicrodownTextualBuilderTest.class.st +++ b/src/Microdown-Tests/MicMicrodownTextualBuilderTest.class.st @@ -105,21 +105,19 @@ MicMicrodownTextualBuilderTest >> testCell [ { #category : 'tests - codeblock' } MicMicrodownTextualBuilderTest >> testCodeBlock [ - "```language2=Pharo&caption=`Color` is cool + "``` Hello Pharo ```" | mictext | mictext := builder - codeblock: self exampleTextMultipleLines - firstLineAssociations: { - ('language2' -> 'Pharo') }; + codeblock: self exampleTextMultipleLines; contents. self assert: mictext equals: -'```language2=Pharo +'``` ', self exampleTextMultipleLines, ' @@ -156,6 +154,123 @@ MicMicrodownTextualBuilderTest >> testCodeBlockCaptionContainsMonospace [ ] +{ #category : 'tests - codeblock' } +MicMicrodownTextualBuilderTest >> testCodeBlockFirstLineAssociations [ + + "```language2=Pharo&caption=`Color` is cool + Hello + Pharo + ```" + + | mictext | + mictext := builder + codeblock: self exampleTextMultipleLines + firstLineAssociations: { + ('language2' -> 'Pharo'). 'caption' -> '`Color` is cool' }; + contents. + self + assert: mictext + equals: +'```language2=Pharo&caption=`Color` is cool +', self exampleTextMultipleLines, + +' +``` +' + +] + +{ #category : 'tests - codeblock' } +MicMicrodownTextualBuilderTest >> testCodeblockFirstLineAssociationsWithCaption [ + "This test verifies that code blocks with first-line associations and captions are correctly formatted." + + self testCodeblockFirstLineAssociationsWithCaption01. + self setUp. + self testCodeblockFirstLineAssociationsWithCaption02. +] + +{ #category : 'tests - codeblock' } +MicMicrodownTextualBuilderTest >> testCodeblockFirstLineAssociationsWithCaption01 [ + + "```language2=Pharo&aaa=bbb15 + Hello + Pharo + ```" + + | mictext | + mictext := builder + codeblock: self exampleTextMultipleLines + firstLineAssociations: { + 'language2' -> 'Pharo'. 'aaa' -> 'bbb15' } + withCaption: [ 'Killroy' ]; + contents. + self + assert: mictext + equals: +'```language2=Pharo&aaa=bbb15 +', self exampleTextMultipleLines, + +' +``` +' + +] + +{ #category : 'tests - codeblock' } +MicMicrodownTextualBuilderTest >> testCodeblockFirstLineAssociationsWithCaption02 [ + + "```language2=Pharo&aaa=bbb15 + Hello + Pharo + ```" + + | mictext | + mictext := builder + codeblock: self exampleTextMultipleLines + firstLineAssociations: { + 'language2' -> 'Pharo'. #caption -> 'bbb15' } + withCaption: [ builder raw: 'Kilroy' ]; + contents. + self + assert: mictext + equals: +'```language2=Pharo&caption=Kilroy +', self exampleTextMultipleLines, + +' +``` +' + +] + +{ #category : 'tests - codeblock' } +MicMicrodownTextualBuilderTest >> testCodeblockParameters [ + + "```language2=Pharo&aaa=bbb15 + Hello + Pharo + ```" + + | mictext orderedDic | + orderedDic := OrderedDictionary new. + orderedDic at: 'language2' put: 'Pharo'. + orderedDic at: 'aaa' put: 'bbb15'. + mictext := builder + codeblock: self exampleTextMultipleLines + parameters: orderedDic; + contents. + self + assert: mictext + equals: +'```language2=Pharo&aaa=bbb15 +', self exampleTextMultipleLines, + +' +``` +' + +] + { #category : 'tests - slides' } MicMicrodownTextualBuilderTest >> testColumns [ diff --git a/src/Microdown/MicMicrodownTextualBuilder.class.st b/src/Microdown/MicMicrodownTextualBuilder.class.st index 55767acd..cc3c99e3 100644 --- a/src/Microdown/MicMicrodownTextualBuilder.class.st +++ b/src/Microdown/MicMicrodownTextualBuilder.class.st @@ -121,6 +121,15 @@ MicMicrodownTextualBuilder >> codeblock: aString firstLineAssociations: aCol wit self newLine. ] +{ #category : 'as yet unclassified' } +MicMicrodownTextualBuilder >> codeblock: aString parameters: anOrderedDictionary [ + "Alternate API: Build first-line params from a dictionary (preserves order)." + + | associations | + associations := anOrderedDictionary associations. + self codeblock: aString firstLineAssociations: associations +] + { #category : 'element - code block' } MicMicrodownTextualBuilder >> codeblockTag: aTag withBody: aString [ self flag: #fixme.