Improving HedgeDoc page importation.
This commit is contained in:
parent
e7f2910a51
commit
aec4b58e23
@ -16,6 +16,11 @@ Class {
|
||||
#category : #'MiniDocs-Core'
|
||||
}
|
||||
|
||||
{ #category : #accessing }
|
||||
HedgeDoc class >> fromLink: aUrl [
|
||||
^ self new fromLink: aUrl
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
HedgeDoc class >> newDefault [
|
||||
^ self new
|
||||
|
@ -37,14 +37,13 @@ LeHomeDatabaseHeaderElement >> initializeButtons [
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LeHomeDatabaseHeaderElement >> initializeMiniDocsImportButton [
|
||||
"importMinidocsButtonElement := self newImportMiniDocsButton."
|
||||
self userData at: 'importMinidocsButtonElement' put: self newImportMiniDocsButton.
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LeHomeDatabaseHeaderElement >> newImportMiniDocsButton [
|
||||
^ LeMiniDocsImport new
|
||||
tooltip: 'Import MiniDocs from url';
|
||||
tooltip: 'Import document from link';
|
||||
contentExtent: 200 @ 30
|
||||
]
|
||||
|
||||
|
@ -39,7 +39,7 @@ LeMiniDocsImport >> createURLeditable [
|
||||
yourself.
|
||||
editable := BrEditableLabel new
|
||||
aptitude: BrGlamorousEditableLabelAptitude new glamorousRegularFontAndSize;
|
||||
text: 'Hedgedoc url';
|
||||
text: 'Document link';
|
||||
switchToEditor.
|
||||
editable when: BrEditorAcceptWish do: [ :aWish |
|
||||
self importHedgedoc: aWish text asString.
|
||||
@ -56,9 +56,9 @@ LeMiniDocsImport >> database: aLeDatabase [
|
||||
{ #category : #accessing }
|
||||
LeMiniDocsImport >> importHedgedoc: aURL [
|
||||
| doc text page |
|
||||
doc := HedgeDoc new url: aURL asString.
|
||||
doc := HedgeDoc fromLink: aURL asString.
|
||||
text := doc retrieveContents; contents.
|
||||
page := LePage named: (doc metadata at: 'title').
|
||||
page := LePage named: (doc title).
|
||||
page addSnippet: (LeTextSnippet string: text).
|
||||
^ database addPage: page
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user