Minor fix on markdown exportation.
This commit is contained in:
parent
4abb92820c
commit
ae32426cba
@ -397,13 +397,10 @@ GrafoscopioNode >> exportPreambleTo: aStream [
|
||||
(self header = '%config')
|
||||
ifTrue: [
|
||||
configDict := STON fromString: (self body).
|
||||
|
||||
aStream nextPutAll: 'title: ', (configDict at: 'title'); lf.
|
||||
aStream nextPutAll: 'author: ', ((configDict at: 'author') at: 'given'), ' ', ((configDict at: 'author') at: 'family'); lf.
|
||||
aStream nextPutAll: 'bibliography: ', (configDict at: 'bibliography'); lf.
|
||||
aStream nextPutAll: 'abstract: ', '|'; lf; nextPutAll: (configDict at: 'abstract'); lf.
|
||||
].
|
||||
aStream nextPutAll: '---'; lf.
|
||||
aStream nextPutAll: 'abstract: ', '|'; lf; nextPutAll: (configDict at: 'abstract'); lf]
|
||||
]
|
||||
|
||||
{ #category : #exporting }
|
||||
|
@ -95,6 +95,13 @@ GrafoscopioNotebook >> demoteNode [
|
||||
self notebookContent: notebook.
|
||||
]
|
||||
|
||||
{ #category : #persistence }
|
||||
GrafoscopioNotebook >> exportAllSubtreesAsMarkdow [
|
||||
|
||||
| toBeExported |
|
||||
toBeExported := (self notebook preorderTraversal) "collect: [ :each | each links last ] "
|
||||
]
|
||||
|
||||
{ #category : #persistence }
|
||||
GrafoscopioNotebook >> exportAsHTML [
|
||||
"I export the current tree/document to a HTML file, using pandoc external app.
|
||||
@ -123,15 +130,10 @@ GrafoscopioNotebook >> exportAsLaTeX [
|
||||
|
||||
{ #category : #persistence }
|
||||
GrafoscopioNotebook >> exportAsMarkdown [
|
||||
"I export the current tree/document to a markdown file"
|
||||
workingFile
|
||||
"I export the current working tree/document to a markdown file."
|
||||
workingFile
|
||||
ifNil: [ self inform: 'File NOT exported. Please save the notebook on hard drive first' ]
|
||||
ifNotNil: [
|
||||
self markdownFile exists ifTrue: [ self markdownFile delete ].
|
||||
self markdownFile
|
||||
ensureCreateFile;
|
||||
writeStreamDo: [:stream | stream nextPutAll: self notebook asMarkdown].
|
||||
self inform: ('File exported as: ', String cr, self markdownFile fullName)]
|
||||
ifNotNil: [ self exportNode: (self notebook) asMarkdownIn: (self markdownFile) ]
|
||||
]
|
||||
|
||||
{ #category : #persistence }
|
||||
@ -259,14 +261,22 @@ GrafoscopioNotebook >> moveNodeBefore [
|
||||
|
||||
{ #category : #utilities }
|
||||
GrafoscopioNotebook >> navigateRelativePathFor: aFileString [
|
||||
"Given a relative path according to location of the notebook's workingFile, I navigate to that file"
|
||||
"Given a relative path according to location of the notebook's workingFile, I navigate to that file if exist and create it, including
|
||||
subdirectories if it does not exist.
|
||||
If the relative path is located in a subdirectory that shares the route with the notebooks working file, it must start with the folders name,
|
||||
without using './' to point the same shared root "
|
||||
|
||||
| finalLocation |
|
||||
| finalLocation pathSegments |
|
||||
finalLocation := workingFile parent.
|
||||
(aFileString splitOn: '/') do: [ :segment |
|
||||
pathSegments := aFileString splitOn: '/'.
|
||||
pathSegments allButLastDo: [ :segment |
|
||||
(segment = '..')
|
||||
ifTrue: [ finalLocation := finalLocation parent ]
|
||||
ifFalse: [finalLocation := finalLocation / segment]].
|
||||
ifFalse: [
|
||||
finalLocation := finalLocation / segment.
|
||||
finalLocation exists ifFalse: [ finalLocation ensureCreateDirectory ]]].
|
||||
finalLocation := finalLocation / (pathSegments last).
|
||||
finalLocation exists ifFalse: [ finalLocation ensureCreateFile ].
|
||||
^ finalLocation
|
||||
]
|
||||
|
||||
@ -521,6 +531,7 @@ GrafoscopioNotebook >> saveToFile: aFileReference [
|
||||
[ self exportAsSton: self notebook on: (self workingFile writeStream)]
|
||||
ensure: [ (self workingFile writeStream) ifNotNil: #close ].
|
||||
self title: self workingFile basenameWithIndicator, ' | Grafoscopio notebook'.
|
||||
self exportAllSubtreesAsMarkdow.
|
||||
self inform: ('File saved at: ', String cr, self workingFile fullName).
|
||||
GrafoscopioDockingBar updateRecentNotebooksWith: aFileReference.
|
||||
|
||||
|
@ -9,7 +9,7 @@ Class {
|
||||
|
||||
{ #category : #'code-critics' }
|
||||
ManifestGrafoscopio class >> ruleRBAssignmentInIfTrueRuleV1FalsePositive [
|
||||
^ #(#(#(#RGMethodDefinition #(#GrafoscopioNode #embedNodes #false)) #'2017-02-16T20:07:02.600781-05:00') )
|
||||
^ #(#(#(#RGMethodDefinition #(#GrafoscopioNode #embedNodes #false)) #'2017-02-16T20:07:02.600781-05:00') #(#(#RGMethodDefinition #(#GrafoscopioNotebook #navigateRelativePathFor: #false)) #'2017-03-28T22:30:53.541042-05:00') )
|
||||
]
|
||||
|
||||
{ #category : #'code-critics' }
|
||||
|
Loading…
Reference in New Issue
Block a user