Loading links from web as playgrounds. Now using the node links field, instead of the node header.
This commit is contained in:
parent
d21629cb31
commit
5a7078e2f2
@ -493,7 +493,7 @@ GrafoscopioNode >> level: anInteger [
|
|||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
GrafoscopioNode >> links [
|
GrafoscopioNode >> links [
|
||||||
"I model local or remote links that are associated to a particular node."
|
"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 }
|
{ #category : #accessing }
|
||||||
@ -528,7 +528,8 @@ GrafoscopioNode >> markdownContent [
|
|||||||
If special nodes types are present, converts them into proper markup to be embedded inside markdown"
|
If special nodes types are present, converts them into proper markup to be embedded inside markdown"
|
||||||
| markdown embedNodes temporalBody invisibleChildren |
|
| markdown embedNodes temporalBody invisibleChildren |
|
||||||
markdown := '' writeStream.
|
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: [
|
ifTrue: [
|
||||||
self level timesRepeat: [ markdown nextPutAll: '#' ].
|
self level timesRepeat: [ markdown nextPutAll: '#' ].
|
||||||
markdown nextPutAll: ' '.
|
markdown nextPutAll: ' '.
|
||||||
|
@ -176,11 +176,12 @@ GrafoscopioNotebook >> initializePresenter [
|
|||||||
(tree highlightedItem content header) = arg
|
(tree highlightedItem content header) = arg
|
||||||
ifFalse: [
|
ifFalse: [
|
||||||
(tree highlightedItem) content header: arg.
|
(tree highlightedItem) content header: arg.
|
||||||
tree roots: tree roots.
|
tree roots: tree roots]].
|
||||||
self updateForSpecialHeader]].
|
|
||||||
links whenTextChanged: [ :arg |
|
links whenTextChanged: [ :arg |
|
||||||
(tree highlightedItem content links) = arg
|
((tree highlightedItem content links) includes: arg)
|
||||||
ifFalse: [ (tree highlightedItem) content links: arg]]
|
ifFalse: [
|
||||||
|
(tree highlightedItem) content links add: arg.
|
||||||
|
self updateForSpecialLinks]]
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
@ -325,7 +326,13 @@ GrafoscopioNotebook >> newWindowMainMenu [
|
|||||||
name: nil;
|
name: nil;
|
||||||
description: 'Visit link';
|
description: 'Visit link';
|
||||||
icon: Smalltalk ui icons glamorousRight;
|
icon: Smalltalk ui icons glamorousRight;
|
||||||
action: [ self visitNodeLink ] ].
|
action: [ self visitNodeLink ] ].
|
||||||
|
group addItem: [ :item |
|
||||||
|
item
|
||||||
|
name: nil;
|
||||||
|
description: 'Load link';
|
||||||
|
icon: Smalltalk ui icons glamorousRefresh;
|
||||||
|
action: [ self updateForSpecialLinks ] ].
|
||||||
group addItem: [ :item |
|
group addItem: [ :item |
|
||||||
item
|
item
|
||||||
name: nil;
|
name: nil;
|
||||||
@ -663,17 +670,17 @@ GrafoscopioNotebook >> updateBodyFor: aNodeContainer [
|
|||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #operation }
|
{ #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
|
"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"
|
workspace, and convert the node body to an interactive playground"
|
||||||
| currentNode nodeContent |
|
| currentNode nodeContent |
|
||||||
currentNode := tree highlightedItem.
|
currentNode := tree highlightedItem.
|
||||||
currentNode ifNil: [ ^ self ].
|
currentNode ifNil: [ ^ self ].
|
||||||
nodeContent := currentNode content.
|
nodeContent := currentNode content.
|
||||||
nodeContent header isAsciiString ifFalse: [ ^ self ].
|
nodeContent links last isAsciiString ifFalse: [ ^ self ].
|
||||||
nodeContent header asUrl host = 'ws.stfx.eu' ifFalse: [ ^ self ].
|
nodeContent links last asUrl host = 'ws.stfx.eu' ifFalse: [ ^ self ].
|
||||||
nodeContent
|
nodeContent
|
||||||
body: (ZnClient new get: nodeContent header);
|
body: (ZnClient new get: nodeContent links last);
|
||||||
tagAs: 'código'.
|
tagAs: 'código'.
|
||||||
self updateBodyFor: currentNode
|
self updateBodyFor: currentNode
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user