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 }
Markdeep >> config [
| configFile |
configFile := self folder / 'config.ston'.
configFile exists ifTrue: [ ^ config := STON fromString: configFile contents ].
^ config ifNil: [ config := Dictionary new]
]
@ -156,6 +158,11 @@ Markdeep >> converPubPubFootnoteBetween: footnote and: nextFootnote in: footnote
^ response contents
]
{ #category : #accessing }
Markdeep >> folder [
^ self file parent
]
{ #category : #utilities }
Markdeep >> fontAwesomeHeader [
"I enable the font awesome support in the document header"
@ -167,6 +174,7 @@ Markdeep >> fontAwesomeHeader [
Markdeep >> fromMarkdownFile: aFileReference [
"I create a Markdeep document from a given Markdown file."
self processMarkdownFor: aFileReference.
self file: aFileReference, 'html'.
^ self.
]
@ -248,7 +256,7 @@ Markdeep >> markdownFile [
{ #category : #accessing }
Markdeep >> markdownFile: aFileReference [
"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' }

View File

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

View File

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

View File

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