Alternative for invisible nodes. Not elegant, but works on firs level children (no on deeper ones). Need to work on 'ancestors' method.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2014-11-06 23:08:33 +00:00 committed by SantiagoBragagnolo
parent 8cd21fdcda
commit b2d0775bb3
1 changed files with 6 additions and 4 deletions

View File

@ -86,7 +86,9 @@ GrafoscopioNode >> asMarkdown [
| markdownOutput |
markdownOutput := '' writeStream.
(self preorderTraversal) do: [ :eachNode | markdownOutput nextPutAll: (eachNode markdownContent) ].
"(self preorderTraversal) do: [ :eachNode | markdownOutput nextPutAll: (eachNode markdownContent) ]."
(self preorderTraversal) do: [ :eachNode |
(eachNode level > 0) ifTrue: [(eachNode parent header = '%invisible') not ifTrue: [markdownOutput nextPutAll: (eachNode markdownContent)]]].
^markdownOutput contents
@ -257,11 +259,11 @@ GrafoscopioNode >> markdownContent [
ifTrue: [
self level timesRepeat: [ markdown nextPutAll: '#' ].
markdown nextPutAll: ' '.
markdown nextPutAll: (self header copyReplaceTokens: #cr with: #lf); lf; lf.
markdown nextPutAll: (self header copyReplaceTokens: #cr with: #lf); crlf; crlf.
embedNodes := self children select: [:each | ((each header findTokens: $ ) at: 1) = '%embed'].
temporalBody := self body.
embedNodes ifNotNil: [ embedNodes do: [ :each | temporalBody := temporalBody copyReplaceAll: (each header) with: each body]].
markdown nextPutAll: (temporalBody contents withUnixLineEndings); lf; lf].
markdown nextPutAll: (temporalBody contents withInternetLineEndings ); crlf; crlf].
(self header = '%config')
ifTrue: [
@ -288,7 +290,7 @@ GrafoscopioNode >> markdownContent [
((self header findString: '%invisible') = 1) | (self header = '%invisible')
ifTrue: [
invisibleChildren := self children.
invisibleChildren ifNotNil: [invisibleChildren do: [ ] ] ].
invisibleChildren ifNotNil: [ ] ].
^markdown contents
]