More refactoring

This commit is contained in:
Santiago Bragagnolo 2020-03-22 12:04:07 +00:00 committed by Offray Luna
parent 4f251b08c5
commit 6a92669efd
2 changed files with 17 additions and 14 deletions

View File

@ -362,20 +362,22 @@ GrafoscopioNewNotebook >> exportLinkContent [
{ #category : #persistence } { #category : #persistence }
GrafoscopioNewNotebook >> exportNode: aGrafoscopioNode asMarkdownIn: aFile [ GrafoscopioNewNotebook >> exportNode: aGrafoscopioNode asMarkdownIn: aFile [
"I export the current tree/document to a markdown file" "I export the current tree/document to a markdown file"
aFile ensureDelete. aFile ensureDelete.
aFile aFile
ensureCreateFile; ensureCreateFile;
writeStreamDo: [:stream | writeStreamDo: [ :stream |
stream stream
nextPutAll: nextPutAll:
('---', String cr, ('---' , String cr , 'exportedFrom: ' , self checksumForRootSubtree
'exportedFrom: ', self checksumForRootSubtree, String cr) withInternetLineEndings. , String cr) withInternetLineEndings.
aGrafoscopioNode metadataAsYamlIn: stream. aGrafoscopioNode metadataAsYamlIn: stream.
stream stream
nextPutAll: nextPutAll:
('---', String cr, String cr) withInternetLineEndings, ('---' , String cr , String cr) withInternetLineEndings
aGrafoscopioNode asMarkdown ]. , aGrafoscopioNode asMarkdown.
self inform: 'Exported as: ', String cr, aFile fullName stream flush ].
self inform: 'Exported as: ' , String cr , aFile fullName
] ]
{ #category : #persistence } { #category : #persistence }
@ -513,8 +515,8 @@ GrafoscopioNewNotebook >> initializePresenter [
item := tree selectedItem. item := tree selectedItem.
tree selectedItem header: arg. tree selectedItem header: arg.
tree selectedItem updateEditionTimestamp. tree selectedItem updateEditionTimestamp.
tree roots: tree roots. " tree roots: tree roots."
tree selectItem: item ] ]. " tree selectItem: item "] ].
links links
whenTextChangedDo: [ :arg | whenTextChangedDo: [ :arg |
(tree respondsTo: #link:) (tree respondsTo: #link:)
@ -1036,6 +1038,7 @@ GrafoscopioNewNotebook >> selectedItem: aGrafoscopioTextNode path: aPath [
{ #category : #'asdas yet unclassified' } { #category : #'asdas yet unclassified' }
GrafoscopioNewNotebook >> selectedPathNextTo: aPath [ GrafoscopioNewNotebook >> selectedPathNextTo: aPath [
aPath isEmpty ifTrue: [ ^ self ].
aPath aPath
at: aPath size at: aPath size
put: (aPath at: aPath size) + 1. put: (aPath at: aPath size) + 1.

View File

@ -649,7 +649,7 @@ GrafoscopioTextNode >> markdownContent [
GrafoscopioTextNode >> metadata [ GrafoscopioTextNode >> metadata [
| mnode | | mnode |
mnode := self root preorderTraversal mnode := self root preorderTraversal
detect: [ :n | n headerStartsWith: '%metadata' ] detect: [ :n | n header beginsWith: '%metadata' ]
ifNone: [ ^ nil ]. ifNone: [ ^ nil ].
^ mnode output. ^ mnode output.