diff --git a/repository/Grafoscopio/GrafoscopioBrowser.class.st b/repository/Grafoscopio/GrafoscopioBrowser.class.st index d67bd64..6898711 100644 --- a/repository/Grafoscopio/GrafoscopioBrowser.class.st +++ b/repository/Grafoscopio/GrafoscopioBrowser.class.st @@ -609,7 +609,7 @@ GrafoscopioBrowser >> panelBrowserForTransmediaton [ Opens grafoscopio in several 'modes'. Each mode corresponds to a operation way, with an specific interface. We will start with a 'transmediaton' mode to let the people create some transmedia content. After that we will enable other modes" - | transmediaNode | + | transmediaNode originalNode | browser := GLMTabulator new. browser @@ -624,9 +624,11 @@ GrafoscopioBrowser >> panelBrowserForTransmediaton [ format:[:eachNode | (eachNode tags) = 'original' ifFalse: [ '' ] - ifTrue: [ - transmediaNode := eachNode children detect: [:node | node tags = 'transmediado']. - eachNode body]]]. + ifTrue: [ + originalNode := eachNode. + originalNode children isNotNil + ifTrue: [transmediaNode := originalNode children detect: [:node | node tags = 'transmediado'] ifNone: [ transmediaNode := nil ] ]. + originalNode body]]]. (browser transmit) from: #original; toOutsidePort: #text. diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index ce85255..6812e55 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -82,6 +82,23 @@ GrafoscopioNode >> addNodeAfter [ ] +{ #category : #accessing } +GrafoscopioNode >> ancestors [ + "Returns a collection of all the nodes wich are ancestors of the receiver node" + | currentNode ancestors | + + currentNode := self. + ancestors := OrderedCollection new. + (self level - 1) + timesRepeat: [ + ancestors add: currentNode parent. + currentNode := currentNode parent.]. + ancestors := ancestors reversed. + ^ ancestors + + +] + { #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 @@ -108,7 +125,7 @@ GrafoscopioNode >> asMarkdown [ markdownOutput := '' writeStream. (self preorderTraversal) do: [ :eachNode | (eachNode level > 0) & (eachNode header notNil) ifTrue: [ - (eachNode hasAncestorWith: '%invisible') not + (eachNode hasAncestorHeaderWith: '%invisible') not ifTrue: [ markdownOutput nextPutAll: (eachNode markdownContent) ]]]. ^markdownOutput contents @@ -184,12 +201,21 @@ GrafoscopioNode >> demote [ ] { #category : #exporting } -GrafoscopioNode >> hasAncestorWith: aSpecialWord [ +GrafoscopioNode >> hasAncestorHeaderWith: aSpecialWord [ "Looks if the receptor node has an ancestor with a header with 'aSpecialWord' as the only or the first word" ^ (self ancestorsHeaders includes: aSpecialWord) | ((self ancestorsHeaders collect: [:eachHeader | (eachHeader findTokens: $ ) at: 1 ]) includes: aSpecialWord) +] + +{ #category : #exporting } +GrafoscopioNode >> hasAncestorTaggedAs: aSpecialWord [ + "Looks if the receptor node has an ancestor with a header with 'aSpecialWord' as the only or the first word" + + ^ self ancestors detect: [:eachAncestor | eachAncestor tags = aSpecialWord ] + + ] { #category : #accessing }