ran across these on the blog title page
can someone explain what level and lower are?
A good question - I didn't know the answer myself so did some delving. I'll answer indirectly via the journey I took to find the answer.
value:structure - Display the current structure - but no help with parameters.
The object that holds value links is PRValueLink.
PRDocument elements are rendered using a visitor pattern . By convention #accept: is the method that takes the visitor:
aVisitor visitValueLink: self
so we look for all implementors of #visitValueLink: It looks like there are two possibilities PRReferenceRenderer and the default implementation in PRVisitor.
I set a conditional break-point in PRReferenceRenderer as:
self haltIf: ((aLink parameterAt: 'level' ifAbsent: ) notNil and: [ (aLink parameterAt: 'lower' ifAbsent: ) notNil ]).
The break-point was hit and stepping through I end up in PRValueLink>>#lookupStructure:do:
which has the helpful comment:
Lookup aStructure and evaluate aBlock if it is found. This performs different kinds of navigation starting from aStructure. If the parameter path is given an absolute or relative lookup is started. The parameter level choses a structure at the specified level in the parent chain, where the root is 1 and direct children of the root 2, etc. 0 is the current structure, -1 the parent of the current structure, etc. Furthermore the levels can be delimited using lower and upper bounds
means use the current structure (level=0) but only if the current structure is 3 or more levels down. Levels are defined as the number of parents e.g. a template displaying a blog entry at /pier/blog/downtobusiness would have 3 levels of parents.
What does it do with the structure? PRValueLink>>formatDescribed:default: is called. If a parameter "display" is defined it will try to find a description for the structure with a matching parameter. The default is #title. In this case there is no "display" parameter so the structure's title is displayed.
If you want to see what parameters could be displayed by say a blog post (magritte 3):
PBPost new magritteDescription children select: [:each | each parameterName notNil] thenCollect: [ :each | each parameterName ]
a SortedCollection('name' 'menu' 'title' 'tags' 'owner' 'group')
Down to business
I like blogging, so here is my second post.
Where "Down to business" is displayed by *>value:structure|level=0|lower=3*.