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
parent 5a8505e394
commit 6fecaa9b51

View File

@ -86,7 +86,9 @@ GrafoscopioNode >> asMarkdown [
| markdownOutput | | markdownOutput |
markdownOutput := '' writeStream. 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 ^markdownOutput contents
@ -257,11 +259,11 @@ GrafoscopioNode >> markdownContent [
ifTrue: [ ifTrue: [
self level timesRepeat: [ markdown nextPutAll: '#' ]. self level timesRepeat: [ markdown nextPutAll: '#' ].
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']. embedNodes := self children select: [:each | ((each header findTokens: $ ) at: 1) = '%embed'].
temporalBody := self body. temporalBody := self body.
embedNodes ifNotNil: [ embedNodes do: [ :each | temporalBody := temporalBody copyReplaceAll: (each header) with: each 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') (self header = '%config')
ifTrue: [ ifTrue: [
@ -288,7 +290,7 @@ GrafoscopioNode >> markdownContent [
((self header findString: '%invisible') = 1) | (self header = '%invisible') ((self header findString: '%invisible') = 1) | (self header = '%invisible')
ifTrue: [ ifTrue: [
invisibleChildren := self children. invisibleChildren := self children.
invisibleChildren ifNotNil: [invisibleChildren do: [ ] ] ]. invisibleChildren ifNotNil: [ ] ].
^markdown contents ^markdown contents
] ]