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