Exportation of subtrees, a feature that was described since the first versions of the Spanish manual, is finally available! Now it needs to be documented in the English Manual, that will be the base for future Spanish versions (full cycle :-)).

This commit is contained in:
Offray Vladimir Luna Cárdenas 2017-03-28 20:53:14 +00:00
parent 85e5bf1e1d
commit 4abb92820c
2 changed files with 40 additions and 18 deletions

View File

@ -390,22 +390,6 @@ GrafoscopioNode >> exportDecoratedCodeBlockTo: aStream [
^aStream contents
]
{ #category : #exporting }
GrafoscopioNode >> exportPreambleOldTo: aStream [
"comment stating purpose of message"
| configDict |
(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.
]
{ #category : #exporting }
GrafoscopioNode >> exportPreambleTo: aStream [
"comment stating purpose of message"

View File

@ -160,6 +160,16 @@ GrafoscopioNotebook >> exportAsSton: aNotebook on: aFileStream [
aFileStream nextPutAll: stonPrettyString
]
{ #category : #persistence }
GrafoscopioNotebook >> exportNode: aGrafoscopioNode asMarkdownIn: aFile [
"I export the current tree/document to a markdown file"
aFile exists ifTrue: [ aFile delete ].
aFile
ensureCreateFile;
writeStreamDo: [:stream | stream nextPutAll: aGrafoscopioNode asMarkdown].
self inform: ('Exported as: ', String cr, aFile fullName)
]
{ #category : #api }
GrafoscopioNotebook >> extent [
^900@500
@ -247,6 +257,19 @@ GrafoscopioNotebook >> moveNodeBefore [
self notebookContent: notebook
]
{ #category : #utilities }
GrafoscopioNotebook >> navigateRelativePathFor: aFileString [
"Given a relative path according to location of the notebook's workingFile, I navigate to that file"
| finalLocation |
finalLocation := workingFile parent.
(aFileString splitOn: '/') do: [ :segment |
(segment = '..')
ifTrue: [ finalLocation := finalLocation parent ]
ifFalse: [finalLocation := finalLocation / segment]].
^ finalLocation
]
{ #category : #accessing }
GrafoscopioNotebook >> notebook [
^ notebook
@ -528,6 +551,15 @@ GrafoscopioNotebook >> saveWorkingNotebook [
]
{ #category : #persistence }
GrafoscopioNotebook >> subTreeAsMarkdown [
| currentNode exportedFile |
currentNode := tree highlightedItem content.
currentNode links last ifNil: [ ^self ].
exportedFile:= self navigateRelativePathFor: currentNode links last.
self exportNode: currentNode asMarkdownIn: exportedFile
]
{ #category : #'editing nodes' }
GrafoscopioNotebook >> toggleCodeNode [
| currentNode |
@ -630,9 +662,15 @@ GrafoscopioNotebook >> topBar [
group addItem: [ :item |
item
name: nil;
description: 'Load link';
description: 'Reload link';
icon: Smalltalk ui icons glamorousRefresh;
action: [ self updateForSpecialLinks ] ].
action: [ self updateForSpecialLinks ] ].
group addItem: [ :item |
item
name: nil;
description: 'Export subtree';
icon: Smalltalk ui icons glamorousMore;
action: [ self subTreeAsMarkdown ] ].
group addItem: [ :item |
item
name: nil;