Improving exportation and preparing config.ston file usage.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-01-02 09:53:14 -05:00
parent 9fc938407a
commit 8222d8c7d2
4 changed files with 18 additions and 6 deletions

View File

@ -113,7 +113,9 @@ Markdeep >> commentsSupport [
{ #category : #accessing } { #category : #accessing }
Markdeep >> config [ Markdeep >> config [
| configFile |
configFile := self folder / 'config.ston'.
configFile exists ifTrue: [ ^ config := STON fromString: configFile contents ].
^ config ifNil: [ config := Dictionary new] ^ config ifNil: [ config := Dictionary new]
] ]
@ -156,6 +158,11 @@ Markdeep >> converPubPubFootnoteBetween: footnote and: nextFootnote in: footnote
^ response contents ^ response contents
] ]
{ #category : #accessing }
Markdeep >> folder [
^ self file parent
]
{ #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"
@ -167,6 +174,7 @@ Markdeep >> fontAwesomeHeader [
Markdeep >> fromMarkdownFile: aFileReference [ Markdeep >> fromMarkdownFile: aFileReference [
"I create a Markdeep document from a given Markdown file." "I create a Markdeep document from a given Markdown file."
self processMarkdownFor: aFileReference. self processMarkdownFor: aFileReference.
self file: aFileReference, 'html'.
^ self. ^ self.
] ]
@ -248,7 +256,7 @@ Markdeep >> markdownFile [
{ #category : #accessing } { #category : #accessing }
Markdeep >> markdownFile: aFileReference [ Markdeep >> markdownFile: aFileReference [
"Where the Mardown file associated with me is stored. Used for sync. and import/export purposes." "Where the Mardown file associated with me is stored. Used for sync. and import/export purposes."
self config at: 'markdownFile' put: aFileReference self file: aFileReference, 'html'
] ]
{ #category : #'instance creation' } { #category : #'instance creation' }

View File

@ -29,7 +29,6 @@ Markdown class >> yamlMetadataDelimiter [
Markdown >> asMarkdeep [ Markdown >> asMarkdeep [
^ Markdeep new ^ Markdeep new
body: self body; body: self body;
markdownFile: self file;
commentYAMLMetadata commentYAMLMetadata
] ]
@ -155,7 +154,7 @@ Markdown >> exportMetadataAsYaml [
{ #category : #accessing } { #category : #accessing }
Markdown >> file [ Markdown >> file [
^ file ifNil: [ file := FileLocator temp / (NanoID generate asLowercase, '.md') ] ^ file ifNil: [ file := FileLocator temp / 'temporalMarkdeep.md.html' ]
] ]
{ #category : #accessing } { #category : #accessing }

View File

@ -11,13 +11,13 @@ Class {
} }
{ #category : #persistence } { #category : #persistence }
MarkupFile class >> exportAsFileOn: aFileReferenceOrFileName containing: text [ MarkupFile class >> exportAsFileOn: aFileReferenceOrFileName containing: object [
| file | | file |
file := aFileReferenceOrFileName asFileReference. file := aFileReferenceOrFileName asFileReference.
file ensureDelete. file ensureDelete.
file exists ifFalse: [ file ensureCreateFile ]. file exists ifFalse: [ file ensureCreateFile ].
file writeStreamDo: [ :stream | file writeStreamDo: [ :stream |
stream nextPutAll: text withUnixLineEndings]. stream nextPutAll: (STON toStringPretty: object) withUnixLineEndings].
self inform: 'Exported as: ', String cr, file fullName. self inform: 'Exported as: ', String cr, file fullName.
^ file ^ file
] ]

View File

@ -49,6 +49,11 @@ NanoID class >> install [
^ MiniDocs appFolder ] ^ MiniDocs appFolder ]
] ]
{ #category : #accessing }
NanoID class >> isInstalled [
^ self binaryFile exists
]
{ #category : #accessing } { #category : #accessing }
NanoID class >> scriptSourceCode [ NanoID class >> scriptSourceCode [
^ FileLocator image parent / 'pharo-local/iceberg/Offray/MiniDocs/src/nanoIdGen.nim' ^ FileLocator image parent / 'pharo-local/iceberg/Offray/MiniDocs/src/nanoIdGen.nim'