Accessing page shared variables.
This commit is contained in:
parent
3876b12eb9
commit
e393519bf4
@ -98,11 +98,6 @@ LePage >> exportedFileName [
|
||||
^ sanitized , '--' , (self uidString copyFrom: 1 to: 5)
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LePage >> fileName [
|
||||
^ self title asDashedLowercase, '.', ((self uidString copyFrom: 1 to: 5 ) copyWithoutAll: '/'), '.md.html'
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LePage >> fromMarkdeepUrl: aString [
|
||||
| docTree pageMetadata |
|
||||
@ -184,6 +179,30 @@ LePage >> removeSnippetsMetadata [
|
||||
ifTrue: [ snippet options removeKey: 'metadata' ] ]
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LePage >> sharedVariablesBindings [
|
||||
| codeSnippets shared |
|
||||
codeSnippets := self preorderTraversal select: [:snippet |
|
||||
snippet class = LePharoSnippet and: [ snippet code includesSubstring: ':=']
|
||||
].
|
||||
|
||||
codeSnippets first in: [:snippet | | context |
|
||||
context := snippet coder evaluationContext.
|
||||
snippet coder doItInContext: context.
|
||||
shared := context bindingStrategy bindings detect: [:each |
|
||||
each isKindOf: GtSharedVariablesBindings
|
||||
]
|
||||
].
|
||||
|
||||
codeSnippets asArray allButFirstDo: [:snippet| | context|
|
||||
context := snippet coder evaluationContext.
|
||||
context addBindings: shared.
|
||||
snippet coder doItInContext: context
|
||||
].
|
||||
|
||||
^ shared asDictionary
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LePage >> storage [
|
||||
|
||||
|
@ -43,5 +43,5 @@ LeTextualSnippet >> markdownCustomOpener [
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
LeTextualSnippet >> tags [
|
||||
^ self metadata at: 'tags'
|
||||
^ self metadata at: 'tags' ifAbsentPut: [ Set new ]
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user