Extending special cases for generic urls plus the urls for playgrounds.
This commit is contained in:
parent
bf7c15d5cd
commit
f2d6d9d515
@ -229,7 +229,7 @@ GrafoscopioNode >> becomeDefaultTestTree [
|
|||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
GrafoscopioNode >> becomeDefaultTree [
|
GrafoscopioNode >> becomeDefaultTree [
|
||||||
"I create a starting tree for all grafoscopio notebooks with just one textual node"
|
"I create a starting tree for all Grafoscopio notebooks with just one textual node as child."
|
||||||
| node1 |
|
| node1 |
|
||||||
self level: 0.
|
self level: 0.
|
||||||
self header: 'Arbol principal'.
|
self header: 'Arbol principal'.
|
||||||
@ -311,6 +311,13 @@ GrafoscopioNode >> copyToClipboard [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #operation }
|
||||||
|
GrafoscopioNode >> cryptoSignature [
|
||||||
|
"I return the SHA1SUM of the current tree. I'm used to test changes on the contents
|
||||||
|
and for traceability of how the document tree is converted to other formats, as markdown."
|
||||||
|
^ (SHA1 new hashMessage: self root flatten asSton) hex
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #utility }
|
{ #category : #utility }
|
||||||
GrafoscopioNode >> deleteReferencesToRoot: aRootNode [
|
GrafoscopioNode >> deleteReferencesToRoot: aRootNode [
|
||||||
|
|
||||||
@ -518,6 +525,24 @@ GrafoscopioNode >> icon: aSymbol [
|
|||||||
icon := aSymbol
|
icon := aSymbol
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #importing }
|
||||||
|
GrafoscopioNode >> importLinkContent [
|
||||||
|
"I take the last link and import its contents in node body. "
|
||||||
|
self links last asUrl host = 'ws.stfx.eu' ifTrue: [ ^ self ].
|
||||||
|
self
|
||||||
|
body: (ZnClient new get: self links last).
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #importing }
|
||||||
|
GrafoscopioNode >> importPlaygroundLink [
|
||||||
|
"I take the last link and import its contents in node body.
|
||||||
|
Last links should be hosted in http://zn.stfx.eu/"
|
||||||
|
self links last asUrl host = 'ws.stfx.eu' ifFalse: [ ^ self ].
|
||||||
|
self
|
||||||
|
body: (ZnClient new get: self links last);
|
||||||
|
tagAs: 'código'.
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
GrafoscopioNode >> initialize [
|
GrafoscopioNode >> initialize [
|
||||||
"I create a empty new node"
|
"I create a empty new node"
|
||||||
@ -687,18 +712,22 @@ GrafoscopioNode >> metadata [
|
|||||||
{ #category : #exporting }
|
{ #category : #exporting }
|
||||||
GrafoscopioNode >> metadataAsYamlIn: markdownStream [
|
GrafoscopioNode >> metadataAsYamlIn: markdownStream [
|
||||||
"I convert the first '%metadata' node into a YAML preamble to be used by Pandoc exportation."
|
"I convert the first '%metadata' node into a YAML preamble to be used by Pandoc exportation."
|
||||||
self metadata ifNil: [ ^ self ].
|
|
||||||
markdownStream
|
markdownStream
|
||||||
nextPutAll: '---';
|
nextPutAll: '---';
|
||||||
|
lf;
|
||||||
|
nextPutAll: 'exportedFrom: ', self cryptoSignature;
|
||||||
lf.
|
lf.
|
||||||
self metadata
|
self metadata
|
||||||
keysAndValuesDo: [ :k :v |
|
ifNotNil: [
|
||||||
markdownStream
|
self metadata
|
||||||
nextPutAll: (k , ': ' , v asString) withInternetLineEndings;
|
keysAndValuesDo: [ :k :v |
|
||||||
nextPutAll: String cr ].
|
markdownStream
|
||||||
|
nextPutAll: (k , ': ' , v asString) withInternetLineEndings;
|
||||||
|
nextPutAll: String cr ]].
|
||||||
markdownStream
|
markdownStream
|
||||||
nextPutAll: '---';
|
nextPutAll: '---';
|
||||||
lf; lf
|
lf;
|
||||||
|
lf
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #movement }
|
{ #category : #movement }
|
||||||
|
@ -47,7 +47,7 @@ GrafoscopioNotebook class >> defaultSpec [
|
|||||||
bc add: #body; add: #links height: self toolbarHeight ]]]
|
bc add: #body; add: #links height: self toolbarHeight ]]]
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'as yet unclassified' }
|
{ #category : #'instance creation' }
|
||||||
GrafoscopioNotebook class >> newDefault [
|
GrafoscopioNotebook class >> newDefault [
|
||||||
^ self new.
|
^ self new.
|
||||||
]
|
]
|
||||||
@ -95,6 +95,16 @@ GrafoscopioNotebook >> copyNodeToClipboard [
|
|||||||
self notebookContent: notebook.
|
self notebookContent: notebook.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #utilities }
|
||||||
|
GrafoscopioNotebook >> cryptoSignature [
|
||||||
|
"I return the cryptographic signature of the workingFile where this notebook is being stored.
|
||||||
|
I'm useful for data provenance and traceability of derivated files related with this source
|
||||||
|
notebook."
|
||||||
|
self workingFile ifNil: [ ^ self ].
|
||||||
|
self workingFile contents = '' ifTrue: [ ^ self ].
|
||||||
|
^ (SHA1 new hashMessage: (self workingFile contents)) hex.
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'editing nodes' }
|
{ #category : #'editing nodes' }
|
||||||
GrafoscopioNotebook >> cutNodeToClipboard [
|
GrafoscopioNotebook >> cutNodeToClipboard [
|
||||||
self copyNodeToClipboard; removeNode.
|
self copyNodeToClipboard; removeNode.
|
||||||
@ -122,7 +132,7 @@ GrafoscopioNotebook >> debugWithSelector: aSymbol [
|
|||||||
^ (nodeContent perform: aSymbol asSymbol) inspect
|
^ (nodeContent perform: aSymbol asSymbol) inspect
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'as yet unclassified' }
|
{ #category : #utilities }
|
||||||
GrafoscopioNotebook >> defineDebugMessageUI [
|
GrafoscopioNotebook >> defineDebugMessageUI [
|
||||||
| answer |
|
| answer |
|
||||||
answer := UIManager default
|
answer := UIManager default
|
||||||
@ -234,6 +244,16 @@ GrafoscopioNotebook >> header: anObject [
|
|||||||
header := anObject
|
header := anObject
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #initialization }
|
||||||
|
GrafoscopioNotebook >> initialize [
|
||||||
|
super initialize.
|
||||||
|
self
|
||||||
|
notebook: (GrafoscopioNode new becomeDefaultTree);
|
||||||
|
title: ' New | Grafoscopio notebook'.
|
||||||
|
self notebookContent: self notebook.
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
GrafoscopioNotebook >> initializePresenter [
|
GrafoscopioNotebook >> initializePresenter [
|
||||||
tree whenHighlightedItemChanged: [ :item |
|
tree whenHighlightedItemChanged: [ :item |
|
||||||
@ -415,14 +435,8 @@ GrafoscopioNotebook >> okToChange [
|
|||||||
{ #category : #persistence }
|
{ #category : #persistence }
|
||||||
GrafoscopioNotebook >> openDefault [
|
GrafoscopioNotebook >> openDefault [
|
||||||
"I open a new default notebook"
|
"I open a new default notebook"
|
||||||
|
|
||||||
| nb |
|
^ self class new openWithSpec.
|
||||||
nb := self class new.
|
|
||||||
nb
|
|
||||||
notebook: (GrafoscopioNode new becomeDefaultTree);
|
|
||||||
title: ' New | Grafoscopio notebook';
|
|
||||||
notebookContent: nb notebook.
|
|
||||||
^ nb openWithSpec.
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #persistence }
|
{ #category : #persistence }
|
||||||
@ -774,11 +788,8 @@ GrafoscopioNotebook >> updateForSpecialLinks [
|
|||||||
currentNode := tree highlightedItem.
|
currentNode := tree highlightedItem.
|
||||||
currentNode ifNil: [ ^ self ].
|
currentNode ifNil: [ ^ self ].
|
||||||
nodeContent := currentNode content.
|
nodeContent := currentNode content.
|
||||||
nodeContent links last isAsciiString ifFalse: [ ^ self ].
|
nodeContent importPlaygroundLink.
|
||||||
nodeContent links last asUrl host = 'ws.stfx.eu' ifFalse: [ ^ self ].
|
nodeContent importLinkContent.
|
||||||
nodeContent
|
|
||||||
body: (ZnClient new get: nodeContent links last);
|
|
||||||
tagAs: 'código'.
|
|
||||||
self updateBodyFor: currentNode
|
self updateBodyFor: currentNode
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user