Refactoring, so functionality can be called without the GUI.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-04-08 12:46:42 -05:00
parent 9ae7a6ec62
commit 8fb6373a83
2 changed files with 18 additions and 5 deletions

View File

@ -184,6 +184,16 @@ LeDatabase >> gtViewErrorDetailsOn: aView withKey: erroKey [
].
]
{ #category : #'*MiniDocs' }
LeDatabase >> importDocumentFrom: aURL [
| doc |
"Using file extension in URL as a cheap (non-robuts) way of detecting the kind of document.
Better file type detection should be implemented in the future."
(aURL endsWith: '.md.html') ifTrue: [ ^ self addPageFromMarkdeepUrl: aURL ].
doc := HedgeDoc fromLink: aURL asString.
^ self addPage: doc asLePage
]
{ #category : #'*MiniDocs' }
LeDatabase >> importErrorForLocal: page withRemote: externalDocLocation [

View File

@ -42,22 +42,25 @@ LeMiniDocsImport >> createURLeditable [
text: 'Document link';
switchToEditor.
editable when: BrEditorAcceptWish do: [ :aWish |
self importHedgedoc: aWish text asString.
self importDocumentFrom: aWish text asString.
].
base addChild: editable.
^ base
]
{ #category : #accessing }
LeMiniDocsImport >> database [
^ database
]
{ #category : #accessing }
LeMiniDocsImport >> database: aLeDatabase [
database := aLeDatabase
]
{ #category : #accessing }
LeMiniDocsImport >> importHedgedoc: aURL [
| doc |
doc := HedgeDoc fromLink: aURL asString.
^ database addPage: doc asLePage
LeMiniDocsImport >> importDocumentFrom: aURL [
^ self database importDocumentFrom: aURL.
]
{ #category : #accessing }