Improving Lepiter pages importation fom legacy Grafoscopio notebooks.
This commit is contained in:
parent
8488531726
commit
362659b584
@ -5,7 +5,7 @@ LeDatabase >> addPageCopy: aLePage [
|
|||||||
| page |
|
| page |
|
||||||
page := LePage new.
|
page := LePage new.
|
||||||
page title: ('Copy of ', aLePage title,' (id: ', (page uid asString copyFrom: 1 to: 8), ')').
|
page title: ('Copy of ', aLePage title,' (id: ', (page uid asString copyFrom: 1 to: 8), ')').
|
||||||
aLePage children do: [ :snippet | | newSnippet |
|
aLePage allChildrenDepthFirst do: [ :snippet | | newSnippet |
|
||||||
newSnippet := snippet class new.
|
newSnippet := snippet class new.
|
||||||
newSnippet className = 'LeTextSnippet' ifTrue: [ newSnippet
|
newSnippet className = 'LeTextSnippet' ifTrue: [ newSnippet
|
||||||
string: snippet contentAsString ].
|
string: snippet contentAsString ].
|
||||||
@ -23,6 +23,7 @@ LeDatabase >> addPageFromMarkdeep: markdeepDocTree withRemote: externalDocLocati
|
|||||||
| remoteMetadata divSnippets snippets page |
|
| remoteMetadata divSnippets snippets page |
|
||||||
divSnippets := (markdeepDocTree xpath: '//div[@st-class]') asOrderedCollection
|
divSnippets := (markdeepDocTree xpath: '//div[@st-class]') asOrderedCollection
|
||||||
collect: [ :xmlElement | xmlElement postCopy ].
|
collect: [ :xmlElement | xmlElement postCopy ].
|
||||||
|
self sanitizeMarkdeepSnippets: divSnippets.
|
||||||
snippets := divSnippets
|
snippets := divSnippets
|
||||||
collect: [ :xmlElement |
|
collect: [ :xmlElement |
|
||||||
(xmlElement attributes at: 'st-class') = 'LeTextSnippet'
|
(xmlElement attributes at: 'st-class') = 'LeTextSnippet'
|
||||||
|
@ -16,16 +16,22 @@ LeTextSnippet >> asLePage [
|
|||||||
{ #category : #'*MiniDocs' }
|
{ #category : #'*MiniDocs' }
|
||||||
LeTextSnippet >> contentFrom: markdeepDiv [
|
LeTextSnippet >> contentFrom: markdeepDiv [
|
||||||
|
|
||||||
| sanitizedStringText metadata |
|
| sanitizedStringText metadata creationTime modificationTime |
|
||||||
metadata := STON fromString: (markdeepDiv attributes at: 'st-data').
|
metadata := STON fromString: (markdeepDiv attributes at: 'st-data').
|
||||||
|
self uid: (LeUID new uidString: (metadata at: 'id')).
|
||||||
|
"creationTime is needed to deal with empty values from Grafoscopio migrated notebooks."
|
||||||
|
creationTime := metadata at: 'created'.
|
||||||
|
modificationTime := (metadata at: 'modified') asDateAndTime.
|
||||||
|
(creationTime isNil or: [ creationTime = 'nil']) ifTrue: [
|
||||||
|
creationTime := modificationTime - 1 second.
|
||||||
|
self addErrata: 'Older: created before it appears.'].
|
||||||
sanitizedStringText := markdeepDiv contentString.
|
sanitizedStringText := markdeepDiv contentString.
|
||||||
sanitizedStringText := sanitizedStringText allButFirst.
|
sanitizedStringText := sanitizedStringText allButFirst.
|
||||||
sanitizedStringText := sanitizedStringText allButLast.
|
sanitizedStringText := sanitizedStringText allButLast.
|
||||||
self string: sanitizedStringText;
|
self string: sanitizedStringText;
|
||||||
uid: (LeUID new uidString: (metadata at: 'id'));
|
|
||||||
parent: (metadata at: 'parent');
|
parent: (metadata at: 'parent');
|
||||||
createTime: (LeTime new time: ((metadata at: 'created')asDateAndTime));
|
createTime: (LeTime new time: creationTime asDateAndTime);
|
||||||
editTime: (LeTime new time: ((metadata at: 'modified') asDateAndTime));
|
editTime: (LeTime new time: modificationTime);
|
||||||
editEmail: (metadata at: 'modifier');
|
editEmail: (metadata at: 'modifier');
|
||||||
createEmail: (metadata at: 'creator')
|
createEmail: (metadata at: 'creator')
|
||||||
]
|
]
|
||||||
@ -57,6 +63,7 @@ LeTextSnippet >> options [
|
|||||||
{ #category : #'*MiniDocs' }
|
{ #category : #'*MiniDocs' }
|
||||||
LeTextSnippet >> parentId [
|
LeTextSnippet >> parentId [
|
||||||
self parent ifNil: [ ^ self ].
|
self parent ifNil: [ ^ self ].
|
||||||
|
(self parent isString) ifTrue: [^ self parent].
|
||||||
^ self parent uidString.
|
^ self parent uidString.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user