Skip to content

Commit

Permalink
For remi
Browse files Browse the repository at this point in the history
  • Loading branch information
Ducasse committed May 25, 2024
1 parent 870778c commit 1efa9ef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Microdown-Tests/MicFigureBlockTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ MicFigureBlockTest >> testAnchorInCaption [
self assert: figure hasArguments.
self assert: figure hasAnchor.
self assert: figure anchor equals: '233'.
self assert: (figure arguments at: #width) equals: '80'
self assert: (figure arguments at: #width) equals: '80'.
self assert: figure children first bodyString equals: 'caption with space and dot...'
]

{ #category : 'running' }
Expand Down
12 changes: 9 additions & 3 deletions src/Microdown/MicInlineParser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ MicInlineParser >> parseEvaluatedBlock: blockType token: token stream: tokenStre
{ #category : 'private parsing' }
MicInlineParser >> parseNameUrlBlock: blockType from: aTokenStream token: token [

| skipRes children urlToken captionAndArgs caption rest toCaption newBlock |

| skipRes children urlToken caption rest toCaption newBlock |
self halt.
skipRes := self skipToUrlStartInStream: aTokenStream.
skipRes ifNil: [ ^ self createTextBlock: token string ].

Expand All @@ -113,12 +113,18 @@ MicInlineParser >> parseNameUrlBlock: blockType from: aTokenStream token: token
ifTrue: [toCaption := false].
toCaption ifTrue: [ caption add: each ]
ifFalse: [ rest add: each ] ].
self halt.
children := self parseChildrenIn: caption readStream.
self halt.
urlToken := aTokenStream next.
newBlock := blockType new
children: children;
url: urlToken undelimitedSubstring.
rest ifNotEmpty: [ newBlock arguments: (MicArgumentList withString: rest second string )].
rest
ifNotEmpty: [ newBlock arguments: (MicArgumentList withString: rest second string )]
ifEmpty: [
"We mark it to nil to indicate to the closeMe that there were no arguments in the caption. In the future when all the books and more will not use arguments in the url then we will remove this hack. For now it enables backward compatibility while giving precedence to caption arguments."
newBlock arguments: nil ].
newBlock closeMe.
^ newBlock
]
Expand Down

0 comments on commit 1efa9ef

Please sign in to comment.