PubPub footnotes conversion

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-05-10 11:31:54 -05:00
parent e20cca500e
commit 77ddf8a801

View File

@ -140,6 +140,21 @@ Markdeep >> contents [
^ output contents. ^ output contents.
] ]
{ #category : #accessing }
Markdeep >> converPubPubFootnoteBetween: footnote and: nextFootnote in: footnotesArray [
| currentNoteIndex nextNoteIndex response noteLines |
currentNoteIndex := footnotesArray indexOf: footnote, ': '.
nextNoteIndex := footnotesArray indexOf: footnote, ': '.
noteLines := footnotesArray copyFrom: currentNoteIndex to: nextNoteIndex.
response := '' writeStream.
noteLines do: [:line |
line
ifNotEmpty: [ response nextPutAll: line, Character lf ]
ifEmpty: [ response nextPut: '<br>' ]
].
^ response contents
]
{ #category : #utilities } { #category : #utilities }
Markdeep >> fontAwesomeHeader [ Markdeep >> fontAwesomeHeader [
"I enable the font awesome support in the document header" "I enable the font awesome support in the document header"
@ -411,7 +426,7 @@ Markdeep >> removeCCByLicenseDiv [
{ #category : #accessing } { #category : #accessing }
Markdeep >> renamePubPubFootnotes [ Markdeep >> renamePubPubFootnotes [
| footnotesLines footnotesIDs toReplace | | footnotesLines footnotesIDs toReplace response |
footnotesLines := self contents lines footnotesLines := self contents lines
copyFrom: self pubPubFootnotesLinesRange first copyFrom: self pubPubFootnotesLinesRange first
to: self pubPubFootnotesLinesRange second. to: self pubPubFootnotesLinesRange second.
@ -423,8 +438,16 @@ Markdeep >> renamePubPubFootnotes [
index := footnotesLines indexOf: replacement. index := footnotesLines indexOf: replacement.
footnotesLines at: index put: '[^', (footnotesIDs at: i),']: ' footnotesLines at: index put: '[^', (footnotesIDs at: i),']: '
]. ].
^ footnotesLines response := '' writeStream.
footnotesIDs allButLast doWithIndex: [:footnote :i |
response
nextPutAll:
(self
converPubPubFootnoteBetween: footnote
and: (footnotesIDs at: i + 1)
in: footnotesLines)
].
^ response
] ]
{ #category : #accessing } { #category : #accessing }