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
parent 6fecaa9b51
commit 684fa43915

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 } { #category : #exporting }
GrafoscopioNode >> asMarkdown [ GrafoscopioNode >> asMarkdown [
"Exports children of the curren node as pandoc markdown, using special nodes for config options and bibliography." "Exports children of the curren node as pandoc markdown, using special nodes for config options and bibliography."
| markdownOutput | | markdownOutput |
markdownOutput := '' writeStream. markdownOutput := '' writeStream.
"(self preorderTraversal) do: [ :eachNode | markdownOutput nextPutAll: (eachNode markdownContent) ]."
(self preorderTraversal) do: [ :eachNode | (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 ^markdownOutput contents