Skip to content

Commit

Permalink
Merge pull request #849 from moufort/829-introduce-notes--configuration
Browse files Browse the repository at this point in the history
Issue 829 introduce notes  configuration
  • Loading branch information
Ducasse authored Aug 10, 2024
2 parents 96b873b + 064b212 commit cdc8675
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Microdown-LaTeXExporter-Tests/MicLaTeXWriterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [

Expand Down
8 changes: 8 additions & 0 deletions src/Microdown-LaTeXExporter/MicLaTeXWriter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 17 additions & 0 deletions src/Microdown-Tests/MicNoteBlockTest.class.st
Original file line number Diff line number Diff line change
@@ -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'.
]
22 changes: 22 additions & 0 deletions src/Microdown/MicNoteBlock.class.st
Original file line number Diff line number Diff line change
@@ -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: [ '' ]
]
4 changes: 4 additions & 0 deletions src/Microdown/MicrodownVisitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ MicrodownVisitor >> visitMonospace: aFormat [

]

{ #category : 'visiting - inline elements' }
MicrodownVisitor >> visitNote: aNote [
]

{ #category : 'visiting - list' }
MicrodownVisitor >> visitOrderedList: anOrderedList [

Expand Down

0 comments on commit cdc8675

Please sign in to comment.