Debugging image links with links in the description.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-04-22 14:01:59 -05:00
parent 573c929845
commit 0c45ccb39e
2 changed files with 21 additions and 4 deletions

View File

@ -13,7 +13,7 @@ XMLElement >> asSnippetDictionary [
XMLElement >> sanitizedContent [ XMLElement >> sanitizedContent [
| className sanitizedText | | className sanitizedText |
className := self attributes at: 'st-class'. className := self attributes at: 'st-class'.
((className = 'LeTextSnippet') or: [className = 'LePictureSnippet']) (className = 'LeTextSnippet')
ifTrue: [ ifTrue: [
sanitizedText := self contentString. sanitizedText := self contentString.
sanitizedText := sanitizedText allButFirst. sanitizedText := sanitizedText allButFirst.
@ -26,6 +26,24 @@ XMLElement >> sanitizedContent [
sanitizedText do: [ :line | joinedText nextPutAll: line; nextPut: Character lf ]. sanitizedText do: [ :line | joinedText nextPutAll: line; nextPut: Character lf ].
sanitizedText := joinedText contents allButLast. sanitizedText := joinedText contents allButLast.
]. ].
(className = 'LePictureSnippet')
ifTrue: [ | linkParser linkParserNodes|
linkParser := (PPCommonMarkBlockParser parse: self contentString allButFirst)
accept: CMBlockVisitor new.
linkParserNodes := linkParser children first children.
linkParserNodes size = 1
ifTrue: [ sanitizedText := linkParserNodes first label text ]
ifFalse: [
sanitizedText := '' writeStream.
linkParserNodes allButLast do: [:each |
each className = 'PPCMText'
ifTrue: [ sanitizedText nextPutAll: each text allButFirst ].
each className = 'PPCMLink'
ifTrue: [ sanitizedText nextPutAll: each printString ]
].
sanitizedText := sanitizedText contents
]
].
^ sanitizedText ^ sanitizedText
] ]

View File

@ -39,9 +39,8 @@ PPCMLink >> printOn: aStream [
super initialize. super initialize.
^ aStream ^ aStream
nextPutAll: nextPutAll:
self label text, '[',self label text,']',
' -> ', '(',self destination,')'
self destination
] ]
{ #category : #accessing } { #category : #accessing }