From a53cb5823e82db2279c8e1d175ce968588a1e02b Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sun, 23 Oct 2022 20:42:26 -0500 Subject: [PATCH] Format conversion before metadata extraction. --- src/MiniDocs/Markdeep.class.st | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/MiniDocs/Markdeep.class.st b/src/MiniDocs/Markdeep.class.st index a7c55d4..a86afd9 100644 --- a/src/MiniDocs/Markdeep.class.st +++ b/src/MiniDocs/Markdeep.class.st @@ -305,23 +305,27 @@ Markdeep >> processMarkdownFor: aFileReference [ { #category : #accessing } Markdeep >> pubPubFootnoteMetadataFromString: string [ - | sanitized footnoteData altLine id | + | sanitized footnoteData altLine altString id | (string lines size <= 1) ifTrue: [ ^ nil ]. sanitized := '' writeStream. - string lines allButFirstDo: [:line | + altString := string copyReplaceAll: '.footnote' with: ''. + altString := altString copyReplaceAll: ' node-type=' + with: ' +node-type= '. + altString lines allButFirstDo: [:line | (line beginsWith: '>') ifTrue: [ altLine := line allButFirst ] ifFalse: [ altLine := line ]. sanitized - nextPutAll: altLine trimmed; + nextPutAll: altLine trimBoth; nextPutAll: String lf ]. - sanitized := sanitized contents copyReplaceAll: '.footnote' with: ''. + sanitized := sanitized contents. sanitized := sanitized copyReplaceAll: 'type=' with: 'type: '. sanitized := sanitized copyReplaceAll: 'value=' with: 'value: '. id := (string lines first) allButFirst trimmed. footnoteData := { 'id' -> id } asDictionary. - footnoteData addAll: (MiniDocs yamlToJson: sanitized). + footnoteData addAll: (MiniDocs yamlToJson: sanitized trimmed). ^ footnoteData ]