Nested pages content importation.
This commit is contained in:
parent
92a686de96
commit
55b304581c
@ -1,5 +1,36 @@
|
||||
Extension { #name : #LeDatabase }
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LeDatabase >> addPage2FromMarkdeep: markdeepDocTree withRemote: externalDocLocation [
|
||||
| remoteMetadata divSnippets dataSnippets snippets page |
|
||||
divSnippets := (markdeepDocTree xpath: '//div[@st-class]') asOrderedCollection
|
||||
collect: [ :xmlElement | xmlElement postCopy ].
|
||||
remoteMetadata := Markdeep new metadataFromXML: markdeepDocTree.
|
||||
remoteMetadata at: 'origin' put: externalDocLocation.
|
||||
dataSnippets := self sanitizeMarkdeepSnippets: divSnippets withMetadata: remoteMetadata.
|
||||
snippets := dataSnippets collect: [ :each | each asLepiterSnippet ].
|
||||
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);
|
||||
createEmail: (remoteMetadata at: 'creator');
|
||||
editEmail: (remoteMetadata at: 'modifier').
|
||||
^ { snippets . page }
|
||||
"snippets do: [ :snippet |
|
||||
(self hasBlockUID: snippet uid)
|
||||
ifTrue: [ | existingPage |
|
||||
existingPage := self pages
|
||||
detect: [ :pageTemp | pageTemp includesSnippetUid: snippet uid ].
|
||||
self importErrorForLocal: existingPage withRemote: externalDocLocation.
|
||||
^ self ]
|
||||
ifFalse: [ snippet database: self.
|
||||
self registerSnippet: snippet ] ].
|
||||
self addPage: page.
|
||||
^ page"
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LeDatabase >> addPageCopy: aLePage [
|
||||
| pageTitle timestamp shortID page |
|
||||
@ -55,7 +86,7 @@ LeDatabase >> addPageFromMarkdeepUrl: aString [
|
||||
ifNotNil: [ :arg |
|
||||
self importErrorForLocal: page withRemote: aString.
|
||||
^ self ].
|
||||
^ self addPageFromMarkdeep: (self docTreeForLink: aString) withRemote: aString
|
||||
^ self addPage2FromMarkdeep: (self docTreeForLink: aString) withRemote: aString
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
|
@ -92,7 +92,7 @@ LePage >> detectParentSnippetWithUid: uidString [
|
||||
{ #category : #'*MiniDocs' }
|
||||
LePage >> exportedFileName [
|
||||
| sanitized |
|
||||
sanitized := self title asDashedLowercase romanizeAccents copyWithoutAll: #($/ $:).
|
||||
sanitized := self title asDashedLowercase romanizeAccents copyWithoutAll: #($/ $: $🢒).
|
||||
^ sanitized , '--' , (self uidString copyFrom: 1 to: 5)
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user