Howdy. I sent the message below to the wikitech-I list, but I didn't get any response. Sumana recommended I post it here as well, so here you go!
Hi all. When working on a wiki extension I came across this thread (http://lists.wikimedia.org/pipermail/wikitech-l/2011-January/051437.html) regarding the purpose/history of setFunctionTagHook() and where/when to use it.
Daniel Friesen wrote: "setFunctionTagHook was added so that you could expand variables inside tags. Then setHook() got added $frame and the need for such hook type disappeared. I'd like to kill it, although it has been there for some time (if any list reader uses it, please stand up)."
I started using the hook in a Firebase extension (http://www.mediawiki.org/w/index.php?title=Extension:Firebase) in order to replace <firebaseraw> tags with responses to HTTP requests /before most other wiki text is parsed/. It works great for me because I can insert data into chunks of code like a google street view widget:
{{#widget:Google Street View |lat=<firebaseraw url="http://gamma.firebase.com/SomeAccountName/lat" /> |lng=<firebaseraw url="http://gamma.firebase.com/SomeAccountName/lon" /> |yaw=370.64659986187695 |pitch=-20 |zoom=0 }}
I'm new to extension writing, though, so maybe there are other, better ways to accomplish this? If not, consider this a vote to leave in setFunctionTagHook()!
--Benny
On 06/11/12 21:16, Benny Lichtner wrote:
I started using the hook in a Firebase extension (http://www.mediawiki.org/w/index.php?title=Extension:Firebase) in order to replace <firebaseraw> tags with responses to HTTP requests /before most other wiki text is parsed/. It works great for me because I can insert data into chunks of code like a google street view widget:
{{#widget:Google Street View |lat=<firebaseraw url="http://gamma.firebase.com/SomeAccountName/lat" /> |lng=<firebaseraw url="http://gamma.firebase.com/SomeAccountName/lon" /> |yaw=370.64659986187695 |pitch=-20 |zoom=0 }}
I'm new to extension writing, though, so maybe there are other, better ways to accomplish this? If not, consider this a vote to leave in setFunctionTagHook()!
--Benny
A parser function instead of a tag seems more appropiate. That way it would be expanded before being passed to #widget.
mediawiki-l@lists.wikimedia.org