Improved support for Markdeep.
This commit is contained in:
parent
0c0be2668d
commit
9f9bcb08a0
@ -41,6 +41,22 @@ 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 exportAsFileOn: newFile.
|
||||
]
|
||||
|
||||
{ #category : #persistence }
|
||||
Markdeep >> exportAsFileOn: aFileReference [
|
||||
aFileReference exists ifFalse: [ aFileReference ensureCreateFile ].
|
||||
aFileReference writeStreamDo: [ :stream |
|
||||
stream nextPutAll: self contents ].
|
||||
self inform: 'Exported as: ', String cr, aFileReference fullName
|
||||
]
|
||||
|
||||
{ #category : #utilities }
|
||||
Markdeep >> fontAwesomeHeader [
|
||||
"I enable the font awesome support in the document header"
|
||||
@ -53,7 +69,7 @@ Markdeep >> fontAwesomeHeader [
|
||||
Markdeep >> fromMarkdownFile: aFileReference [
|
||||
"I create a Markdeep document from a given Markdown file."
|
||||
self processMarkdownFor: aFileReference.
|
||||
^ self contents.
|
||||
^ self.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
@ -90,8 +106,10 @@ Markdeep >> markdownFile: aFileReference [
|
||||
{ #category : #'instance creation' }
|
||||
Markdeep >> processMarkdownFor: aFileReference [
|
||||
"comment stating purpose of message"
|
||||
| markdownContent |
|
||||
self markdownFile: aFileReference.
|
||||
self body: (self markdownFile contents).
|
||||
markdownContent := Markdown fromFile: aFileReference.
|
||||
self body: (markdownContent commentYAMLMetadata contents).
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
@ -18,6 +18,22 @@ Markdown class >> fromFile: aFileReference [
|
||||
^ self new fromFile: aFileReference
|
||||
]
|
||||
|
||||
{ #category : #operation }
|
||||
Markdown >> commentYAMLMetadata [
|
||||
| newContents |
|
||||
self detectYAMLMetadata ifFalse: [ ^ self ].
|
||||
newContents := '' writeStream.
|
||||
newContents nextPutAll: '<!--@yaml:'; crlf.
|
||||
self extractYAMLMetadata do: [ :line |
|
||||
newContents nextPutAll: line ].
|
||||
newContents nextPutAll: String cr.
|
||||
newContents nextPutAll: '-->'; crlf.
|
||||
(self lines copyFrom: self locateYAMLMetadataClosing + 2 to: self lines size) do: [ :line |
|
||||
newContents nextPutAll: line; crlf ].
|
||||
self contents: newContents contents.
|
||||
^ self contents
|
||||
]
|
||||
|
||||
{ #category : #utility }
|
||||
Markdown >> containsYAMLMetadataClosing [
|
||||
^ self locateYAMLMetadataClosing > 0
|
||||
|
@ -26,11 +26,11 @@ Class {
|
||||
}
|
||||
|
||||
{ #category : #utilities }
|
||||
PandocWork >> buildManifestFileForLanguage: anISOCode [
|
||||
PandocWork >> buildManifestFileForLanguage: anISOCode on: aFileName [
|
||||
"anISOCode is the ISO 639-1 two letters language code"
|
||||
|
||||
| manifestFile |
|
||||
manifestFile := (self rootFolder / anISOCode / 'manifest.ston') asFileReference ensureCreateFile.
|
||||
manifestFile := (self rootFolder / anISOCode / 'manifests' / aFileName ) asFileReference ensureCreateFile.
|
||||
self buildManifestForLanguage: 'es'.
|
||||
GrafoscopioUtils exportAsSton: (self manifests at: anISOCode) on: manifestFile.
|
||||
^ manifestFile
|
||||
|
Loading…
Reference in New Issue
Block a user