Merge pull request 'gt-crashes/2' (!3) from gt-crashes/2 into master
Reviewed-on: #3
This commit is contained in:
commit
356ee754bf
@ -91,6 +91,13 @@ PubPub >> extractRawTableOfContents [
|
|||||||
^ self extractAllContentsRaw first xpath: '//div[contains(concat(" ",normalize-space(@class)," "), " pub-preview-component ")]'
|
^ self extractAllContentsRaw first xpath: '//div[contains(concat(" ",normalize-space(@class)," "), " pub-preview-component ")]'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
PubPub >> extractTableOfContents [
|
||||||
|
^ self extractRawTableOfContents collect: [:each |
|
||||||
|
PubPubContent fromXML: each
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
PubPub >> folder [
|
PubPub >> folder [
|
||||||
^ folder ensureCreateDirectory
|
^ folder ensureCreateDirectory
|
||||||
|
@ -10,6 +10,11 @@ Class {
|
|||||||
#category : #'MiniDocs-Model'
|
#category : #'MiniDocs-Model'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
PubPubContent class >> fromXML: anXMLElement [
|
||||||
|
^ self new fromXML: anXMLElement
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
PubPubContent >> fromXML: aXMLElement [
|
PubPubContent >> fromXML: aXMLElement [
|
||||||
| image anchor|
|
| image anchor|
|
||||||
@ -24,7 +29,29 @@ image
|
|||||||
anchor := (aXMLElement contentNodes second contentNodes first xpath: './div[@class="title-wrapper"]/a') first.
|
anchor := (aXMLElement contentNodes second contentNodes first xpath: './div[@class="title-wrapper"]/a') first.
|
||||||
self
|
self
|
||||||
title: (anchor attributeAt: 'title');
|
title: (anchor attributeAt: 'title');
|
||||||
url: (anchor attributeAt: 'title').
|
url: (anchor attributeAt: 'href').
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
PubPubContent >> id [
|
||||||
|
^ (self url splitOn: $/) last
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
PubPubContent >> printOn: aStream [
|
||||||
|
super printOn: aStream.
|
||||||
|
aStream
|
||||||
|
nextPutAll: '( ', self title,' | ', self id, ' )'
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
PubPubContent >> shortName [
|
||||||
|
| sanitized |
|
||||||
|
sanitized := (self title splitOn: $:) first.
|
||||||
|
sanitized := sanitized copyReplaceAll: '’' with: ''.
|
||||||
|
sanitized := sanitized asCamelCase.
|
||||||
|
sanitized at: 1 put: sanitized first asLowercase.
|
||||||
|
^ sanitized
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -32,11 +59,21 @@ PubPubContent >> thumbnail: anURL [
|
|||||||
thumbnail := anURL
|
thumbnail := anURL
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
PubPubContent >> title [
|
||||||
|
^ title
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
PubPubContent >> title: anObject [
|
PubPubContent >> title: anObject [
|
||||||
title := anObject
|
title := anObject
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
PubPubContent >> url [
|
||||||
|
^url
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
PubPubContent >> url: anObject [
|
PubPubContent >> url: anObject [
|
||||||
url := anObject
|
url := anObject
|
||||||
|
Loading…
Reference in New Issue
Block a user