Refactoring class and methods hierarchies.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-03-12 11:40:07 -05:00
parent a7931f6a96
commit 690ae86e2f
2 changed files with 12 additions and 15 deletions

View File

@ -3,15 +3,13 @@ I model a Mardeep file as described in https://casual-effects.com/markdeep/
"
Class {
#name : #Markdeep,
#superclass : #Object,
#superclass : #Markdown,
#instVars : [
'title',
'body',
'comments',
'tail',
'language',
'config',
'metadata',
'head',
'navTop',
'options'
@ -146,18 +144,10 @@ Markdeep >> contents [
Markdeep >> exportAsFile [
| newFile |
self markdownFile ifNil: [ self inform: 'Define an input Markdown file or use #exportAsFileOn: instead.' ].
newFile := (self markdownFile file fullName, '.html') asFileReference.
newFile := (self markdownFile fullName, '.html') asFileReference.
^ self notifyExportAsFileOn: newFile.
]
{ #category : #persistence }
Markdeep >> exportAsFileOn: aFileReference [
aFileReference ensureDelete.
aFileReference exists ifFalse: [ aFileReference ensureCreateFile ].
aFileReference writeStreamDo: [ :stream |
stream nextPutAll: self contents ].
]
{ #category : #utilities }
Markdeep >> fontAwesomeHeader [
"I enable the font awesome support in the document header"
@ -231,7 +221,7 @@ Markdeep >> markdeepScriptTag [
{ #category : #accessing }
Markdeep >> markdownFile [
^ Markdown new fromFile: (self config at: 'markdownFile')
^ self file ifNil: [ self file: FileLocator temp / ('untitled--', NanoID generate, '.md')].
]
{ #category : #accessing }

View File

@ -6,9 +6,8 @@ particularly the ones provided by Pandoc and/or Lunamark.
"
Class {
#name : #Markdown,
#superclass : #Object,
#superclass : #MarkupFile,
#instVars : [
'file',
'metadata',
'body'
],
@ -75,6 +74,14 @@ Markdown >> detectYAMLMetadata [
ifFound: [ ^ true ] ifNone: [ ^ false ] ]
]
{ #category : #persistence }
Markdown >> exportAsFileOn: aFileReference [
aFileReference ensureDelete.
aFileReference exists ifFalse: [ aFileReference ensureCreateFile ].
aFileReference writeStreamDo: [ :stream |
stream nextPutAll: self contents ].
]
{ #category : #operation }
Markdown >> exportMetadataAsJson [
"TBD: Lua scripts should be checked and installed when missing. Maybe a shared location