Skip to content

Commit

Permalink
Fix some errors and API/clients of the textualbuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
Ducasse committed Sep 16, 2024
1 parent ef20263 commit a2e06ef
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/Microdown-LaTeXExporter/MicLaTeXWriter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,8 @@ MicLaTeXWriter >> writeTableCellContent: aCell [
ifTrue: [
canvas command
name: 'textbf';
parameter: [ super visitTableCell: aCell ] ]
ifFalse: [ super visitTableCell: aCell ]
parameter: [ self visitTableCell: aCell ] ]
ifFalse: [ self visitTableCell: aCell ]
]

{ #category : 'blocks - table' }
Expand Down
12 changes: 6 additions & 6 deletions src/Microdown-Tests/MicrodownParserTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ MicrodownParserTest >> testAnchorMarkupInsideLine [
MicrodownParserTest >> testAnnotatedBlock [

| source root annotated |
source := AnnotatedParagraphMarkup , 'important]
source := AnnotatedParagraphOpeningMarkup , 'important]
> this is an important paragraph on one line.'.
root := parser parse: source.
self assert: root children size equals: 1.
Expand Down Expand Up @@ -147,7 +147,7 @@ MicrodownParserTest >> testAnnotatedBlockBackwardCompatibleWithDifferentLabel [
MicrodownParserTest >> testAnnotatedBlockOnMultipleLinesParserLogic [

| source root annotated line |
source := (AnnotatedParagraphMarkup , 'important]
source := (AnnotatedParagraphOpeningMarkup , 'important]
> this is an
> important point because...!') readStream.

Expand Down Expand Up @@ -182,7 +182,7 @@ important point because...!'.
{ #category : 'tests - annotated-paragraph' }
MicrodownParserTest >> testAnnotatedBlockOnTwoLines [
| source root annotated |
source := AnnotatedParagraphMarkup , 'important]
source := AnnotatedParagraphOpeningMarkup , 'important]
> this is an important
> paragraph on two lines.'.
root := parser parse: source.
Expand All @@ -197,7 +197,7 @@ paragraph on two lines.'
{ #category : 'tests - annotated-paragraph' }
MicrodownParserTest >> testAnnotatedBlockOnTwoLinesWithFormatting [
| source root annotated |
source := AnnotatedParagraphMarkup , 'important]
source := AnnotatedParagraphOpeningMarkup , 'important]
> **this** is an _important_
> paragraph on two lines.'.
root := parser parse: source.
Expand All @@ -214,7 +214,7 @@ paragraph on two lines.))'
MicrodownParserTest >> testAnnotatedBlockTextElements [

| source root annotated |
source := AnnotatedParagraphMarkup , 'important]
source := AnnotatedParagraphOpeningMarkup , 'important]
> this is an **important** paragraph on one line.'.
root := parser parse: source.
self assert: root children size equals: 1.
Expand All @@ -231,7 +231,7 @@ MicrodownParserTest >> testAnnotatedBlockWithListParserLogic [
"The test does not test what we want. We want a listblock inside the annotatedBlock"
| source root annotated line |
self flag: #fixme.
source := (AnnotatedParagraphMarkup , 'important]
source := (AnnotatedParagraphOpeningMarkup , 'important]
> this is a point
> - one
* two ' ) readStream.
Expand Down
2 changes: 1 addition & 1 deletion src/Microdown/MicAnnotatedParagraphBlock.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ MicAnnotatedParagraphBlock >> initialize [
{ #category : 'testing' }
MicAnnotatedParagraphBlock >> lineMarkup [

^ AnnotatedParagraphMarkup
^ AnnotatedParagraphOpeningMarkup
]

{ #category : 'accessing' }
Expand Down
6 changes: 4 additions & 2 deletions src/Microdown/MicMicrodownSharedPool.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Class {
'AnchorReferenceCloserMarkup',
'AnchorReferenceOpenerMarkup',
'AnnotatedParagraphBackwardCompatibleMarkup',
'AnnotatedParagraphMarkup',
'AnnotatedParagraphClosingMarkup',
'AnnotatedParagraphOpeningMarkup',
'AnnotationCloserMarkup',
'AnnotationOpenerMarkup',
'ArgumentListDelimiter',
Expand Down Expand Up @@ -60,7 +61,8 @@ MicMicrodownSharedPool class >> initialize [
AnchorMarkup := '@'.
AnnotatedParagraphBackwardCompatibleMarkup := '!!'.
"we keep it to avoid breaking existing text but we should favor one that is compatible with github eg the next one"
AnnotatedParagraphMarkup := '>[!'.
AnnotatedParagraphOpeningMarkup := '>[!'.
AnnotatedParagraphClosingMarkup := ']'.
CodeblockMarkup := '```'.
CommentedLineMarkup := '%'.
EnvironmentClosingBlockMarkup := '!>'.
Expand Down
39 changes: 19 additions & 20 deletions src/Microdown/MicMicrodownTextualBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,16 @@ MicMicrodownTextualBuilder >> anchorReference: aText [

{ #category : 'element - annotated' }
MicMicrodownTextualBuilder >> annotated: annotation paragraph: aBlock [
"!!Important
"Was !!Important
attention there is not space between the !! and the label (annotation in pillar) or we should improve the microdown parser.
Now this is >[! Important ]"

attention there is not space between the !! and the label (annotation in pillar) or we should improve the microdown parser"
self rawAnnotated: annotation paragraph: aBlock.
self newLine

]

{ #category : 'element - annotated' }
MicMicrodownTextualBuilder >> annotatedAnnotation: annotation [
"I'm made to be followed by a paragraph. I manage the space between the annotation/label and the paragraph."

"!!Important there is not space between the !! and the label (annotation in pillar) or we should improve the microdown parser"
self
raw: AnnotatedParagraphMarkup;
raw: annotation;
raw: String space


]

{ #category : 'element - annotated' }
MicMicrodownTextualBuilder >> annotation: aString arguments: aDictionary [

Expand Down Expand Up @@ -519,17 +508,27 @@ MicMicrodownTextualBuilder >> raw: aString [

{ #category : 'element - annotated' }
MicMicrodownTextualBuilder >> rawAnnotated: annotation paragraph: aBlock [
"!!Important
"It was !!Important
attention there is not space between the !! and the label (annotation in pillar) or we should improve the microdown parser
now we use
attention there is not space between the !! and the label (annotation in pillar) or we should improve the microdown parser"
>[! Important]
> text
> text2
"

self
raw: AnnotatedParagraphMarkup;
raw: AnnotatedParagraphOpeningMarkup;
raw: annotation;
raw: $];
raw: AnnotatedParagraphClosingMarkup ;
raw: Character cr;
raw: $>;
raw: String space;
rawParagraph: aBlock
rawParagraph: aBlock;
raw: Character cr


]
Expand Down
2 changes: 1 addition & 1 deletion src/Microdown/MicrodownParser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ MicrodownParser >> initialize [
dispatchTable at: AnchorMarkup put: MicAnchorBlock.
dispatchTable at: HeaderMarkup put: MicHeaderBlock.
dispatchTable at: CodeblockMarkup put: MicAbstractCodeBlock.
dispatchTable at: AnnotatedParagraphMarkup put: MicAnnotatedParagraphBlock.
dispatchTable at: AnnotatedParagraphOpeningMarkup put: MicAnnotatedParagraphBlock.
dispatchTable at: AnnotatedParagraphBackwardCompatibleMarkup put: MicAnnotatedParagraphBlock.
dispatchTable at: CommentedLineMarkup put: MicCommentBlock.
dispatchTable at: HorizontalLineMarkup put: MicHorizontalLineBlock.
Expand Down

0 comments on commit a2e06ef

Please sign in to comment.