From 745e9d8e6ea8bc6e8dac402c5c081145bf7aebc3 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sun, 14 May 2023 13:42:00 -0500 Subject: [PATCH] Abstracting PubPub republication process. --- src/MiniDocs/Markdeep.class.st | 22 ++++++++++++++-- src/MiniDocs/PubPub.class.st | 48 ++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 src/MiniDocs/PubPub.class.st diff --git a/src/MiniDocs/Markdeep.class.st b/src/MiniDocs/Markdeep.class.st index 9cbb507..8f79ec2 100644 --- a/src/MiniDocs/Markdeep.class.st +++ b/src/MiniDocs/Markdeep.class.st @@ -463,11 +463,19 @@ Markdeep >> removeCCByLicenseDiv [ { #category : #accessing } Markdeep >> renamePubPubFootnotes [ - | reformated bodyLines beforeFootnotes afterFootnotes newBodyLines response | + | reformated bodyLines beforeFootnotes afterFootnotesRaw afterFootnotes newBodyLines response | reformated := self reformatPubPubFootnotes. bodyLines := self body lines. 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: ''). + ] + ]. newBodyLines := (beforeFootnotes copyWithAll: (#('# 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 } Markdeep >> replacePubPubFootnotesIdentifiers [ | footnotes sanitized parsedLinks linkIdentifiers | diff --git a/src/MiniDocs/PubPub.class.st b/src/MiniDocs/PubPub.class.st new file mode 100644 index 0000000..4495372 --- /dev/null +++ b/src/MiniDocs/PubPub.class.st @@ -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] +]