@@ -28,6 +28,21 @@ Class {
2828 #tag : ' CodeLastPeriod'
2929}
3030
31+ { #category : ' visiting - inline elements' }
32+ MicLastPeriodInCaptionChecker >> checkExtraPeriodInCode: aCode [
33+ " we should revise the API of elements to be able to identify adorment for Equation, Figure and code block."
34+
35+ | captionText |
36+ captionText := self computeMathCaptionOf: aCode.
37+ captionText ifEmpty: [ ^ self ].
38+
39+ captionText trimRight last = $. ifTrue: [
40+ results add: (MicPeriodInCaptionResult new
41+ micElement: aCode;
42+ inFile: aCode fromFile;
43+ codeShouldEndWithPeriod: codeShouldEndWithPeriod) ]
44+ ]
45+
3146{ #category : ' visiting - inline elements' }
3247MicLastPeriodInCaptionChecker >> checkExtraPeriodInFigure: aFigure [
3348 " we should revise the API of elements to be able to identify adorment for Equation, Figure and code block."
@@ -53,6 +68,20 @@ MicLastPeriodInCaptionChecker >> checkExtraPeriodInMath: aMath [
5368 codeShouldEndWithPeriod: codeShouldEndWithPeriod) ]
5469]
5570
71+ { #category : ' visiting - inline elements' }
72+ MicLastPeriodInCaptionChecker >> checkMissingPeriodInCode: aCode [
73+
74+ | captionText |
75+ captionText := self computeMathCaptionOf: aCode.
76+ captionText ifEmpty: [ ^ self ].
77+
78+ captionText trimRight last = $. ifFalse: [
79+ results add: (MicPeriodInCaptionResult new
80+ micElement: aCode;
81+ inFile: aCode fromFile;
82+ codeShouldEndWithPeriod: codeShouldEndWithPeriod) ]
83+ ]
84+
5685{ #category : ' visiting - inline elements' }
5786MicLastPeriodInCaptionChecker >> checkMissingPeriodInFigure: aFigure [
5887
@@ -84,6 +113,17 @@ MicLastPeriodInCaptionChecker >> computeMathCaptionOf: aMath [
84113 ^ ' ' join: (aMath captionElements collect: [ :each | each text ])
85114]
86115
116+ { #category : ' visiting - inline elements' }
117+ MicLastPeriodInCaptionChecker >> visitCode: anEquation [
118+ " we should revise the API of elements to be able to identify adorment for Equation, Figure and code block."
119+
120+ " this way we could share the same logic between all the elements."
121+
122+ codeShouldEndWithPeriod
123+ ifTrue: [ self checkMissingPeriodInCode: anEquation ]
124+ ifFalse: [ self checkExtraPeriodInCode: anEquation ]
125+ ]
126+
87127{ #category : ' visiting - inline elements' }
88128MicLastPeriodInCaptionChecker >> visitFigure: aFigure [
89129
0 commit comments