Preparing footnotes replacement.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-05-12 19:21:04 -05:00
parent 7855e9e0c3
commit e46329d9e1
1 changed files with 20 additions and 10 deletions

View File

@ -152,6 +152,7 @@ Markdeep >> converPubPubFootnoteBetween: footnote and: nextFootnote in: footnote
ifNotEmpty: [ response nextPutAll: line, String lf ]
"ifEmpty: [ response nextPutAll: ' ' ]?"
].
response nextPutAll: String lf.
^ response contents
]
@ -335,10 +336,10 @@ Markdeep >> pubPubFootnoteRawLinks [
]
{ #category : #accessing }
Markdeep >> pubPubFootnotesLinesRange [
Markdeep >> pubPubFootnotesLinesRangeFor: contentSection [
| beginningLine endingLine |
beginningLine := self contents lines size + 1.
self contents lines doWithIndex: [:line :i |
beginningLine := contentSection lines size + 1.
contentSection lines doWithIndex: [:line :i |
(line includesSubstring: '::: {.pub-notes}') ifTrue: [ beginningLine := i ].
(i > beginningLine and: [ line beginsWith: ':::' ])
ifTrue: [
@ -348,12 +349,22 @@ Markdeep >> pubPubFootnotesLinesRange [
]
]
{ #category : #accessing }
Markdeep >> pubPubFootnotesLinesRangeForBody [
^ self pubPubFootnotesLinesRangeFor: self body
]
{ #category : #accessing }
Markdeep >> pubPubFootnotesLinesRangeForContents [
^ self pubPubFootnotesLinesRangeFor: self contents
]
{ #category : #accessing }
Markdeep >> pubPubFootnotesText [
| footnotesLines output |
footnotesLines := self contents lines
copyFrom: self pubPubFootnotesLinesRange first + 3
to: self pubPubFootnotesLinesRange second - 1.
copyFrom: self pubPubFootnotesLinesRangeForContents first + 3
to: self pubPubFootnotesLinesRangeForContents second - 1.
output := '' writeStream.
footnotesLines do: [:line |
output
@ -428,8 +439,8 @@ Markdeep >> removeCCByLicenseDiv [
Markdeep >> renamePubPubFootnotes [
| footnotesLines footnotesIDs toReplace response |
footnotesLines := self contents lines
copyFrom: self pubPubFootnotesLinesRange first
to: self pubPubFootnotesLinesRange second.
copyFrom: self pubPubFootnotesLinesRangeForContents first
to: self pubPubFootnotesLinesRangeForContents second.
footnotesIDs := self replacePubPubFootnotesIdentifiers.
toReplace := footnotesLines select: [:line |
(line includesSubstring: ' [[]{.pub-note-content-component}]{#fn-')
@ -438,8 +449,7 @@ Markdeep >> renamePubPubFootnotes [
index := footnotesLines indexOf: replacement.
footnotesLines at: index put: '[^', (footnotesIDs at: i),']: '
].
^ footnotesLines
"response := '' writeStream.
response := '' writeStream.
footnotesIDs allButLast doWithIndex: [:footnote :i |
response
nextPutAll:
@ -448,7 +458,7 @@ Markdeep >> renamePubPubFootnotes [
and: (footnotesIDs at: i + 1)
in: footnotesLines)
].
^ response"
^ response contents
]
{ #category : #accessing }