Home » Text » Text_Wiki » Bug #3365
Enhancing wikilink 'exists' callback
Details
| Request #3365 | Enhancing wikilink 'exists' callback |
|---|---|
| Submitted | 2005-02-02 23:04 UTC |
| From | mvandam+textwiki at caltech dot edu |
| Assigned | pmjones |
| Status | Closed |
| Package | Text_Wiki |
| PHP Version | 4.3.10 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2005-02-02 23:04 UTC] mvandam+textwiki at caltech dot edu
Description:
------------
I have been watching the development of Text_Wiki and really liked your addition of the callback for checking whether a page exists during rendering of Wikilinks (and Freelinks). I didn't like the idea of passing in the whole list of pages. Also it is a nice way to get a list of all linked pages.
I am just wondering if it is possible to take a further step in this direction. What I would like to do to check whether a page exists is to do a single query on my database:
SELECT pagename FROM pages WHERE pagename IN (<list of pages to consider>);
Currently my options are either to generate a list of *all* pages, or to check each one individually against my database (i.e. because 'exists_callback' needs the result immediately after each call).
Do you think there could be a way to get a list of all Wikilinks and Freelinks after parsing but *before rendering*? Then one can check the extistence of all linked pages in a single query before the rendering stage.
Perhaps this could be done by splitting into two callbacks. Have the parser call a 'found' callback and then have the renderer call a 'exists' callback. I can't think of good names for the callbacks. The end user could register zero, one, or both callbacks as needed. Or maybe there is some different way?
Does this make sense? I can elaborate if it is unclear.
Thanks!
Mike
[2005-02-22 17:11 UTC] mvandam+textwiki at caltech dot edu
I think it will work. It should just be a matter of calling 'parse' and 'render' separately rather than using 'transform' (and putting some other stuff, including the call to getTokens in between).
Thanks!