From 4b75042fab56225705f804dfa35674c4dc1bdf2a Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sun, 12 Mar 2023 13:23:50 -0500 Subject: [PATCH] Refactoring class and methods hierarchies. --- src/MiniDocs/HedgeDoc.class.st | 8 ++++++++ src/MiniDocs/Markdeep.class.st | 15 --------------- src/MiniDocs/Markdown.class.st | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/MiniDocs/HedgeDoc.class.st b/src/MiniDocs/HedgeDoc.class.st index 23bfedc..971180a 100644 --- a/src/MiniDocs/HedgeDoc.class.st +++ b/src/MiniDocs/HedgeDoc.class.st @@ -22,6 +22,14 @@ HedgeDoc class >> newDefault [ defaultServer. ] +{ #category : #accessing } +HedgeDoc >> asMarkdeep [ + ^ Markdeep new + metadata: self metadata; + body: self contents; + file: self file, 'html' +] + { #category : #accessing } HedgeDoc >> asMarkdownTiddler [ self url ifNil: [ ^ self ]. diff --git a/src/MiniDocs/Markdeep.class.st b/src/MiniDocs/Markdeep.class.st index 1fd80a4..211cc9b 100644 --- a/src/MiniDocs/Markdeep.class.st +++ b/src/MiniDocs/Markdeep.class.st @@ -140,14 +140,6 @@ Markdeep >> contents [ ^ output contents. ] -{ #category : #persistence } -Markdeep >> exportAsFile [ - | newFile | - self markdownFile ifNil: [ self inform: 'Define an input Markdown file or use #exportAsFileOn: instead.' ]. - newFile := (self markdownFile fullName, '.html') asFileReference. - ^ self notifyExportAsFileOn: newFile. -] - { #category : #utilities } Markdeep >> fontAwesomeHeader [ "I enable the font awesome support in the document header" @@ -260,13 +252,6 @@ Markdeep >> navTop: aString [ navTop:= aString. ] -{ #category : #persistence } -Markdeep >> notifyExportAsFileOn: aFileReference [ - self exportAsFileOn: aFileReference. - self inform: 'Exported as: ', String cr, aFileReference fullName. - ^ aFileReference -] - { #category : #accessing } Markdeep >> options [ ^ options ifNil: [ diff --git a/src/MiniDocs/Markdown.class.st b/src/MiniDocs/Markdown.class.st index 48a439c..b122dea 100644 --- a/src/MiniDocs/Markdown.class.st +++ b/src/MiniDocs/Markdown.class.st @@ -74,6 +74,14 @@ Markdown >> detectYAMLMetadata [ ifFound: [ ^ true ] ifNone: [ ^ false ] ] ] +{ #category : #persistence } +Markdown >> exportAsFile [ + | newFile | + self file ifNil: [ self inform: 'Define an input Markdown file or use #exportAsFileOn: instead.' ]. + newFile := (self file fullName ) asFileReference. + ^ self notifyExportAsFileOn: newFile. +] + { #category : #persistence } Markdown >> exportAsFileOn: aFileReference [ aFileReference ensureDelete. @@ -161,6 +169,13 @@ Markdown >> metadata: rawMeta [ metadata := rawMeta ] +{ #category : #persistence } +Markdown >> notifyExportAsFileOn: aFileReference [ + self exportAsFileOn: aFileReference. + self inform: 'Exported as: ', String cr, aFileReference fullName. + ^ aFileReference +] + { #category : #accessing } Markdown >> populateMetadata [ | rawMeta |