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

View File

@ -6,9 +6,8 @@ particularly the ones provided by Pandoc and/or Lunamark.
" "
Class { Class {
#name : #Markdown, #name : #Markdown,
#superclass : #Object, #superclass : #MarkupFile,
#instVars : [ #instVars : [
'file',
'metadata', 'metadata',
'body' 'body'
], ],
@ -75,6 +74,14 @@ Markdown >> detectYAMLMetadata [
ifFound: [ ^ true ] ifNone: [ ^ false ] ] 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 } { #category : #operation }
Markdown >> exportMetadataAsJson [ Markdown >> exportMetadataAsJson [
"TBD: Lua scripts should be checked and installed when missing. Maybe a shared location "TBD: Lua scripts should be checked and installed when missing. Maybe a shared location