Minor fix on markdown exportation.
This commit is contained in:
parent
4abb92820c
commit
ae32426cba
@ -397,13 +397,10 @@ GrafoscopioNode >> exportPreambleTo: aStream [
|
|||||||
(self header = '%config')
|
(self header = '%config')
|
||||||
ifTrue: [
|
ifTrue: [
|
||||||
configDict := STON fromString: (self body).
|
configDict := STON fromString: (self body).
|
||||||
|
|
||||||
aStream nextPutAll: 'title: ', (configDict at: 'title'); lf.
|
aStream nextPutAll: 'title: ', (configDict at: 'title'); lf.
|
||||||
aStream nextPutAll: 'author: ', ((configDict at: 'author') at: 'given'), ' ', ((configDict at: 'author') at: 'family'); lf.
|
aStream nextPutAll: 'author: ', ((configDict at: 'author') at: 'given'), ' ', ((configDict at: 'author') at: 'family'); lf.
|
||||||
aStream nextPutAll: 'bibliography: ', (configDict at: 'bibliography'); lf.
|
aStream nextPutAll: 'bibliography: ', (configDict at: 'bibliography'); lf.
|
||||||
aStream nextPutAll: 'abstract: ', '|'; lf; nextPutAll: (configDict at: 'abstract'); lf.
|
aStream nextPutAll: 'abstract: ', '|'; lf; nextPutAll: (configDict at: 'abstract'); lf]
|
||||||
].
|
|
||||||
aStream nextPutAll: '---'; lf.
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #exporting }
|
{ #category : #exporting }
|
||||||
|
@ -95,6 +95,13 @@ GrafoscopioNotebook >> demoteNode [
|
|||||||
self notebookContent: notebook.
|
self notebookContent: notebook.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #persistence }
|
||||||
|
GrafoscopioNotebook >> exportAllSubtreesAsMarkdow [
|
||||||
|
|
||||||
|
| toBeExported |
|
||||||
|
toBeExported := (self notebook preorderTraversal) "collect: [ :each | each links last ] "
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #persistence }
|
{ #category : #persistence }
|
||||||
GrafoscopioNotebook >> exportAsHTML [
|
GrafoscopioNotebook >> exportAsHTML [
|
||||||
"I export the current tree/document to a HTML file, using pandoc external app.
|
"I export the current tree/document to a HTML file, using pandoc external app.
|
||||||
@ -123,15 +130,10 @@ GrafoscopioNotebook >> exportAsLaTeX [
|
|||||||
|
|
||||||
{ #category : #persistence }
|
{ #category : #persistence }
|
||||||
GrafoscopioNotebook >> exportAsMarkdown [
|
GrafoscopioNotebook >> exportAsMarkdown [
|
||||||
"I export the current tree/document to a markdown file"
|
"I export the current working tree/document to a markdown file."
|
||||||
workingFile
|
workingFile
|
||||||
ifNil: [ self inform: 'File NOT exported. Please save the notebook on hard drive first' ]
|
ifNil: [ self inform: 'File NOT exported. Please save the notebook on hard drive first' ]
|
||||||
ifNotNil: [
|
ifNotNil: [ self exportNode: (self notebook) asMarkdownIn: (self markdownFile) ]
|
||||||
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)]
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #persistence }
|
{ #category : #persistence }
|
||||||
@ -259,14 +261,22 @@ GrafoscopioNotebook >> moveNodeBefore [
|
|||||||
|
|
||||||
{ #category : #utilities }
|
{ #category : #utilities }
|
||||||
GrafoscopioNotebook >> navigateRelativePathFor: aFileString [
|
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.
|
finalLocation := workingFile parent.
|
||||||
(aFileString splitOn: '/') do: [ :segment |
|
pathSegments := aFileString splitOn: '/'.
|
||||||
|
pathSegments allButLastDo: [ :segment |
|
||||||
(segment = '..')
|
(segment = '..')
|
||||||
ifTrue: [ finalLocation := finalLocation parent ]
|
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
|
^ finalLocation
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -521,6 +531,7 @@ GrafoscopioNotebook >> saveToFile: aFileReference [
|
|||||||
[ self exportAsSton: self notebook on: (self workingFile writeStream)]
|
[ self exportAsSton: self notebook on: (self workingFile writeStream)]
|
||||||
ensure: [ (self workingFile writeStream) ifNotNil: #close ].
|
ensure: [ (self workingFile writeStream) ifNotNil: #close ].
|
||||||
self title: self workingFile basenameWithIndicator, ' | Grafoscopio notebook'.
|
self title: self workingFile basenameWithIndicator, ' | Grafoscopio notebook'.
|
||||||
|
self exportAllSubtreesAsMarkdow.
|
||||||
self inform: ('File saved at: ', String cr, self workingFile fullName).
|
self inform: ('File saved at: ', String cr, self workingFile fullName).
|
||||||
GrafoscopioDockingBar updateRecentNotebooksWith: aFileReference.
|
GrafoscopioDockingBar updateRecentNotebooksWith: aFileReference.
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Class {
|
|||||||
|
|
||||||
{ #category : #'code-critics' }
|
{ #category : #'code-critics' }
|
||||||
ManifestGrafoscopio class >> ruleRBAssignmentInIfTrueRuleV1FalsePositive [
|
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' }
|
{ #category : #'code-critics' }
|
||||||
|
Loading…
Reference in New Issue
Block a user