Improvement for errors when importing remote content.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-10-09 16:26:33 -05:00
parent c1c372ced8
commit 2a238ae2c2

View File

@ -1,7 +1,7 @@
Extension { #name : #LeDatabase } Extension { #name : #LeDatabase }
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
LeDatabase >> addPageFromMarkdeep: markdeepDocTree [ LeDatabase >> addPageFromMarkdeep: markdeepDocTree withRemote: externalDocLocation [
| remoteMetadata divSnippets snippets page | | remoteMetadata divSnippets snippets page |
divSnippets := (markdeepDocTree xpath: '//div[@st-class]') divSnippets := (markdeepDocTree xpath: '//div[@st-class]')
@ -23,7 +23,7 @@ LeDatabase >> addPageFromMarkdeep: markdeepDocTree [
createEmail: (LeEmail new email:(remoteMetadata at: 'creator')); createEmail: (LeEmail new email:(remoteMetadata at: 'creator'));
editEmail: (LeEmail new email:(remoteMetadata at: 'modifier')). editEmail: (LeEmail new email:(remoteMetadata at: 'modifier')).
snippets do: [ :snippet | page addSnippet: snippet ]. snippets do: [ :snippet | page addSnippet: snippet ].
page children collect: [ :snippet | page children do: [ :snippet |
(self hasBlockUID: (snippet uid)) (self hasBlockUID: (snippet uid))
ifTrue: [ | existingPage | ifTrue: [ | existingPage |
existingPage := self pages detect: [ :pageTemp | pageTemp includesSnippetUid: snippet uid ]. existingPage := self pages detect: [ :pageTemp | pageTemp includesSnippetUid: snippet uid ].
@ -38,12 +38,13 @@ LeDatabase >> addPageFromMarkdeep: markdeepDocTree [
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
LeDatabase >> addPageFromMarkdeepUrl: aString [ LeDatabase >> addPageFromMarkdeepUrl: aString [
| page | | page |
page := self detectLocalPageForRemote: aString. page := self detectLocalPageForRemote: aString.
page ifNotNil: [ :arg | (self importErrorMessage: page). page
ifNotNil: [ :arg |
self importErrorMessage: page.
^ self ]. ^ self ].
^ self addPageFromMarkdeep: (self docTreeForLink: aString) ^ self addPageFromMarkdeep: (self docTreeForLink: aString) withRemote: aString
] ]
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }