From ebeb8acfcb10aabf350bdc5c040d23780b633d49 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Fri, 14 Apr 2017 19:35:04 +0000 Subject: [PATCH] Grafoscopio now stores the output of calculations! Reification of notebooks was done on packages, so it was not needed until now (almost 2.5 years after first public commit!). Impressive what the Pharo live coding environment can do, and the stuff you can "just leave for later" :-). --- repository/Grafoscopio/GrafoscopioNode.class.st | 10 ++++++++++ repository/Grafoscopio/GrafoscopioNodeTest.class.st | 12 ++++++++++++ repository/Grafoscopio/GrafoscopioNotebook.class.st | 13 ++++++++----- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index e936aa3..84b4696 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -661,6 +661,16 @@ GrafoscopioNode >> newNode [ ] +{ #category : #accessing } +GrafoscopioNode >> output [ + ^ output +] + +{ #category : #accessing } +GrafoscopioNode >> output: anObject [ + output := anObject +] + { #category : #accessing } GrafoscopioNode >> parent [ "Returns the parent of the current node" diff --git a/repository/Grafoscopio/GrafoscopioNodeTest.class.st b/repository/Grafoscopio/GrafoscopioNodeTest.class.st index d77e3ac..5334cd4 100644 --- a/repository/Grafoscopio/GrafoscopioNodeTest.class.st +++ b/repository/Grafoscopio/GrafoscopioNodeTest.class.st @@ -33,6 +33,18 @@ GrafoscopioNodeTest >> testDemoteNode [ ] +{ #category : #tests } +GrafoscopioNodeTest >> testHasMarkdownSubtreesToExport [ + "Because becomeDefaultTestTree contains at least one non empty 'links' object that + points to a relative path in the file system, ending in '.md' or '.markdown' the + result of this test is true. + Please see look #becomeDefaultTestTree message to see the details that makes this test true." + | tree | + tree := GrafoscopioNode new becomeDefaultTestTree. + self assert: tree selectMarkdownSubtreesToExport isNotEmpty equals: true. + +] + { #category : #tests } GrafoscopioNodeTest >> testInitializeIsOk [ self shouldnt: [ GrafoscopioNode new ] raise: Error diff --git a/repository/Grafoscopio/GrafoscopioNotebook.class.st b/repository/Grafoscopio/GrafoscopioNotebook.class.st index 0718ceb..c7dfbf1 100644 --- a/repository/Grafoscopio/GrafoscopioNotebook.class.st +++ b/repository/Grafoscopio/GrafoscopioNotebook.class.st @@ -56,14 +56,17 @@ GrafoscopioNotebook >> addNode [ { #category : #operation } GrafoscopioNotebook >> autoSaveBodyOf: aNode [ + | playground | body body class = TextModel ifTrue: [ body body whenTextChanged: [ :arg | aNode body: arg ] ]. body body class = GlamourPresentationModel - ifTrue: [ | playground | - playground := body body glmPres. - playground - onChangeOfPort: #text - act: [ :x | aNode body: x entity value content ]] + ifFalse: [ ^ self ]. + playground := body body glmPres. + playground + onChangeOfPort: #text + act: [ :x | aNode body: x entity value content ]; + onChangeOfPort: #activePresentation + act: [ aNode output: (Compiler evaluate: aNode body) ] ] { #category : #accessing }