From 684fa43915bbd072a00c6e793378efd7eaa73e70 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Fri, 7 Nov 2014 11:13:52 +0000 Subject: [PATCH] Deep %invisible nodes, that is, the ones that have '%invisible' as one of its ancestors are ignored now. --- .../Grafoscopio/GrafoscopioNode.class.st | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index 7f1d8a9..493db87 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -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