Format conversion before metadata extraction.
This commit is contained in:
parent
ef2b6e7190
commit
a53cb5823e
@ -305,23 +305,27 @@ Markdeep >> processMarkdownFor: aFileReference [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
Markdeep >> pubPubFootnoteMetadataFromString: string [
|
Markdeep >> pubPubFootnoteMetadataFromString: string [
|
||||||
| sanitized footnoteData altLine id |
|
| sanitized footnoteData altLine altString id |
|
||||||
(string lines size <= 1) ifTrue: [ ^ nil ].
|
(string lines size <= 1) ifTrue: [ ^ nil ].
|
||||||
sanitized := '' writeStream.
|
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: '>')
|
(line beginsWith: '>')
|
||||||
ifTrue: [ altLine := line allButFirst ]
|
ifTrue: [ altLine := line allButFirst ]
|
||||||
ifFalse: [ altLine := line ].
|
ifFalse: [ altLine := line ].
|
||||||
sanitized
|
sanitized
|
||||||
nextPutAll: altLine trimmed;
|
nextPutAll: altLine trimBoth;
|
||||||
nextPutAll: String lf
|
nextPutAll: String lf
|
||||||
].
|
].
|
||||||
sanitized := sanitized contents copyReplaceAll: '.footnote' with: ''.
|
sanitized := sanitized contents.
|
||||||
sanitized := sanitized copyReplaceAll: 'type=' with: 'type: '.
|
sanitized := sanitized copyReplaceAll: 'type=' with: 'type: '.
|
||||||
sanitized := sanitized copyReplaceAll: 'value=' with: 'value: '.
|
sanitized := sanitized copyReplaceAll: 'value=' with: 'value: '.
|
||||||
id := (string lines first) allButFirst trimmed.
|
id := (string lines first) allButFirst trimmed.
|
||||||
footnoteData := { 'id' -> id } asDictionary.
|
footnoteData := { 'id' -> id } asDictionary.
|
||||||
footnoteData addAll: (MiniDocs yamlToJson: sanitized).
|
footnoteData addAll: (MiniDocs yamlToJson: sanitized trimmed).
|
||||||
^ footnoteData
|
^ footnoteData
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user