简体   繁体   English

展开MediaWiki扩展中的魔术词

[英]Expand Magic Words from MediaWiki extension

I need to expand the magicword {{CURRENTPAGEE}} from a mediawiki extension: 我需要从mediawiki扩展中扩展魔术词{{CURRENTPAGEE}}:

<extension>{{CURRENTPAGEE}}</extension>

but the macro is not expanded before passing it to the extension's argument, is there any way to get the current page url before passing it to the extension? 但是在将宏传递给扩展程序的参数之前未对其进行扩展,是否有任何方法在将其传递给扩展程序之前获取当前页面的url? Or to get the calling url from inside the extension code? 还是要从扩展代码中获取调用网址? Thanx a lot! 非常感谢!

You can either use Parser 's method recursiveTagParse , as described by "How do I render wikitext in my extension?" 您可以使用Parser的方法recursiveTagParse ,如“如何在扩展程序中呈现Wikitext?”中所述。 in the MediaWiki manual , or to get the current page's title you can indeed use the global $wgTitle or, which is better, the parent frame (passed as fourth parameter to the callback), which has public attribute $title . 在MediaWiki手册中 ,或者要获得当前页面的标题,您确实可以使用全局$wgTitle或更好的是使用具有公共属性$title的父框架(作为回调的第四个参数传递)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM