Abstracting PubPub republication process.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-05-14 13:42:00 -05:00
parent dc218111e6
commit 745e9d8e6e
2 changed files with 68 additions and 2 deletions

View File

@ -463,11 +463,19 @@ Markdeep >> removeCCByLicenseDiv [
{ #category : #accessing } { #category : #accessing }
Markdeep >> renamePubPubFootnotes [ Markdeep >> renamePubPubFootnotes [
| reformated bodyLines beforeFootnotes afterFootnotes newBodyLines response | | reformated bodyLines beforeFootnotes afterFootnotesRaw afterFootnotes newBodyLines response |
reformated := self reformatPubPubFootnotes. reformated := self reformatPubPubFootnotes.
bodyLines := self body lines. bodyLines := self body lines.
beforeFootnotes := bodyLines copyFrom: 1 to: self pubPubFootnotesLinesRangeForBody first . beforeFootnotes := bodyLines copyFrom: 1 to: self pubPubFootnotesLinesRangeForBody first .
afterFootnotes := bodyLines copyFrom: self pubPubFootnotesLinesRangeForBody second to: bodyLines size. afterFootnotesRaw := bodyLines copyFrom: self pubPubFootnotesLinesRangeForBody second to: bodyLines size.
afterFootnotes := OrderedCollection new.
afterFootnotesRaw do:[:line |
(line beginsWith: ':::')
ifTrue: [
afterFootnotes
add: (line copyReplaceAll: ':::' with: '<!--@div-closer ::: -->').
]
].
newBodyLines := newBodyLines :=
(beforeFootnotes copyWithAll: (beforeFootnotes copyWithAll:
(#('# Footnotes' '') (#('# Footnotes' '')
@ -487,6 +495,16 @@ Markdeep >> replaceBackslashBreaklines [
' '
] ]
{ #category : #accessing }
Markdeep >> replaceEscapedCharacters [
self
title: (self title copyReplaceAll: '\#' with: '#');
body: (self body copyReplaceAll: '\#' with: '#');
body: (self body copyReplaceAll: '\[' with: '[');
body: (self body copyReplaceAll: '\]' with: ']');
body: (self body copyReplaceAll: '\*' with: '*')
]
{ #category : #accessing } { #category : #accessing }
Markdeep >> replacePubPubFootnotesIdentifiers [ Markdeep >> replacePubPubFootnotesIdentifiers [
| footnotes sanitized parsedLinks linkIdentifiers | | footnotes sanitized parsedLinks linkIdentifiers |

View File

@ -0,0 +1,48 @@
Class {
#name : #PubPub,
#superclass : #Object,
#instVars : [
'address',
'tableOfContents',
'titles',
'folder'
],
#category : #'MiniDocs-Model'
}
{ #category : #accessing }
PubPub >> address [
^ address
]
{ #category : #accessing }
PubPub >> address: anUrl [
address := anUrl
]
{ #category : #accessing }
PubPub >> defaultTitle [
^ self titles associations first value
]
{ #category : #accessing }
PubPub >> folder: localDirectory [
folder := localDirectory
]
{ #category : #accessing }
PubPub >> printOn: aStream [
super printOn: aStream.
aStream
nextPutAll: '(',self defaultTitle, ' | ', self address, ' )'
]
{ #category : #'as yet unclassified' }
PubPub >> tableOfContents [
^ tableOfContents ifNil: [tableOfContents := Dictionary new]
]
{ #category : #accessing }
PubPub >> titles [
^ titles ifNil: [titles := OrderedDictionary new]
]