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 }
|
||||
GrafoscopioNode >> deleteReferencesToRoot: aRootNode [
|
||||
|
||||
@ -560,8 +568,11 @@ GrafoscopioNode >> icon: aSymbol [
|
||||
GrafoscopioNode >> importHtmlLink [
|
||||
"I take the last link and import its contents in node body. "
|
||||
| selectedLink downloadedContent |
|
||||
self links last asUrl host = 'ws.stfx.eu' ifTrue: [ ^ self ].
|
||||
selectedLink := self links last.
|
||||
selectedLink := self currentLink.
|
||||
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
|
||||
downloadingFrom: selectedLink
|
||||
withMessage: 'Downloading node contents...'
|
||||
@ -573,9 +584,9 @@ GrafoscopioNode >> importHtmlLink [
|
||||
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 currentLink asUrl host = 'ws.stfx.eu' ifFalse: [ ^ self ].
|
||||
self
|
||||
body: (ZnClient new get: self links last);
|
||||
body: (ZnClient new get: self currentLink);
|
||||
tagAs: 'código'.
|
||||
]
|
||||
|
||||
@ -961,6 +972,17 @@ GrafoscopioNode >> root [
|
||||
^ 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 }
|
||||
GrafoscopioNode >> saveContent: anObject [
|
||||
"Sets the receivers body to the given object"
|
||||
|
@ -125,3 +125,13 @@ GrafoscopioNodeTest >> testRemovingChildren [
|
||||
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 := self notebook selectMarkdownSubtreesToExport.
|
||||
toBeExported ifEmpty: [ ^ self ].
|
||||
toBeExported do: [ :each | self subtreeAsMarkdownFor: each ].
|
||||
toBeExported do: [ :each | self subtreeAsMarkdownFileFor: each ].
|
||||
self inform: toBeExported size asString , ' exported markdown subtrees.'
|
||||
]
|
||||
|
||||
@ -269,6 +269,11 @@ GrafoscopioNotebook >> exportAsSton: aNotebook on: aFileStream [
|
||||
nextPut: aNotebook children
|
||||
]
|
||||
|
||||
{ #category : #utility }
|
||||
GrafoscopioNotebook >> exportLinkContent [
|
||||
Transcript show: (self currentNodeContent asMarkdown)
|
||||
]
|
||||
|
||||
{ #category : #persistence }
|
||||
GrafoscopioNotebook >> exportNode: aGrafoscopioNode asMarkdownIn: aFile [
|
||||
"I export the current tree/document to a markdown file"
|
||||
@ -349,7 +354,7 @@ GrafoscopioNotebook >> importImages [
|
||||
|
||||
{ #category : #operation }
|
||||
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"
|
||||
| currentNode nodeContent |
|
||||
currentNode := tree highlightedItem.
|
||||
@ -835,15 +840,15 @@ GrafoscopioNotebook >> saveWorkingNotebook [
|
||||
GrafoscopioNotebook >> subtreeAsMarkdown [
|
||||
| currentNode |
|
||||
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 }
|
||||
GrafoscopioNotebook >> subtreeAsMarkdownFor: aNode [
|
||||
GrafoscopioNotebook >> subtreeAsMarkdownFileFor: aNode [
|
||||
| exportedFile |
|
||||
aNode links ifEmpty: [ ^ self ].
|
||||
exportedFile:= self navigateRelativePathFor: aNode links last.
|
||||
exportedFile class = GrafoscopioNotebook ifTrue: [ ^ self ].
|
||||
exportedFile class = self class ifTrue: [ ^ self ].
|
||||
self exportNode: aNode asMarkdownIn: exportedFile.
|
||||
^ exportedFile
|
||||
]
|
||||
@ -884,7 +889,7 @@ GrafoscopioNotebook >> topBar [
|
||||
addItem: [ :item |
|
||||
item
|
||||
name: nil;
|
||||
description: 'Export all markdown subtrees';
|
||||
description: 'Export all Markdown subtrees';
|
||||
icon: (self iconNamed: #glamorousMore);
|
||||
action: [ self exportAllSubtreesAsMarkdow ] ].
|
||||
group
|
||||
@ -985,8 +990,15 @@ GrafoscopioNotebook >> topBar [
|
||||
item
|
||||
name: nil;
|
||||
description: 'Import link content';
|
||||
icon: (self iconNamed: #glamorousRefresh);
|
||||
icon: (self iconNamed: #glamorousOpenFromUrl);
|
||||
action: [ self importLinkContent ] ].
|
||||
group
|
||||
addItem: [ :item |
|
||||
item
|
||||
name: nil;
|
||||
description: 'Export link content';
|
||||
icon: (self iconNamed: #glamorousSaveToUrl);
|
||||
action: [ self exportLinkContent ] ].
|
||||
group
|
||||
addItem: [ :item |
|
||||
item
|
||||
|
Loading…
Reference in New Issue
Block a user