Loading links from web as playgrounds. Now using the node links field, instead of the node header.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2017-02-05 20:04:31 +00:00
parent d21629cb31
commit 5a7078e2f2
2 changed files with 19 additions and 11 deletions

View File

@ -493,7 +493,7 @@ GrafoscopioNode >> level: anInteger [
{ #category : #accessing }
GrafoscopioNode >> links [
"I model local or remote links that are associated to a particular node."
^ links ifNil: [ ^ links := OrderedCollection new ]
^ links ifNil: [ ^ links = OrderedCollection new ]
]
{ #category : #accessing }
@ -528,7 +528,8 @@ GrafoscopioNode >> markdownContent [
If special nodes types are present, converts them into proper markup to be embedded inside markdown"
| markdown embedNodes temporalBody invisibleChildren |
markdown := '' writeStream.
(self class specialWords includes: self header) not & (self class specialWords includes: ((self header findTokens: $ ) at: 1)) not & (self tags = 'código') not
(self class specialWords includes: self header) not &
(self class specialWords includes: ((self header findTokens: $ ) at: 1)) not & (self tags = 'código') not
ifTrue: [
self level timesRepeat: [ markdown nextPutAll: '#' ].
markdown nextPutAll: ' '.

View File

@ -176,11 +176,12 @@ GrafoscopioNotebook >> initializePresenter [
(tree highlightedItem content header) = arg
ifFalse: [
(tree highlightedItem) content header: arg.
tree roots: tree roots.
self updateForSpecialHeader]].
tree roots: tree roots]].
links whenTextChanged: [ :arg |
(tree highlightedItem content links) = arg
ifFalse: [ (tree highlightedItem) content links: arg]]
((tree highlightedItem content links) includes: arg)
ifFalse: [
(tree highlightedItem) content links add: arg.
self updateForSpecialLinks]]
]
{ #category : #initialization }
@ -326,6 +327,12 @@ GrafoscopioNotebook >> newWindowMainMenu [
description: 'Visit link';
icon: Smalltalk ui icons glamorousRight;
action: [ self visitNodeLink ] ].
group addItem: [ :item |
item
name: nil;
description: 'Load link';
icon: Smalltalk ui icons glamorousRefresh;
action: [ self updateForSpecialLinks ] ].
group addItem: [ :item |
item
name: nil;
@ -663,17 +670,17 @@ GrafoscopioNotebook >> updateBodyFor: aNodeContainer [
]
{ #category : #operation }
GrafoscopioNotebook >> updateForSpecialHeader [
GrafoscopioNotebook >> updateForSpecialLinks [
"I see if a node header is an url located at 'http://ws.stfx.eu', wich means that is a shared
workspace, and convert the node body to an interactive playground"
| currentNode nodeContent |
currentNode := tree highlightedItem.
currentNode ifNil: [ ^ self ].
nodeContent := currentNode content.
nodeContent header isAsciiString ifFalse: [ ^ self ].
nodeContent header asUrl host = 'ws.stfx.eu' ifFalse: [ ^ self ].
nodeContent links last isAsciiString ifFalse: [ ^ self ].
nodeContent links last asUrl host = 'ws.stfx.eu' ifFalse: [ ^ self ].
nodeContent
body: (ZnClient new get: nodeContent header);
body: (ZnClient new get: nodeContent links last);
tagAs: 'código'.
self updateBodyFor: currentNode
]