Moving methods to better owners for functionality encapsulation.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-01-31 22:12:33 -05:00
parent ce3b6a96a0
commit 576a408fb5
4 changed files with 24 additions and 16 deletions

View File

@ -160,3 +160,9 @@ GrafoscopioUtils class >> update [
package: 'Grafoscopio-Utils';
load.
]
{ #category : #'*Grafoscopio-Utils-Core' }
GrafoscopioUtils class >> xmlFromUrl: aString [
^ (XMLHTMLParser on: aString asUrl retrieveContents) parseDocument
]

View File

@ -0,0 +1,7 @@
Extension { #name : #GrafoscopioUtils }
{ #category : #'*Grafoscopio-Utils-Core' }
GrafoscopioUtils class >> xmlFromUrl: aString [
^ (XMLHTMLParser on: aString asUrl retrieveContents) parseDocument
]

View File

@ -0,0 +1,11 @@
Extension { #name : #LeDatabase }
{ #category : #'*Grafoscopio-Utils-Core' }
LeDatabase >> detectLocalPageForRemote: markdeepDocUrl [
| markdeepHelper id remoteMetadata docTree |
markdeepHelper := Markdeep new.
docTree := (XMLHTMLParser on: markdeepDocUrl asUrl retrieveContents) parseDocument.
remoteMetadata := markdeepHelper metadataFromXML: docTree.
id := remoteMetadata at: 'id' ifAbsent: [ ^ false ].
^ self pageWithID: id ifAbsent: [ nil ].
]

View File

@ -48,16 +48,6 @@ LePage >> fromMarkdeepUrl: aString [
]
{ #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' }
LePage >> markdeepFileName [
| sanitized |
@ -102,9 +92,3 @@ LePage >> preorderTraversal [
self withDeepCollect: [:each | each allChildrenBreadthFirstDo: [:child | output add: child ] ].
^ output.
]
{ #category : #'*Grafoscopio-Utils-Core' }
LePage >> xmlFromUrl: aString [
^ (XMLHTMLParser on: aString asUrl retrieveContents) parseDocument
]