Importing errors track conflicting local and remote content now.
This commit is contained in:
parent
2a238ae2c2
commit
fd3b4d7925
@ -2,35 +2,34 @@ Extension { #name : #LeDatabase }
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LeDatabase >> addPageFromMarkdeep: markdeepDocTree withRemote: externalDocLocation [
|
||||
|
||||
| remoteMetadata divSnippets snippets page |
|
||||
divSnippets := (markdeepDocTree xpath: '//div[@st-class]')
|
||||
asOrderedCollection collect: [ :xmlElement | xmlElement postCopy ].
|
||||
snippets := divSnippets collect: [ :xmlElement |
|
||||
divSnippets := (markdeepDocTree xpath: '//div[@st-class]') asOrderedCollection
|
||||
collect: [ :xmlElement | xmlElement postCopy ].
|
||||
snippets := divSnippets
|
||||
collect: [ :xmlElement |
|
||||
(xmlElement attributes at: 'st-class') = 'LeTextSnippet'
|
||||
ifTrue: [ LeTextSnippet new contentFrom: xmlElement ]
|
||||
ifFalse: [ (xmlElement attributes at: 'st-class') = 'LePharoSnippet'
|
||||
ifTrue: [ LePharoSnippet new contentFrom: xmlElement ]
|
||||
]
|
||||
].
|
||||
ifTrue: [ LePharoSnippet new contentFrom: xmlElement ] ] ].
|
||||
remoteMetadata := Markdeep new metadataFromXML: markdeepDocTree.
|
||||
page := LePage new
|
||||
title: (remoteMetadata at: 'title');
|
||||
basicUid: (UUID fromString36: (remoteMetadata at: 'id'));
|
||||
createTime: (LeTime new time: ((remoteMetadata at: 'created') asDateAndTime));
|
||||
editTime: (LeTime new time: ((remoteMetadata at: 'modified') asDateAndTime));
|
||||
latestEditTime: (LeTime new time: ((remoteMetadata at: 'modified') asDateAndTime));
|
||||
createTime: (LeTime new time: (remoteMetadata at: 'created') asDateAndTime);
|
||||
editTime: (LeTime new time: (remoteMetadata at: 'modified') asDateAndTime);
|
||||
latestEditTime: (LeTime new time: (remoteMetadata at: 'modified') asDateAndTime);
|
||||
createEmail: (LeEmail new email: (remoteMetadata at: 'creator'));
|
||||
editEmail: (LeEmail new email: (remoteMetadata at: 'modifier')).
|
||||
snippets do: [ :snippet | page addSnippet: snippet ].
|
||||
page children do: [ :snippet |
|
||||
(self hasBlockUID: (snippet uid))
|
||||
page children
|
||||
do: [ :snippet |
|
||||
(self hasBlockUID: snippet uid)
|
||||
ifTrue: [ | existingPage |
|
||||
existingPage := self pages detect: [ :pageTemp | pageTemp includesSnippetUid: snippet uid ].
|
||||
self importErrorMessage: existingPage.
|
||||
existingPage := self pages
|
||||
detect: [ :pageTemp | pageTemp includesSnippetUid: snippet uid ].
|
||||
self importErrorForLocal: existingPage withRemote: externalDocLocation.
|
||||
^ self ]
|
||||
ifFalse: [
|
||||
snippet database: self.
|
||||
ifFalse: [ snippet database: self.
|
||||
self registerSnippet: snippet ] ].
|
||||
self addPage: page.
|
||||
^ page
|
||||
@ -42,7 +41,7 @@ LeDatabase >> addPageFromMarkdeepUrl: aString [
|
||||
page := self detectLocalPageForRemote: aString.
|
||||
page
|
||||
ifNotNil: [ :arg |
|
||||
self importErrorMessage: page.
|
||||
self importErrorForLocal: page withRemote: aString.
|
||||
^ self ].
|
||||
^ self addPageFromMarkdeep: (self docTreeForLink: aString) withRemote: aString
|
||||
]
|
||||
@ -121,7 +120,7 @@ LeDatabase >> gtViewErrorDetailsOn: aView [
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LeDatabase >> importErrorMessage: page [
|
||||
LeDatabase >> importErrorForLocal: page withRemote: externalDocLocation [
|
||||
|
||||
| message id |
|
||||
id := page uidString.
|
||||
@ -137,7 +136,10 @@ LeDatabase >> importErrorMessage: page [
|
||||
nextPut: Character lf;
|
||||
nextPutAll: 'already exists in this database and includes overlapping contents';
|
||||
nextPut: Character lf;
|
||||
nextPutAll: 'with the page you are trying to import.';
|
||||
nextPutAll: 'with the page you are trying to import from:
|
||||
';
|
||||
nextPut: Character lf;
|
||||
nextPutAll: externalDocLocation;
|
||||
nextPut: Character lf;
|
||||
nextPut: Character lf;
|
||||
nextPutAll:
|
||||
|
Loading…
Reference in New Issue
Block a user