Extracting from populated table of contents. Debuging web preview.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-05-22 06:58:33 -05:00
parent 356ee754bf
commit 4b6853d920
3 changed files with 33 additions and 9 deletions

View File

@ -129,10 +129,10 @@ LePage >> latestEditTime: aLeTime [
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
LePage >> localHostAddress [ LePage >> localHostAddress [
| localUrl route | | localUrl route |
MiniDocsServer teapot server isRunning ifFalse: [ MiniDocsServer start ]. MiniDocsServer teapot server isRunning ifFalse: [ MiniDocsServer restart ].
route := MiniDocsServer teapot staticRouter prefix joinUsing: '/'. route := MiniDocsServer teapot staticRouter prefix joinUsing: '/'.
localUrl := MiniDocsServer teapot server localUrl asString. localUrl := MiniDocsServer teapot server localUrl asString.
^ localUrl, route, '/', self markdeepFileName ^ {localUrl, route, '/', self markdeepFileName . MiniDocsServer}
] ]
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }

View File

@ -91,13 +91,6 @@ 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
@ -120,6 +113,16 @@ PubPub >> languageFolder [
^ self folder / self currentLanguage ^ self folder / self currentLanguage
] ]
{ #category : #accessing }
PubPub >> populateTableOfContents [
| contentsCollection |
contentsCollection := self extractRawTableOfContents collect: [:each |
(PubPubContent fromXML: each)
language: self currentLanguage
].
self addTableOfContents: contentsCollection asOrderedCollection
]
{ #category : #accessing } { #category : #accessing }
PubPub >> printOn: aStream [ PubPub >> printOn: aStream [
super printOn: aStream. super printOn: aStream.
@ -133,6 +136,22 @@ PubPub >> tableOfContents [
^ tableOfContents at: self currentLanguage ^ tableOfContents at: self currentLanguage
] ]
{ #category : #accessing }
PubPub >> tableOfContents: anObject [
tableOfContents := anObject
]
{ #category : #accessing }
PubPub >> tableOfContentsDictionary [
| response |
response := OrderedDictionary new.
self tableOfContents do: [:content |
response
at: content shortName put: content id
].
^ response
]
{ #category : #accessing } { #category : #accessing }
PubPub >> titles [ PubPub >> titles [
^ titles ifNil: [titles := OrderedDictionary new] ^ titles ifNil: [titles := OrderedDictionary new]

View File

@ -37,6 +37,11 @@ PubPubContent >> id [
^ (self url splitOn: $/) last ^ (self url splitOn: $/) last
] ]
{ #category : #'as yet unclassified' }
PubPubContent >> language: aString [
language := aString
]
{ #category : #accessing } { #category : #accessing }
PubPubContent >> printOn: aStream [ PubPubContent >> printOn: aStream [
super printOn: aStream. super printOn: aStream.