Improving conversion from PubPub footnotes links to Markdeep's.
This commit is contained in:
parent
1770fc89cc
commit
ef2b6e7190
@ -59,6 +59,21 @@ Markdeep >> bodyReplaceAll: original with: replacement [
|
||||
self body: (self body copyReplaceAll: original with: replacement)
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Markdeep >> commentPubPubDelimiters [
|
||||
| commented openners |
|
||||
openners := #('::: {.pub-body-component}' '::: {.editor .Prosemirror}' '::: {.pub-notes}').
|
||||
commented := self body.
|
||||
openners do: [:openner |
|
||||
commented := commented copyReplaceAll: openner with: '<!--@div-open ', openner, '-->'
|
||||
].
|
||||
commented := commented
|
||||
copyReplaceAll: ':::
|
||||
' with: '<!--@div-close ::: -->
|
||||
'.
|
||||
self body: commented
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Markdeep >> comments [
|
||||
^ comments ifNil: [ ^ comments := true ]
|
||||
@ -290,20 +305,22 @@ Markdeep >> processMarkdownFor: aFileReference [
|
||||
|
||||
{ #category : #accessing }
|
||||
Markdeep >> pubPubFootnoteMetadataFromString: string [
|
||||
| sanitized footnoteData |
|
||||
| sanitized footnoteData altLine id |
|
||||
(string lines size <= 1) ifTrue: [ ^ nil ].
|
||||
sanitized := '' writeStream.
|
||||
string lines allButFirstDo: [:line |
|
||||
(line beginsWith: '>') ifTrue: [
|
||||
(line beginsWith: '>')
|
||||
ifTrue: [ altLine := line allButFirst ]
|
||||
ifFalse: [ altLine := line ].
|
||||
sanitized
|
||||
nextPutAll: line allButFirst;
|
||||
nextPutAll: altLine trimmed;
|
||||
nextPutAll: String lf
|
||||
]
|
||||
].
|
||||
sanitized := sanitized contents copyReplaceAll: '.footnote' with: ''.
|
||||
sanitized := sanitized copyReplaceAll: 'type=' with: 'type: '.
|
||||
sanitized := sanitized copyReplaceAll: 'value=' with: 'value: '.
|
||||
footnoteData := { 'id' -> string lines first allButFirst } asDictionary.
|
||||
id := (string lines first) allButFirst trimmed.
|
||||
footnoteData := { 'id' -> id } asDictionary.
|
||||
footnoteData addAll: (MiniDocs yamlToJson: sanitized).
|
||||
^ footnoteData
|
||||
]
|
||||
@ -348,6 +365,7 @@ Markdeep >> pubPubFootnotesText [
|
||||
Markdeep >> pubPubFootnotesToMarkdeep [
|
||||
| footnotes sanitized cleanedFootnotesText |
|
||||
footnotes := OrderedDictionary new.
|
||||
self pubPubFootnoteRawLinks ifEmpty: [ ^self ].
|
||||
self pubPubFootnoteRawLinks do: [:link | | footnote|
|
||||
footnote := self pubPubFootnoteMetadataFromString: link second.
|
||||
footnote ifNotNil: [ | toReplace |
|
||||
@ -366,6 +384,13 @@ Markdeep >> pubPubFootnotesToMarkdeep [
|
||||
self body: (sanitized copyReplaceAll: self pubPubFootnotesText with: cleanedFootnotesText contents)
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Markdeep >> replaceBackslashBreaklines [
|
||||
self bodyReplaceAll: '\
|
||||
' with: '<br>
|
||||
'
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Markdeep >> tail [
|
||||
"I enable the document tail, which, in turn, enables a Markdeep document"
|
||||
|
Loading…
Reference in New Issue
Block a user