Fixing PubPub footnotes conversion

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-05-10 11:53:54 -05:00
parent 77ddf8a801
commit 7855e9e0c3
1 changed files with 9 additions and 8 deletions

View File

@ -143,14 +143,14 @@ Markdeep >> contents [
{ #category : #accessing } { #category : #accessing }
Markdeep >> converPubPubFootnoteBetween: footnote and: nextFootnote in: footnotesArray [ Markdeep >> converPubPubFootnoteBetween: footnote and: nextFootnote in: footnotesArray [
| currentNoteIndex nextNoteIndex response noteLines | | currentNoteIndex nextNoteIndex response noteLines |
currentNoteIndex := footnotesArray indexOf: footnote, ': '. currentNoteIndex := footnotesArray indexOf: '[^',footnote, ']: '.
nextNoteIndex := footnotesArray indexOf: footnote, ': '. nextNoteIndex := footnotesArray indexOf: '[^',nextFootnote, ']: '.
noteLines := footnotesArray copyFrom: currentNoteIndex to: nextNoteIndex. noteLines := footnotesArray copyFrom: currentNoteIndex to: nextNoteIndex - 1.
response := '' writeStream. response := '' writeStream.
noteLines do: [:line | noteLines do: [:line |
line line
ifNotEmpty: [ response nextPutAll: line, Character lf ] ifNotEmpty: [ response nextPutAll: line, String lf ]
ifEmpty: [ response nextPut: '<br>' ] "ifEmpty: [ response nextPutAll: ' ' ]?"
]. ].
^ response contents ^ response contents
] ]
@ -438,7 +438,8 @@ Markdeep >> renamePubPubFootnotes [
index := footnotesLines indexOf: replacement. index := footnotesLines indexOf: replacement.
footnotesLines at: index put: '[^', (footnotesIDs at: i),']: ' footnotesLines at: index put: '[^', (footnotesIDs at: i),']: '
]. ].
response := '' writeStream. ^ footnotesLines
"response := '' writeStream.
footnotesIDs allButLast doWithIndex: [:footnote :i | footnotesIDs allButLast doWithIndex: [:footnote :i |
response response
nextPutAll: nextPutAll:
@ -447,7 +448,7 @@ Markdeep >> renamePubPubFootnotes [
and: (footnotesIDs at: i + 1) and: (footnotesIDs at: i + 1)
in: footnotesLines) in: footnotesLines)
]. ].
^ response ^ response"
] ]
{ #category : #accessing } { #category : #accessing }
@ -459,7 +460,7 @@ Markdeep >> replaceBackslashBreaklines [
{ #category : #accessing } { #category : #accessing }
Markdeep >> replacePubPubFootnotesIdentifiers [ Markdeep >> replacePubPubFootnotesIdentifiers [
| footnotes sanitized parsedLinks linkIdentifiers footnotesLines | | footnotes sanitized parsedLinks linkIdentifiers |
footnotes := OrderedDictionary new. footnotes := OrderedDictionary new.
parsedLinks := self pubPubFootnoteRawLinks. parsedLinks := self pubPubFootnoteRawLinks.
parsedLinks ifEmpty: [ ^self ]. parsedLinks ifEmpty: [ ^self ].