From 328708cff150e39881cc16e41038203cd6632893 Mon Sep 17 00:00:00 2001 From: "quentin.moutte.etu" Date: Fri, 9 Aug 2024 19:19:53 +0200 Subject: [PATCH 1/3] Add a MicNoteBlock and test --- src/Microdown-Tests/MicNoteBlockTest.class.st | 17 ++++++++++++++ src/Microdown/MicNoteBlock.class.st | 22 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/Microdown-Tests/MicNoteBlockTest.class.st create mode 100644 src/Microdown/MicNoteBlock.class.st diff --git a/src/Microdown-Tests/MicNoteBlockTest.class.st b/src/Microdown-Tests/MicNoteBlockTest.class.st new file mode 100644 index 00000000..0394e7cb --- /dev/null +++ b/src/Microdown-Tests/MicNoteBlockTest.class.st @@ -0,0 +1,17 @@ +Class { + #name : 'MicNoteBlockTest', + #superclass : 'MicAnnotationSubclassTest', + #category : 'Microdown-Tests-Extensions', + #package : 'Microdown-Tests', + #tag : 'Extensions' +} + +{ #category : 'tests' } +MicNoteBlockTest >> testCreateTheRightNoteObject [ + + | doc | + doc := parser parse: '{!note|contents=Duca99a!}'. + self assert: doc children first children first class equals: MicNoteBlock. + self assert: doc children first children first name equals: 'note'. + self assert: (doc children first children first arguments at: #contents) equals: 'Duca99a'. +] diff --git a/src/Microdown/MicNoteBlock.class.st b/src/Microdown/MicNoteBlock.class.st new file mode 100644 index 00000000..5c264147 --- /dev/null +++ b/src/Microdown/MicNoteBlock.class.st @@ -0,0 +1,22 @@ +Class { + #name : 'MicNoteBlock', + #superclass : 'MicAnnotationBlock', + #category : 'Microdown-Extensions', + #package : 'Microdown', + #tag : 'Extensions' +} + +{ #category : 'accessing' } +MicNoteBlock class >> tag [ + ^ #note +] + +{ #category : 'visiting' } +MicNoteBlock >> accept: aVisitor [ + aVisitor visitNote: self +] + +{ #category : 'accessing' } +MicNoteBlock >> contents [ + ^ arguments at: 'contents' ifAbsent: [ '' ] +] From eeeae7b99ec5907e845bfe8f28b14a0c89a38f90 Mon Sep 17 00:00:00 2001 From: "quentin.moutte.etu" Date: Fri, 9 Aug 2024 20:14:16 +0200 Subject: [PATCH 2/3] add a visit method in latex esporter for the Note and a test --- .../MicLaTeXWriterTest.class.st | 7 +++++++ src/Microdown-LaTeXExporter/MicLaTeXWriter.class.st | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/Microdown-LaTeXExporter-Tests/MicLaTeXWriterTest.class.st b/src/Microdown-LaTeXExporter-Tests/MicLaTeXWriterTest.class.st index 34f83abe..12b77eda 100644 --- a/src/Microdown-LaTeXExporter-Tests/MicLaTeXWriterTest.class.st +++ b/src/Microdown-LaTeXExporter-Tests/MicLaTeXWriterTest.class.st @@ -352,6 +352,13 @@ MicLaTeXWriterTest >> testMonospace [ self parseInlined: factory monospaceFormatSample andCheckWeGet: '\code{Foo}' ] +{ #category : 'tests' } +MicLaTeXWriterTest >> testNote [ + + self parseInlined: '{!note|contents=Duca99a!}' andCheckWeGet: '\comment{Duca99a}' + +] + { #category : 'tests - lists' } MicLaTeXWriterTest >> testOrderedList [ diff --git a/src/Microdown-LaTeXExporter/MicLaTeXWriter.class.st b/src/Microdown-LaTeXExporter/MicLaTeXWriter.class.st index 7b39174f..f137d25f 100644 --- a/src/Microdown-LaTeXExporter/MicLaTeXWriter.class.st +++ b/src/Microdown-LaTeXExporter/MicLaTeXWriter.class.st @@ -297,6 +297,14 @@ MicLaTeXWriter >> visitMonospace: aMonospace [ parameter: [ super visitMonospace: aMonospace ] ] +{ #category : 'visiting' } +MicLaTeXWriter >> visitNote: aMicNoteBlock [ + + canvas command + name: 'comment'; + parameter: aMicNoteBlock contents. +] + { #category : 'blocks - list' } MicLaTeXWriter >> visitOrderedList: aList [ "tabulation for \begin{itemize} it can do in the environment of the canvas" From ef78ae9f3d1e428934a853911b870c5a26a37c29 Mon Sep 17 00:00:00 2001 From: "quentin.moutte.etu" Date: Sat, 10 Aug 2024 13:36:16 +0200 Subject: [PATCH 3/3] add visitNode to microdownVisitor for fix broken test --- src/Microdown/MicrodownVisitor.class.st | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Microdown/MicrodownVisitor.class.st b/src/Microdown/MicrodownVisitor.class.st index 7744db92..e2e010ff 100644 --- a/src/Microdown/MicrodownVisitor.class.st +++ b/src/Microdown/MicrodownVisitor.class.st @@ -166,6 +166,10 @@ MicrodownVisitor >> visitMonospace: aFormat [ ] +{ #category : 'visiting - inline elements' } +MicrodownVisitor >> visitNote: aNote [ +] + { #category : 'visiting - list' } MicrodownVisitor >> visitOrderedList: anOrderedList [