diff --git a/src/Microdown-BookTester/MicAnchoredSectionTableFigureCheckerTest.class.st b/src/Microdown-BookTester/MicAnchoredSectionTableFigureCheckerTest.class.st index 2672092fb..731c4989d 100644 --- a/src/Microdown-BookTester/MicAnchoredSectionTableFigureCheckerTest.class.st +++ b/src/Microdown-BookTester/MicAnchoredSectionTableFigureCheckerTest.class.st @@ -131,7 +131,7 @@ MicAnchoredSectionTableFigureCheckerTest >> testFigureCorrect [ MicAnchoredSectionTableFigureCheckerTest >> testFigureExplanation [ checker checkProject: fileSystem / 'figureWrong.md'. self assert: checker results first explanation - equals: 'Text: "figure " in file/figureWrong.md contains a mistake: [figure *@figbla@*] should be capitalized as [figure *@figbla@*].' + equals: 'Text: "figure " in file /figureWrong.md contains a mistake: [figure *@figbla@*] should be capitalized as [figure *@figbla@*].' ] { #category : 'tests - flagged violations' } @@ -186,7 +186,7 @@ MicAnchoredSectionTableFigureCheckerTest >> testTableLowercaseDetectedWithSometh self assert: checker results first detail equals: 'table *@tabbla@*'. self assert: checker results first explanation - equals: 'Text: "in table " in file/theTableWrongNoTheButIn.md contains a mistake: [table *@tabbla@*] should be capitalized as [table *@tabbla@*].' + equals: 'Text: "in table " in file /theTableWrongNoTheButIn.md contains a mistake: [table *@tabbla@*] should be capitalized as [table *@tabbla@*].' ] { #category : 'tests - flagged violations' } @@ -198,7 +198,7 @@ MicAnchoredSectionTableFigureCheckerTest >> testTableLowercaseDetectedWithThe [ self assert: checker results first detail equals: 'The table *@tabbla@*'. self assert: checker results first explanation - equals: 'Text: "The table " in file/theTableWrongWithThe.md contains a mistake: [The table *@tabbla@*] should be capitalized as [The *@tabbla@*].' + equals: 'Text: "The table " in file /theTableWrongWithThe.md contains a mistake: [The table *@tabbla@*] should be capitalized as [The *@tabbla@*].' ] { #category : 'tests - configure' } @@ -218,7 +218,7 @@ MicAnchoredSectionTableFigureCheckerTest >> testTextWithoutAnchorWithUppercase [ self deny: checker isOkay. self assert: checker results size equals: 1. - self assert: checker results first explanation equals: 'Text: "in Figure without anchor" in file/noAnchorUppercase.md contains a mistake: [missing anchor for Figure] should be capitalized as [missing Figure].'. + self assert: checker results first explanation equals: 'Text: "in Figure without anchor" in file /noAnchorUppercase.md contains a mistake: [missing anchor for Figure] should be capitalized as [missing Figure].'. ] { #category : 'tests - flagged violations' } @@ -230,7 +230,7 @@ MicAnchoredSectionTableFigureCheckerTest >> testTheFigureDetected [ self assert: checker results first explanation - equals: 'Text: "the figure " in file/theFigureWrong.md contains a mistake: [the figure *@figbla@*] should be capitalized as [the *@figbla@*].' + equals: 'Text: "the figure " in file /theFigureWrong.md contains a mistake: [the figure *@figbla@*] should be capitalized as [the *@figbla@*].' ] @@ -242,7 +242,7 @@ MicAnchoredSectionTableFigureCheckerTest >> testTheSectionDetected [ self assert: checker results first explanation - equals: 'Text: "the section " in file/theSectionWrong.md contains a mistake: [the section *@seclab@*] should be capitalized as [the *@seclab@*].' + equals: 'Text: "the section " in file /theSectionWrong.md contains a mistake: [the section *@seclab@*] should be capitalized as [the *@seclab@*].' ] @@ -254,6 +254,6 @@ MicAnchoredSectionTableFigureCheckerTest >> testTheTableDetected [ self assert: checker results first explanation - equals: 'Text: "the table " in file/theTableWrong.md contains a mistake: [the table *@tabbla@*] should be capitalized as [the *@tabbla@*].' + equals: 'Text: "the table " in file /theTableWrong.md contains a mistake: [the table *@tabbla@*] should be capitalized as [the *@tabbla@*].' ] diff --git a/src/Microdown-BookTester/MicElementOfHeaderIsNotCapitalizedResult.class.st b/src/Microdown-BookTester/MicElementOfHeaderIsNotCapitalizedResult.class.st index 933ea16ab..111737d57 100644 --- a/src/Microdown-BookTester/MicElementOfHeaderIsNotCapitalizedResult.class.st +++ b/src/Microdown-BookTester/MicElementOfHeaderIsNotCapitalizedResult.class.st @@ -8,7 +8,7 @@ Class { { #category : 'accessing' } MicElementOfHeaderIsNotCapitalizedResult >> explanation [ - ^ 'Header: "' , micElement text , '" in file' , self inFile fullName , ' contains a mistake: ' , detail , ' should be capitalized.' + ^ 'Header: "' , micElement text , '" in file ' , self inFile fullName , ' contains a mistake: ' , detail , ' should be capitalized.' ] { #category : 'kinds' } diff --git a/src/Microdown-BookTester/MicLastPeriodInCaptionCheckerTest.class.st b/src/Microdown-BookTester/MicLastPeriodInCaptionCheckerTest.class.st index 37f0149e1..78534add5 100644 --- a/src/Microdown-BookTester/MicLastPeriodInCaptionCheckerTest.class.st +++ b/src/Microdown-BookTester/MicLastPeriodInCaptionCheckerTest.class.st @@ -103,7 +103,7 @@ MicLastPeriodInCaptionCheckerTest >> testCodeCheckerIdentifyCorrectlyExtraPeriod self assert: checker results first explanation equals: - 'Text: "This is the famous correctly ending period." in file/codeCaptionEndingWithPeriod.md contains a mistake: Captions should not be terminated with a period (.).' + 'Text: "This is the famous correctly ending period." in file /codeCaptionEndingWithPeriod.md contains a mistake: Captions should not be terminated with a period (.).' ] { #category : 'tests - missing period' } @@ -116,7 +116,7 @@ MicLastPeriodInCaptionCheckerTest >> testCodeCheckerIdentifyCorrectlyMissingExtr self assert: checker results first explanation equals: - 'Text: "This is the famous missing period" in file/codeCaptionMissingPeriod.md contains a mistake: Captions should be terminated with a period (.).' + 'Text: "This is the famous missing period" in file /codeCaptionMissingPeriod.md contains a mistake: Captions should be terminated with a period (.).' ] { #category : 'tests - explanation' } @@ -193,7 +193,7 @@ MicLastPeriodInCaptionCheckerTest >> testFigureCheckerIdentifyCorrectlyExtraPeri self assert: checker results first explanation - equals: 'Text: "![This is the famous correctly ending period.](figures/f.png)" in file/figureCaptionEndingWithPeriod.md contains a mistake: Captions should not be terminated with a period (.).' + equals: 'Text: "![This is the famous correctly ending period.](figures/f.png)" in file /figureCaptionEndingWithPeriod.md contains a mistake: Captions should not be terminated with a period (.).' ] @@ -206,7 +206,7 @@ MicLastPeriodInCaptionCheckerTest >> testFigureCheckerIdentifyCorrectlyMissingEx self assert: checker results first explanation - equals: 'Text: "![This is the famous missing period](figures/f.png)" in file/figureCaptionMissingPeriod.md contains a mistake: Captions should be terminated with a period (.).' + equals: 'Text: "![This is the famous missing period](figures/f.png)" in file /figureCaptionMissingPeriod.md contains a mistake: Captions should be terminated with a period (.).' ] @@ -236,7 +236,7 @@ MicLastPeriodInCaptionCheckerTest >> testMathCheckerIdentifyCorrectlyExtraPeriod self assert: checker results first explanation equals: - 'Text: "This is the famous correctly ending period." in file/equationCaptionEndingWithPeriod.md contains a mistake: Captions should not be terminated with a period (.).' + 'Text: "This is the famous correctly ending period." in file /equationCaptionEndingWithPeriod.md contains a mistake: Captions should not be terminated with a period (.).' ] { #category : 'tests - missing period' } @@ -249,5 +249,5 @@ MicLastPeriodInCaptionCheckerTest >> testMathCheckerIdentifyCorrectlyMissingExtr self assert: checker results first explanation equals: - 'Text: "This is the famous missing period" in file/equationCaptionMissingPeriod.md contains a mistake: Captions should be terminated with a period (.).' + 'Text: "This is the famous missing period" in file /equationCaptionMissingPeriod.md contains a mistake: Captions should be terminated with a period (.).' ] diff --git a/src/Microdown-BookTester/MicPeriodInCaptionResult.class.st b/src/Microdown-BookTester/MicPeriodInCaptionResult.class.st index fb9083978..9ba48e1ea 100644 --- a/src/Microdown-BookTester/MicPeriodInCaptionResult.class.st +++ b/src/Microdown-BookTester/MicPeriodInCaptionResult.class.st @@ -11,7 +11,7 @@ MicPeriodInCaptionResult >> explanation [ "not sure that text is ok we should have a common way to express caption between block, figure, and math" - ^ 'Text: "' , micElement text , '" in file' , self inFile fullName , ' contains a mistake: Captions should' + ^ 'Text: "' , micElement text , '" in file ' , self inFile fullName , ' contains a mistake: Captions should' , (codeShouldEndWithPeriod ifFalse: [ ' not ' ] ifTrue: [ ' ' ]) , 'be terminated with a period (.).' diff --git a/src/Microdown-BookTester/MicUseofWrongVocabularyResult.class.st b/src/Microdown-BookTester/MicUseofWrongVocabularyResult.class.st index bee0a4d09..ea93a8e2e 100644 --- a/src/Microdown-BookTester/MicUseofWrongVocabularyResult.class.st +++ b/src/Microdown-BookTester/MicUseofWrongVocabularyResult.class.st @@ -15,7 +15,7 @@ MicUseofWrongVocabularyResult >> explanation [ | wrongWord goodWord | wrongWord := patternPair key allButFirst allButLast. goodWord := patternPair value. - ^ 'Text: "' , micElement bodyString , '" in file' , self inFile fullName , ' contains a mistake: [' , wrongWord + ^ 'Text: "' , micElement bodyString , '" in file ' , self inFile fullName , ' contains a mistake: [' , wrongWord , '] should not be used. We should use ' , goodWord ] diff --git a/src/Microdown-BookTester/MicVocabularyCheckerTest.class.st b/src/Microdown-BookTester/MicVocabularyCheckerTest.class.st index 225c379d7..8a9d24891 100644 --- a/src/Microdown-BookTester/MicVocabularyCheckerTest.class.st +++ b/src/Microdown-BookTester/MicVocabularyCheckerTest.class.st @@ -126,7 +126,7 @@ MicVocabularyCheckerTest >> testCheckerFindsAllowToMistake [ self assert: checker results first explanation equals: - 'Text: "We allow to edit the file." in file/mistakeAllowTo.md contains a mistake: [allow to] should not be used. We should use allow one to' + 'Text: "We allow to edit the file." in file /mistakeAllowTo.md contains a mistake: [allow to] should not be used. We should use allow one to' ] { #category : 'tests' } @@ -137,7 +137,7 @@ checker checkProject: fileSystem / 'mistakeAllowedTo.md'. self assert: checker results first explanation equals: - 'Text: "You are allowed to enter." in file/mistakeAllowedTo.md contains a mistake: [allowed to] should not be used. We should use allowed one to' + 'Text: "You are allowed to enter." in file /mistakeAllowedTo.md contains a mistake: [allowed to] should not be used. We should use allowed one to' ] { #category : 'tests' } @@ -149,7 +149,7 @@ MicVocabularyCheckerTest >> testCheckerFindsAllowsToMistake [ self assert: checker results first explanation equals: - 'Text: "The system allows to change settings." in file/mistakeAllowsTo.md contains a mistake: [allows to] should not be used. We should use allows one to' + 'Text: "The system allows to change settings." in file /mistakeAllowsTo.md contains a mistake: [allows to] should not be used. We should use allows one to' ] { #category : 'tests' } @@ -161,7 +161,7 @@ MicVocabularyCheckerTest >> testCheckerFindsBehaviourMistake [ self assert: checker results first explanation equals: - 'Text: "Pharo has interesting behaviour." in file/mistakeBehaviour.md contains a mistake: [behaviour] should not be used. We should use behavior' + 'Text: "Pharo has interesting behaviour." in file /mistakeBehaviour.md contains a mistake: [behaviour] should not be used. We should use behavior' ] { #category : 'tests' } @@ -173,7 +173,7 @@ MicVocabularyCheckerTest >> testCheckerFindsCentreMistake [ self assert: checker results first explanation equals: - 'Text: "The centre of the universe." in file/mistakeCentre.md contains a mistake: [centre] should not be used. We should use center' + 'Text: "The centre of the universe." in file /mistakeCentre.md contains a mistake: [centre] should not be used. We should use center' ] { #category : 'tests' } @@ -185,7 +185,7 @@ MicVocabularyCheckerTest >> testCheckerFindsColourMistake [ self assert: checker results first explanation equals: - 'Text: "The colour of the sky is blue." in file/mistakeColour.md contains a mistake: [colour] should not be used. We should use color' + 'Text: "The colour of the sky is blue." in file /mistakeColour.md contains a mistake: [colour] should not be used. We should use color' ] { #category : 'tests' } @@ -196,7 +196,7 @@ MicVocabularyCheckerTest >> testCheckerFindsColoursMistake [ self assert: checker results first explanation - equals:'Text: "Colours are beautiful." in file/mistakeColours.md contains a mistake: [colour] should not be used. We should use color' + equals:'Text: "Colours are beautiful." in file /mistakeColours.md contains a mistake: [colour] should not be used. We should use color' ] @@ -210,7 +210,7 @@ MicVocabularyCheckerTest >> testCheckerFindsMistakeInFigure [ self assert: checker results first explanation equals: - 'Text: "sub-presenter is not correct even in caption" in file/mistakeInFigure.md contains a mistake: [sub-presenter] should not be used. We should use subpresenter' + 'Text: "sub-presenter is not correct even in caption" in file /mistakeInFigure.md contains a mistake: [sub-presenter] should not be used. We should use subpresenter' ] { #category : 'tests' } @@ -222,7 +222,7 @@ MicVocabularyCheckerTest >> testCheckerFindsMistakeInHeader [ self assert: checker results first explanation equals: - 'Text: "sub-presenter is not correct." in file/mistakeInHeader.md contains a mistake: [sub-presenter] should not be used. We should use subpresenter' + 'Text: "sub-presenter is not correct." in file /mistakeInHeader.md contains a mistake: [sub-presenter] should not be used. We should use subpresenter' ] { #category : 'tests' } @@ -234,7 +234,7 @@ MicVocabularyCheckerTest >> testCheckerFindsMistakeInParagraph [ self assert: checker results first explanation equals: - 'Text: "Spec uses a sub presenter. And there is a mistake in the previous sentence." in file/mistakeInParagraph.md contains a mistake: [sub presenter] should not be used. We should use subpresenter' + 'Text: "Spec uses a sub presenter. And there is a mistake in the previous sentence." in file /mistakeInParagraph.md contains a mistake: [sub presenter] should not be used. We should use subpresenter' ] { #category : 'tests' } @@ -246,7 +246,7 @@ MicVocabularyCheckerTest >> testCheckerFindsMistakeInUppercasedText [ self assert: checker results first explanation equals: - 'Text: "sub-Presenter is not correct. The checker should pay attention that the text may use a different case than the pattern." in file/mistakeInUppercase.md contains a mistake: [sub-presenter] should not be used. We should use subpresenter' + 'Text: "sub-Presenter is not correct. The checker should pay attention that the text may use a different case than the pattern." in file /mistakeInUppercase.md contains a mistake: [sub-presenter] should not be used. We should use subpresenter' ] { #category : 'tests' } @@ -258,7 +258,7 @@ MicVocabularyCheckerTest >> testCheckerFindsVisualiseMistake [ self assert: checker results first explanation equals: - 'Text: "We will visualise the results." in file/mistakeVisualise.md contains a mistake: [visualise] should not be used. We should use visualize' + 'Text: "We will visualise the results." in file /mistakeVisualise.md contains a mistake: [visualise] should not be used. We should use visualize' ] { #category : 'tests - configuration' } diff --git a/src/Microdown-BookTester/MicWrongReferenceToFigSectTableAnchorResult.class.st b/src/Microdown-BookTester/MicWrongReferenceToFigSectTableAnchorResult.class.st index eb65acb8b..6c3bd9aa7 100644 --- a/src/Microdown-BookTester/MicWrongReferenceToFigSectTableAnchorResult.class.st +++ b/src/Microdown-BookTester/MicWrongReferenceToFigSectTableAnchorResult.class.st @@ -31,7 +31,7 @@ MicWrongReferenceToFigSectTableAnchorResult >> explanation [ ifFalse: [ words first , ' ' , words last capitalized ]. ^ 'Text: "' , micElement bodyString - , '" in file' , self inFile fullName + , '" in file ' , self inFile fullName , ' contains a mistake: [' , detail , '] should be capitalized as [' diff --git a/src/Microdown-RichTextComposer-Tests/MicRichTextComposerTest.class.st b/src/Microdown-RichTextComposer-Tests/MicRichTextComposerTest.class.st index bb74ab870..ab237d6a0 100644 --- a/src/Microdown-RichTextComposer-Tests/MicRichTextComposerTest.class.st +++ b/src/Microdown-RichTextComposer-Tests/MicRichTextComposerTest.class.st @@ -330,7 +330,6 @@ MicRichTextComposerTest >> testFigureCaptionRemote [ | source richText | source := 'See ![SomeText](https://pharo.org/web/files/pharo.png)'. richText := self composerClass asRichText: source. - self assert: (richText asString includesSubstring: 'SomeText') ] diff --git a/src/Microdown-RichTextComposer/MicRichTextComposer.class.st b/src/Microdown-RichTextComposer/MicRichTextComposer.class.st index 93452d6f2..1e2da6092 100644 --- a/src/Microdown-RichTextComposer/MicRichTextComposer.class.st +++ b/src/Microdown-RichTextComposer/MicRichTextComposer.class.st @@ -463,14 +463,16 @@ MicRichTextComposer >> visitFigure: aFigure [ | image anchor | [ - [ - image := aFigure reference loadImage. + [ image := aFigure reference loadImage. anchor := self anchorFor: image of: aFigure. - canvas << (self textWithImage: image usingAnchor: anchor) ] + canvas << (self textWithImage: image usingAnchor: anchor). + "for the caption" + canvas tab. + self visitChildrenOf: aFigure ] on: MicResourceReferenceError , UnrecognizedImageFormatError - do: [ self visitChildrenOf: aFigure ] ] - on: Error - do: [ :error | canvas << ('>>> ' , error printString , ' <<<') ] + do: [ self visitChildrenOf: aFigure ] ] + on: Error + do: [ :error | canvas << ('>>> ' , error printString , ' <<<') ] ] { #category : 'visiting' }