2022-01-22 15:23:56 +00:00
|
|
|
Extension { #name : #LePage }
|
|
|
|
|
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
|
|
LePage >> asMarkdeepInto: aFileLocator [
|
|
|
|
|
|
|
|
self preorderTraversal
|
|
|
|
]
|
2022-01-24 01:38:07 +00:00
|
|
|
|
2022-02-03 18:01:35 +00:00
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
2022-02-05 23:33:56 +00:00
|
|
|
LePage >> detectParentSnippetWithUid: uidString [
|
2022-02-03 18:01:35 +00:00
|
|
|
"Answer a boolean indicating whether the supplied uid is present"
|
|
|
|
|
2022-02-05 23:33:56 +00:00
|
|
|
^ self preorderTraversal detect: [ :snippet | snippet uidString = uidString ] ifNone: [ ^ self ]
|
2022-02-03 18:01:35 +00:00
|
|
|
]
|
|
|
|
|
2022-01-24 01:38:07 +00:00
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
|
|
LePage >> fileName [
|
|
|
|
^ self title asDashedLowercase, '.', ((self uidString copyFrom: 1 to: 5 ) copyWithoutAll: '/'), '.md.html'
|
|
|
|
]
|
|
|
|
|
2022-01-31 01:09:17 +00:00
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
2022-02-02 23:35:39 +00:00
|
|
|
LePage >> fromMarkdeepUrl: aString [
|
|
|
|
| docTree pageMetadata |
|
|
|
|
docTree := GrafoscopioUtils xmlFromUrl: aString.
|
|
|
|
pageMetadata := Markdeep new metadataFromXML: docTree.
|
|
|
|
self
|
|
|
|
basicUid: (pageMetadata at: 'id');
|
|
|
|
title: (pageMetadata at: 'title');
|
2022-03-01 14:15:05 +00:00
|
|
|
createTime: (pageMetadata at: 'created') asDateAndTime;
|
|
|
|
editTime: (pageMetadata at: 'modified') asDateAndTime;
|
2022-02-02 23:35:39 +00:00
|
|
|
createEmail: (pageMetadata at: 'creator');
|
|
|
|
editEmail: (pageMetadata at: 'modifier');
|
|
|
|
optionAt: 'metadata' put: pageMetadata.
|
|
|
|
self populateChildrenFrom: (docTree xpath: '//div')
|
2022-01-31 02:54:16 +00:00
|
|
|
|
|
|
|
]
|
|
|
|
|
2022-04-05 15:03:41 +00:00
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
|
|
LePage >> navTop [
|
|
|
|
| topNavFile |
|
|
|
|
topNavFile := ((self optionAt: 'storage') / '_navtop.html').
|
|
|
|
topNavFile exists
|
|
|
|
ifFalse: [ ^ '' ]
|
|
|
|
ifTrue: [ ^ topNavFile contents ]
|
|
|
|
]
|
|
|
|
|
2022-02-02 23:35:39 +00:00
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
|
|
LePage >> populateChildrenFrom: docTreeDivs [
|
2022-02-05 23:33:56 +00:00
|
|
|
docTreeDivs doWithIndex: [:div :i | | snippetTemp parent "surrogate" |
|
2022-02-05 23:20:48 +00:00
|
|
|
snippetTemp := LeSnippet fromMetaMarkdeep:div.
|
2022-02-05 23:33:56 +00:00
|
|
|
parent := self detectParentSnippetWithUid: (snippetTemp metadata at: 'parent').
|
|
|
|
parent snippetBuilder snippet: snippetTemp; add.
|
2022-02-02 23:35:39 +00:00
|
|
|
]
|
|
|
|
]
|
|
|
|
|
2022-02-04 15:44:19 +00:00
|
|
|
{ #category : #'*Grafoscopio-Utils-Core' }
|
|
|
|
LePage >> removeSnippetsMetadata [
|
2022-02-11 20:56:21 +00:00
|
|
|
self preorderTraversal do: [ :snippet |
|
|
|
|
(snippet options isNotNil and: [ snippet options includesKey: 'metadata' ])
|
|
|
|
ifTrue: [ snippet options removeKey: 'metadata' ] ]
|
2022-02-04 15:44:19 +00:00
|
|
|
]
|