Starting detection of remote Markdeep pages in current database.
This commit is contained in:
parent
7f1e2b24e2
commit
ce3b6a96a0
@ -40,7 +40,22 @@ LePage >> fileName [
|
|||||||
|
|
||||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||||
LePage >> fromMarkdeepUrl: aString [
|
LePage >> fromMarkdeepUrl: aString [
|
||||||
^ aString asUrl retrieveContents.
|
|
||||||
|
| markdeepHelper id remoteMetadata |
|
||||||
|
markdeepHelper := Markdeep new.
|
||||||
|
remoteMetadata := markdeepHelper metadataFromXML: (self xmlFromUrl: aString).
|
||||||
|
id := remoteMetadata at: 'id' ifAbsent: [ ^ false ].
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||||
|
LePage >> isInDocumentsDatabase: markdeepDocUrl [
|
||||||
|
| markdeepHelper id remoteMetadata |
|
||||||
|
markdeepHelper := Markdeep new.
|
||||||
|
remoteMetadata := markdeepHelper metadataFromXML: (self xmlFromUrl: markdeepDocUrl).
|
||||||
|
id := remoteMetadata at: 'id' ifAbsent: [ ^ false ].
|
||||||
|
self database pagesByDateToShow
|
||||||
|
detect: [ :page | page uidString = id ] ifFound: [ ^ true ] ifNone: [ ^ false ].
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'*Grafoscopio-Utils-Core' }
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||||
@ -87,3 +102,9 @@ LePage >> preorderTraversal [
|
|||||||
self withDeepCollect: [:each | each allChildrenBreadthFirstDo: [:child | output add: child ] ].
|
self withDeepCollect: [:each | each allChildrenBreadthFirstDo: [:child | output add: child ] ].
|
||||||
^ output.
|
^ output.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
||||||
|
LePage >> xmlFromUrl: aString [
|
||||||
|
|
||||||
|
^ (XMLHTMLParser on: aString asUrl retrieveContents) parseDocument
|
||||||
|
]
|
||||||
|
@ -210,6 +210,16 @@ Markdeep >> metadata [
|
|||||||
^ metadata ifNil: [ metadata := OrderedDictionary new ]
|
^ metadata ifNil: [ metadata := OrderedDictionary new ]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #utilities }
|
||||||
|
Markdeep >> metadataFromXML: aXMLDocument [
|
||||||
|
| metaDict |
|
||||||
|
|
||||||
|
metaDict := OrderedDictionary new.
|
||||||
|
(aXMLDocument xpath: '//meta') do: [ :each |
|
||||||
|
metaDict at: (each @ 'name') stringValue put: (each @ 'content') stringValue ].
|
||||||
|
^ metaDict
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #printing }
|
{ #category : #printing }
|
||||||
Markdeep >> printOn: aStream [
|
Markdeep >> printOn: aStream [
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user