on-demand-selector says it implements the dynamic wiki-style content creation, oh it is great! It is what I want: a simple wiki. but how it solve the second problem in The render widget mechanism in Weblock
I study on-demand-selector's source file first, but it is very short and I get nothing. I switch to its parent widget: selector, it is about a mechanism for mapping URI tokens to widgets. I know what is URI and token, but what is the meaning of URI token? URI's definition like A/B/C/D, so I think A, B, C, D all are tokens and should be passed by their order.
At the beginning, I think on-demand-selector is used to replace my wiki-widget, but one widget need one URI token, How can I provide those URI token? After some testing, I found there is only a default URI token nil if I do nothing with it. I discover lookup-function will return remaining tokens. oh, if given a default URI token, let it return the first page-widget and set remaining tokens for next cycle to return other page-widgets, it seems OK. Unfortunately, The mechanism is not what I believe. I do not what is the purpose of remaining tokens.
Sort my thought here for better progress, :).
You need to make an ON-DEMAND-SELECTOR with a custom :LOOKUP-FUNCTION (as you probably already know).
ReplyDeleteThis selector instance can then be used in place of a normal navigation.
The lookup function gets passed two arguments:
1. the selector object
2. a list of the remaining tokens
It must return either NIL (not found) or the following multiple values: the newly created widget, the list of consumed tokens and the list of remaining tokens.