CodiMD sync. started.
This commit is contained in:
parent
7bc7ee8216
commit
8e8c96f414
@ -320,6 +320,14 @@ GrafoscopioNode >> copyToClipboard [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #operation }
|
||||||
|
GrafoscopioNode >> currentLink [
|
||||||
|
"TODO: This method should not only select sanitized links, but also provide ways to detect wich link
|
||||||
|
is selected from the list. For the moment, is only the last one, but probably links needs to be heavily
|
||||||
|
refactored to support this kind of operations and a better UI."
|
||||||
|
^ self sanitizeDefaultLink
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #utility }
|
{ #category : #utility }
|
||||||
GrafoscopioNode >> deleteReferencesToRoot: aRootNode [
|
GrafoscopioNode >> deleteReferencesToRoot: aRootNode [
|
||||||
|
|
||||||
@ -560,8 +568,11 @@ GrafoscopioNode >> icon: aSymbol [
|
|||||||
GrafoscopioNode >> importHtmlLink [
|
GrafoscopioNode >> importHtmlLink [
|
||||||
"I take the last link and import its contents in node body. "
|
"I take the last link and import its contents in node body. "
|
||||||
| selectedLink downloadedContent |
|
| selectedLink downloadedContent |
|
||||||
self links last asUrl host = 'ws.stfx.eu' ifTrue: [ ^ self ].
|
selectedLink := self currentLink.
|
||||||
selectedLink := self links last.
|
selectedLink asUrl host = 'ws.stfx.eu' ifTrue: [ ^ self ].
|
||||||
|
selectedLink asUrl host = 'docutopia.tupale.co'
|
||||||
|
ifTrue: [ self inform: 'Docutopia importing still not supported.'.
|
||||||
|
^ self ].
|
||||||
downloadedContent := (GrafoscopioUtils
|
downloadedContent := (GrafoscopioUtils
|
||||||
downloadingFrom: selectedLink
|
downloadingFrom: selectedLink
|
||||||
withMessage: 'Downloading node contents...'
|
withMessage: 'Downloading node contents...'
|
||||||
@ -573,9 +584,9 @@ GrafoscopioNode >> importHtmlLink [
|
|||||||
GrafoscopioNode >> importPlaygroundLink [
|
GrafoscopioNode >> importPlaygroundLink [
|
||||||
"I take the last link and import its contents in node body.
|
"I take the last link and import its contents in node body.
|
||||||
Last links should be hosted in http://zn.stfx.eu/"
|
Last links should be hosted in http://zn.stfx.eu/"
|
||||||
self links last asUrl host = 'ws.stfx.eu' ifFalse: [ ^ self ].
|
self currentLink asUrl host = 'ws.stfx.eu' ifFalse: [ ^ self ].
|
||||||
self
|
self
|
||||||
body: (ZnClient new get: self links last);
|
body: (ZnClient new get: self currentLink);
|
||||||
tagAs: 'código'.
|
tagAs: 'código'.
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -961,6 +972,17 @@ GrafoscopioNode >> root [
|
|||||||
^ self
|
^ self
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #operation }
|
||||||
|
GrafoscopioNode >> sanitizeDefaultLink [
|
||||||
|
| defaultLink sanitized protocol |
|
||||||
|
defaultLink := self links last.
|
||||||
|
protocol := 'docutopia://'.
|
||||||
|
(defaultLink beginsWith: protocol )
|
||||||
|
ifTrue: [ sanitized := defaultLink copyReplaceAll: protocol with: 'https://docutopia.tupale.co/' ].
|
||||||
|
^ sanitized
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
GrafoscopioNode >> saveContent: anObject [
|
GrafoscopioNode >> saveContent: anObject [
|
||||||
"Sets the receivers body to the given object"
|
"Sets the receivers body to the given object"
|
||||||
|
@ -125,3 +125,13 @@ GrafoscopioNodeTest >> testRemovingChildren [
|
|||||||
self assert: tree children size equals: orig - 1.
|
self assert: tree children size equals: orig - 1.
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #tests }
|
||||||
|
GrafoscopioNodeTest >> testSanitizedLink [
|
||||||
|
| node link |
|
||||||
|
|
||||||
|
link := 'docutopia://hackbo:hackbot'.
|
||||||
|
node := GrafoscopioNode new links: link.
|
||||||
|
self assert: (node sanitizeDefaultLink = 'https://docutopia.tupale.co/hackbo:hackbot') equals: true
|
||||||
|
|
||||||
|
]
|
||||||
|
@ -191,7 +191,7 @@ GrafoscopioNotebook >> exportAllSubtreesAsMarkdow [
|
|||||||
| toBeExported |
|
| toBeExported |
|
||||||
toBeExported := self notebook selectMarkdownSubtreesToExport.
|
toBeExported := self notebook selectMarkdownSubtreesToExport.
|
||||||
toBeExported ifEmpty: [ ^ self ].
|
toBeExported ifEmpty: [ ^ self ].
|
||||||
toBeExported do: [ :each | self subtreeAsMarkdownFor: each ].
|
toBeExported do: [ :each | self subtreeAsMarkdownFileFor: each ].
|
||||||
self inform: toBeExported size asString , ' exported markdown subtrees.'
|
self inform: toBeExported size asString , ' exported markdown subtrees.'
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -269,6 +269,11 @@ GrafoscopioNotebook >> exportAsSton: aNotebook on: aFileStream [
|
|||||||
nextPut: aNotebook children
|
nextPut: aNotebook children
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #utility }
|
||||||
|
GrafoscopioNotebook >> exportLinkContent [
|
||||||
|
Transcript show: (self currentNodeContent asMarkdown)
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #persistence }
|
{ #category : #persistence }
|
||||||
GrafoscopioNotebook >> exportNode: aGrafoscopioNode asMarkdownIn: aFile [
|
GrafoscopioNotebook >> exportNode: aGrafoscopioNode asMarkdownIn: aFile [
|
||||||
"I export the current tree/document to a markdown file"
|
"I export the current tree/document to a markdown file"
|
||||||
@ -349,7 +354,7 @@ GrafoscopioNotebook >> importImages [
|
|||||||
|
|
||||||
{ #category : #operation }
|
{ #category : #operation }
|
||||||
GrafoscopioNotebook >> importLinkContent [
|
GrafoscopioNotebook >> importLinkContent [
|
||||||
"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 link 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.
|
||||||
@ -835,15 +840,15 @@ GrafoscopioNotebook >> saveWorkingNotebook [
|
|||||||
GrafoscopioNotebook >> subtreeAsMarkdown [
|
GrafoscopioNotebook >> subtreeAsMarkdown [
|
||||||
| currentNode |
|
| currentNode |
|
||||||
currentNode := tree highlightedItem content.
|
currentNode := tree highlightedItem content.
|
||||||
self inform: ('Exported as: ', String cr, (self subtreeAsMarkdownFor: currentNode) fullName )
|
self inform: ('Exported as: ', String cr, (self subtreeAsMarkdownFileFor: currentNode) fullName )
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #persistence }
|
{ #category : #persistence }
|
||||||
GrafoscopioNotebook >> subtreeAsMarkdownFor: aNode [
|
GrafoscopioNotebook >> subtreeAsMarkdownFileFor: aNode [
|
||||||
| exportedFile |
|
| exportedFile |
|
||||||
aNode links ifEmpty: [ ^ self ].
|
aNode links ifEmpty: [ ^ self ].
|
||||||
exportedFile:= self navigateRelativePathFor: aNode links last.
|
exportedFile:= self navigateRelativePathFor: aNode links last.
|
||||||
exportedFile class = GrafoscopioNotebook ifTrue: [ ^ self ].
|
exportedFile class = self class ifTrue: [ ^ self ].
|
||||||
self exportNode: aNode asMarkdownIn: exportedFile.
|
self exportNode: aNode asMarkdownIn: exportedFile.
|
||||||
^ exportedFile
|
^ exportedFile
|
||||||
]
|
]
|
||||||
@ -884,7 +889,7 @@ GrafoscopioNotebook >> topBar [
|
|||||||
addItem: [ :item |
|
addItem: [ :item |
|
||||||
item
|
item
|
||||||
name: nil;
|
name: nil;
|
||||||
description: 'Export all markdown subtrees';
|
description: 'Export all Markdown subtrees';
|
||||||
icon: (self iconNamed: #glamorousMore);
|
icon: (self iconNamed: #glamorousMore);
|
||||||
action: [ self exportAllSubtreesAsMarkdow ] ].
|
action: [ self exportAllSubtreesAsMarkdow ] ].
|
||||||
group
|
group
|
||||||
@ -985,8 +990,15 @@ GrafoscopioNotebook >> topBar [
|
|||||||
item
|
item
|
||||||
name: nil;
|
name: nil;
|
||||||
description: 'Import link content';
|
description: 'Import link content';
|
||||||
icon: (self iconNamed: #glamorousRefresh);
|
icon: (self iconNamed: #glamorousOpenFromUrl);
|
||||||
action: [ self importLinkContent ] ].
|
action: [ self importLinkContent ] ].
|
||||||
|
group
|
||||||
|
addItem: [ :item |
|
||||||
|
item
|
||||||
|
name: nil;
|
||||||
|
description: 'Export link content';
|
||||||
|
icon: (self iconNamed: #glamorousSaveToUrl);
|
||||||
|
action: [ self exportLinkContent ] ].
|
||||||
group
|
group
|
||||||
addItem: [ :item |
|
addItem: [ :item |
|
||||||
item
|
item
|
||||||
|
Loading…
Reference in New Issue
Block a user