Retaking Markdeep page importation.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-09-21 16:15:13 -05:00
parent 994ce727d1
commit ea2657883a

View File

@ -6,17 +6,28 @@ LeDatabase >> addPageFromMarkdeepUrl: aString [
| page | | page |
page := self detectLocalPageForRemote: aString. page := self detectLocalPageForRemote: aString.
page ifNotNil: [ :arg | ^ self importErrorMessage: page ]. page ifNotNil: [ :arg | ^ self importErrorMessage: page ].
self addPage: page. ^ self addPageFromString: (self docTreeForLink: aString)
]
{ #category : #'*MiniDocs' }
LeDatabase >> addPageFromString: markdeepDocTree [
^ markdeepDocTree
] ]
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
LeDatabase >> detectLocalPageForRemote: markdeepDocUrl [ LeDatabase >> detectLocalPageForRemote: markdeepDocUrl [
| markdeepHelper id remoteMetadata docTree | | markdeepHelper id remoteMetadata docTree |
markdeepHelper := Markdeep new. markdeepHelper := Markdeep new.
docTree := (XMLHTMLParser on: markdeepDocUrl asUrl retrieveContents) parseDocument. docTree := self docTreeForLink: markdeepDocUrl.
remoteMetadata := markdeepHelper metadataFromXML: docTree. remoteMetadata := markdeepHelper metadataFromXML: docTree.
id := remoteMetadata at: 'id' ifAbsent: [ ^ false ]. id := remoteMetadata at: 'id' ifAbsent: [ nil ].
^ self pageWithID: id ifAbsent: [ nil ]. ^ self pageWithID: id ifAbsent: [ ^ nil ].
]
{ #category : #'*MiniDocs' }
LeDatabase >> docTreeForLink: aString [
^ (XMLHTMLParser on: aString) parseDocument
] ]
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }