Difference between revisions of "7 September 2007"
m |
(the voodoo) |
||
Line 1: | Line 1: | ||
{{news|title=Testing TreeView4|img=|msg= | {{news|title=Testing TreeView4|img=|msg= | ||
The [[MW:Extension:Tree view|Tree view extension]] has been upgraded today from [[Extension:Treeview.php|version 3.6.1]] to [[Extension:Treeview4.php|4.0.1]]. The core code has been re-written in the new version to include special [[w:Voodoo programming|voodoo]] techniques to overcome a long standing bug preventing articles containing trees from able to be transcluded unless they're transcluded into another tree. The new version appears to execute a little faster too, but I'll test it for a while before making the new version official on the [[MW:|MediaWiki]] site. Let me know if you notice any problems with any of the trees here on OrganicDesign as we're now using the new version. | The [[MW:Extension:Tree view|Tree view extension]] has been upgraded today from [[Extension:Treeview.php|version 3.6.1]] to [[Extension:Treeview4.php|4.0.1]]. The core code has been re-written in the new version to include special [[w:Voodoo programming|voodoo]] techniques to overcome a long standing bug preventing articles containing trees from able to be transcluded unless they're transcluded into another tree. The new version appears to execute a little faster too, but I'll test it for a while before making the new version official on the [[MW:|MediaWiki]] site. Let me know if you notice any problems with any of the trees here on OrganicDesign as we're now using the new version. | ||
+ | |||
+ | The main voodoo is the following bit of code which allows the recursive tree stuff to work even though there's no way to determine the transclusion depth from MediaWiki's parser environment. I understood the voodoo enough to get it working by combining it with some minor hacks, some trial-and-error, some perserverence and some luck ;-) | ||
+ | <php> | ||
+ | $text = $this->uniq[$id] = preg_replace( | ||
+ | '/^\\*(\\**)\\s*(.UNIQ.+?-treeview4(.+?)-.+?-QINU)/me', | ||
+ | '$this->uniq["$3"] ? preg_replace("/^(\\*+)/m","$1\$1",$this->uniq["$3"]) : "$1$2"', | ||
+ | $text | ||
+ | ); | ||
+ | </php> | ||
}} | }} |
Latest revision as of 07:36, 7 September 2007
Testing TreeView4
The Tree view extension has been upgraded today from version 3.6.1 to 4.0.1. The core code has been re-written in the new version to include special voodoo techniques to overcome a long standing bug preventing articles containing trees from able to be transcluded unless they're transcluded into another tree. The new version appears to execute a little faster too, but I'll test it for a while before making the new version official on the MediaWiki site. Let me know if you notice any problems with any of the trees here on OrganicDesign as we're now using the new version.
The main voodoo is the following bit of code which allows the recursive tree stuff to work even though there's no way to determine the transclusion depth from MediaWiki's parser environment. I understood the voodoo enough to get it working by combining it with some minor hacks, some trial-and-error, some perserverence and some luck ;-) <php> $text = $this->uniq[$id] = preg_replace( '/^\\*(\\**)\\s*(.UNIQ.+?-treeview4(.+?)-.+?-QINU)/me', '$this->uniq["$3"] ? preg_replace("/^(\\*+)/m","$1\$1",$this->uniq["$3"]) : "$1$2"', $text ); </php>