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' }
|
{ #category : #'*MiniDocs' }
|
||||||
LeDatabase >> addPageFromMarkdeep: markdeepDocTree withRemote: externalDocLocation [
|
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]') asOrderedCollection
|
||||||
asOrderedCollection collect: [ :xmlElement | xmlElement postCopy ].
|
collect: [ :xmlElement | xmlElement postCopy ].
|
||||||
snippets := divSnippets collect: [ :xmlElement |
|
snippets := divSnippets
|
||||||
|
collect: [ :xmlElement |
|
||||||
(xmlElement attributes at: 'st-class') = 'LeTextSnippet'
|
(xmlElement attributes at: 'st-class') = 'LeTextSnippet'
|
||||||
ifTrue: [ LeTextSnippet new contentFrom: xmlElement ]
|
ifTrue: [ LeTextSnippet new contentFrom: xmlElement ]
|
||||||
ifFalse: [ (xmlElement attributes at: 'st-class') = 'LePharoSnippet'
|
ifFalse: [ (xmlElement attributes at: 'st-class') = 'LePharoSnippet'
|
||||||
ifTrue: [ LePharoSnippet new contentFrom: xmlElement ]
|
ifTrue: [ LePharoSnippet new contentFrom: xmlElement ] ] ].
|
||||||
]
|
|
||||||
].
|
|
||||||
remoteMetadata := Markdeep new metadataFromXML: markdeepDocTree.
|
remoteMetadata := Markdeep new metadataFromXML: markdeepDocTree.
|
||||||
page := LePage new
|
page := LePage new
|
||||||
title: (remoteMetadata at: 'title');
|
title: (remoteMetadata at: 'title');
|
||||||
basicUid: (UUID fromString36: (remoteMetadata at: 'id'));
|
basicUid: (UUID fromString36: (remoteMetadata at: 'id'));
|
||||||
createTime: (LeTime new time: ((remoteMetadata at: 'created') asDateAndTime));
|
createTime: (LeTime new time: (remoteMetadata at: 'created') asDateAndTime);
|
||||||
editTime: (LeTime new time: ((remoteMetadata at: 'modified') asDateAndTime));
|
editTime: (LeTime new time: (remoteMetadata at: 'modified') asDateAndTime);
|
||||||
latestEditTime: (LeTime new time: ((remoteMetadata at: 'modified') asDateAndTime));
|
latestEditTime: (LeTime new time: (remoteMetadata at: 'modified') asDateAndTime);
|
||||||
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 do: [ :snippet |
|
page children
|
||||||
(self hasBlockUID: (snippet uid))
|
do: [ :snippet |
|
||||||
|
(self hasBlockUID: snippet uid)
|
||||||
ifTrue: [ | existingPage |
|
ifTrue: [ | existingPage |
|
||||||
existingPage := self pages detect: [ :pageTemp | pageTemp includesSnippetUid: snippet uid ].
|
existingPage := self pages
|
||||||
self importErrorMessage: existingPage.
|
detect: [ :pageTemp | pageTemp includesSnippetUid: snippet uid ].
|
||||||
|
self importErrorForLocal: existingPage withRemote: externalDocLocation.
|
||||||
^ self ]
|
^ self ]
|
||||||
ifFalse: [
|
ifFalse: [ snippet database: self.
|
||||||
snippet database: self.
|
|
||||||
self registerSnippet: snippet ] ].
|
self registerSnippet: snippet ] ].
|
||||||
self addPage: page.
|
self addPage: page.
|
||||||
^ page
|
^ page
|
||||||
@ -42,7 +41,7 @@ LeDatabase >> addPageFromMarkdeepUrl: aString [
|
|||||||
page := self detectLocalPageForRemote: aString.
|
page := self detectLocalPageForRemote: aString.
|
||||||
page
|
page
|
||||||
ifNotNil: [ :arg |
|
ifNotNil: [ :arg |
|
||||||
self importErrorMessage: page.
|
self importErrorForLocal: page withRemote: aString.
|
||||||
^ self ].
|
^ self ].
|
||||||
^ self addPageFromMarkdeep: (self docTreeForLink: aString) withRemote: aString
|
^ self addPageFromMarkdeep: (self docTreeForLink: aString) withRemote: aString
|
||||||
]
|
]
|
||||||
@ -121,7 +120,7 @@ LeDatabase >> gtViewErrorDetailsOn: aView [
|
|||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'*MiniDocs' }
|
{ #category : #'*MiniDocs' }
|
||||||
LeDatabase >> importErrorMessage: page [
|
LeDatabase >> importErrorForLocal: page withRemote: externalDocLocation [
|
||||||
|
|
||||||
| message id |
|
| message id |
|
||||||
id := page uidString.
|
id := page uidString.
|
||||||
@ -137,7 +136,10 @@ LeDatabase >> importErrorMessage: page [
|
|||||||
nextPut: Character lf;
|
nextPut: Character lf;
|
||||||
nextPutAll: 'already exists in this database and includes overlapping contents';
|
nextPutAll: 'already exists in this database and includes overlapping contents';
|
||||||
nextPut: Character lf;
|
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;
|
||||||
nextPut: Character lf;
|
nextPut: Character lf;
|
||||||
nextPutAll:
|
nextPutAll:
|
||||||
|
Loading…
Reference in New Issue
Block a user