Jan Schoonderbeek <[email protected]> writes: > > This won't work (as I have already written). One would have to do > > template expansion in order to expand the dpl parser function. There is > > no obvious representation for the result of such an expansion. mediawiki > > markup may look like it is such a representation, but it is *not*. > > Ralf, if you've already declared the following not possible, then my > apologies for not understanding this stuff > properly.
no problem, I wasn't very explicit. > > It looks to me like a possible solution to the problem of mwlib not > interpreting things like DPL and SMW might be > the upcoming MW function "expand templates", found e.g. at > http://www.mediawiki.org/wiki/Special:ExpandTemplates > I could imagine the following construction (while knowing zilch about how > mwlib/Collection actually operate): > * I tell Collection that I want to render page Somepage > * Collection fetches the wikitext at Somepage > * Collection visits Special:ExpandTemplates on the originating wiki, feeds > the location Somepage and the fetched > page content, and virtually presses OK > * Collection harvests the resulting expanded text, which now contains the > answers to all queries, expanded > templates etc., and feeds ''that'' into mwlib say, after expanding those templates, you end up with the following: ,---- | <ref>bar</ref> | | <references /> `---- So, this looks like a ref tag? It's not. I've expanded the following: ,---- | <{{#if:1|}}ref>bar</ref> | | <references /> `---- Rendering that with mediawiki results in: ,---- | <ref>bar</ref> `---- not quite what you expected after seeing the expanded text only. The root cause of this problem is that mediawiki substitutes certain tags with UNIQ strings (these are just strings of the form %7FUNIQ5381658174da799b-nowiki-00000001-QINU%7F) when expanding templates and does *not* substitute them back right after template expansion has finished. (Try expanding {{urlencode: <nowiki>bla</nowiki>}} to see what I mean). It's probably a good thing however, since it allows them to place <nowiki> tags inside other tags. At least it's a feature extensively used on wikipedia. This is what I mean with with "no obvious representation" for the result of template expansion. > * mwlib does not find any awkward {{#ask: or {{#dpl: code, but clean > freshly-generated wikitext where the queries > originally were. Rendering goes like usual. looking for template calls isn't that easy. At least you have to expand those templates, since the template names used may be generated dynamically (and those names literally may depend on the phase of the moon, e.g. {{LOCALTIME}})). but that is not my point anyway. -- You received this message because you are subscribed to the Google Groups "mwlib" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/mwlib?hl=.
