New PubPubContent object.
This commit is contained in:
parent
9a4a87a45e
commit
4b0227454b
@ -82,10 +82,15 @@ PubPub >> exportMarkdeepFiles [
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
PubPub >> extractContents [
|
||||
PubPub >> extractAllContentsRaw [
|
||||
^ self frontPage xpath: '//div[@class="layout-pubs-block"]'
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
PubPub >> extractRawTableOfContents [
|
||||
^ self extractAllContentsRaw first xpath: '//div[contains(concat(" ",normalize-space(@class)," "), " pub-preview-component ")]'
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
PubPub >> folder [
|
||||
^ folder ensureCreateDirectory
|
||||
|
43
src/MiniDocs/PubPubContent.class.st
Normal file
43
src/MiniDocs/PubPubContent.class.st
Normal file
@ -0,0 +1,43 @@
|
||||
Class {
|
||||
#name : #PubPubContent,
|
||||
#superclass : #Object,
|
||||
#instVars : [
|
||||
'title',
|
||||
'language',
|
||||
'url',
|
||||
'thumbnail'
|
||||
],
|
||||
#category : #'MiniDocs-Model'
|
||||
}
|
||||
|
||||
{ #category : #accessing }
|
||||
PubPubContent >> fromXML: aXMLElement [
|
||||
| image anchor|
|
||||
image := aXMLElement contentNodes first xpath: './a/div'.
|
||||
image
|
||||
ifNotEmpty: [|style rawUrl|
|
||||
style := (image first attributeAt: 'style').
|
||||
rawUrl := (style splitOn: 'url') second.
|
||||
self
|
||||
thumbnail:(rawUrl copyFrom: 3 to: rawUrl size - 2)
|
||||
].
|
||||
anchor := (aXMLElement contentNodes second contentNodes first xpath: './div[@class="title-wrapper"]/a') first.
|
||||
self
|
||||
title: (anchor attributeAt: 'title');
|
||||
url: (anchor attributeAt: 'title').
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
PubPubContent >> thumbnail: anURL [
|
||||
thumbnail := anURL
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
PubPubContent >> title: anObject [
|
||||
title := anObject
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
PubPubContent >> url: anObject [
|
||||
url := anObject
|
||||
]
|
Loading…
Reference in New Issue
Block a user