Deep %invisible nodes, that is, the ones that have '%invisible' as one of its ancestors are ignored now.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2014-11-07 11:13:52 +00:00 committed by SantiagoBragagnolo
parent b2d0775bb3
commit ee8fa648ef
1 changed files with 19 additions and 2 deletions

View File

@ -80,15 +80,32 @@ GrafoscopioNode >> addNodeAfter [
]
{ #category : #accessing }
GrafoscopioNode >> ancestorsHeaders [
"Returns the headers of all the ancestors of the node. Maybe this and 'headers' should be integrated, so both act on a collection of
children instead of having two separate methods"
| currentNode ancestors |
currentNode := self.
ancestors := OrderedCollection new.
(self level - 1)
timesRepeat: [
ancestors add: currentNode parent.
currentNode := currentNode parent.].
ancestors := ancestors reversed.
^ ancestors collect: [:ancestor | ancestor header ]
]
{ #category : #exporting }
GrafoscopioNode >> asMarkdown [
"Exports children of the curren node as pandoc markdown, using special nodes for config options and bibliography."
| markdownOutput |
markdownOutput := '' writeStream.
"(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)]]].
(eachNode level > 0) ifTrue: [(eachNode ancestorsHeaders includes: '%invisible') not ifTrue: [ markdownOutput nextPutAll: (eachNode markdownContent) ]]].
^markdownOutput contents