Fixing footnotes conversion for several footnotes.
This commit is contained in:
parent
a53cb5823e
commit
dc7a4b93d1
@ -323,7 +323,7 @@ node-type= '.
|
||||
sanitized := sanitized contents.
|
||||
sanitized := sanitized copyReplaceAll: 'type=' with: 'type: '.
|
||||
sanitized := sanitized copyReplaceAll: 'value=' with: 'value: '.
|
||||
id := (string lines first) allButFirst trimmed.
|
||||
id := (altString lines first) allButFirst trimmed.
|
||||
footnoteData := { 'id' -> id } asDictionary.
|
||||
footnoteData addAll: (MiniDocs yamlToJson: sanitized trimmed).
|
||||
^ footnoteData
|
||||
@ -367,24 +367,30 @@ Markdeep >> pubPubFootnotesText [
|
||||
|
||||
{ #category : #accessing }
|
||||
Markdeep >> pubPubFootnotesToMarkdeep [
|
||||
| footnotes sanitized cleanedFootnotesText |
|
||||
| footnotes sanitized cleanedFootnotesText parsedLinks |
|
||||
footnotes := OrderedDictionary new.
|
||||
self pubPubFootnoteRawLinks ifEmpty: [ ^self ].
|
||||
self pubPubFootnoteRawLinks do: [:link | | footnote|
|
||||
parsedLinks := self pubPubFootnoteRawLinks.
|
||||
parsedLinks ifEmpty: [ ^self ].
|
||||
sanitized := self body.
|
||||
parsedLinks do: [:link | | footnote |
|
||||
footnote := self pubPubFootnoteMetadataFromString: link second.
|
||||
footnote ifNotNil: [ | toReplace |
|
||||
footnotes at: (footnote at: 'id') put: footnote.
|
||||
toReplace := '[', link first, ']', '{', link second, '}'.
|
||||
sanitized := self body copyReplaceAll: toReplace with: '[^', (footnote at: 'id'), ']'
|
||||
toReplace := '[', link first, ']{', link second, '}'.
|
||||
sanitized := sanitized copyReplaceAll: toReplace with: '[^', (footnote at: 'id'), ']'
|
||||
]
|
||||
].
|
||||
cleanedFootnotesText := '' writeStream.
|
||||
footnotes keysAndValuesDo: [:k :v |
|
||||
footnotes keysAndValuesDo: [:k :v |
|
||||
cleanedFootnotesText
|
||||
nextPutAll: '[^', k, ']: ';
|
||||
nextPutAll: (v at: 'data-value')
|
||||
nextPutAll: (v at: 'data-value'), String lf, String lf.
|
||||
].
|
||||
"^ {footnotes . sanitized copyReplaceAll: self pubPubFootnotesText with: cleanedFootnotesText contents }."
|
||||
"^ { 'links' -> parsedLinks .
|
||||
'footnotes' -> footnotes .
|
||||
'sanitized' -> sanitized .
|
||||
'footnotesRaw' -> self pubPubFootnotesText .
|
||||
'footnotesNew' -> cleanedFootnotesText contents } asDictionary."
|
||||
self body: (sanitized copyReplaceAll: self pubPubFootnotesText with: cleanedFootnotesText contents)
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user