diff --git a/repository/Grafoscopio-Utils/GrafoscopioUtils.class.st b/repository/Grafoscopio-Utils/GrafoscopioUtils.class.st index b5b30f8..9d651a8 100644 --- a/repository/Grafoscopio-Utils/GrafoscopioUtils.class.st +++ b/repository/Grafoscopio-Utils/GrafoscopioUtils.class.st @@ -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 +] diff --git a/repository/Grafoscopio-Utils/GrafoscopioUtils.extension.st b/repository/Grafoscopio-Utils/GrafoscopioUtils.extension.st new file mode 100644 index 0000000..2b76af2 --- /dev/null +++ b/repository/Grafoscopio-Utils/GrafoscopioUtils.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #GrafoscopioUtils } + +{ #category : #'*Grafoscopio-Utils-Core' } +GrafoscopioUtils class >> xmlFromUrl: aString [ + + ^ (XMLHTMLParser on: aString asUrl retrieveContents) parseDocument +] diff --git a/repository/Grafoscopio-Utils/LeDatabase.extension.st b/repository/Grafoscopio-Utils/LeDatabase.extension.st new file mode 100644 index 0000000..a4be762 --- /dev/null +++ b/repository/Grafoscopio-Utils/LeDatabase.extension.st @@ -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 ]. +] diff --git a/repository/Grafoscopio-Utils/LePage.extension.st b/repository/Grafoscopio-Utils/LePage.extension.st index fbc4652..baf3319 100644 --- a/repository/Grafoscopio-Utils/LePage.extension.st +++ b/repository/Grafoscopio-Utils/LePage.extension.st @@ -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 -]