Last modified: 2011-03-13 18:04:53 UTC
When I create parser functions that accept DOM-style arguments, the first argument is already expanded. Example: If I do a var_dump() of args[0] in the [[meta:Help:ParserFunctions]]' ExtParserFunctions::ifObj() method, it shows that the argument is a string. The other arguments are fine though. They show up as PPNode_DOM objects.
Right, that's how it is, and that's how it will stay.
Ah, so it's that way by design. Okay. The work-around is easy enough, I'll just make my parser function not use the first argument.
You should call trim($frame->expand($arg)) on each argument regardless of whether it is a string or a PPNode. You should not be accessing the underlying tree.
I'm using both PPFrame::expand() and PPNode_DOM::splitArg() for the "param=value" pairs. The issue is that I don't want the first arg to be expanded automatically—in some cases not at all—depending on the other "param=value" arguments. There's also an issue with timing; when the argument gets expanded. For instance, with [[mw:Extension:Cite/Cite.php]] the following: <ref>E. Miller, The Sun, (New York: Academic Press, 2005), 23-5.</ref> <references/> Gives a very different result than: <references/> <ref>E. Miller, The Sun, (New York: Academic Press, 2005), 23-5.</ref> If my extension is going to interact with other extensions where timing is important, I want to make sure the argument gets expanded when its supposed to, and not prematurely. But as I said, this is minor since I have a workaround. In fact, since the current behavior is intended, this isn't a bug, but an enhancement request.