r73461 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73460‎ | r73461 | r73462 >
Date:15:44, 21 September 2010
Author:thomasv
Status:ok
Tags:
Comment:
remove tag hook: it is better to use a template
Modified paths:
  • /trunk/extensions/DoubleWiki/DoubleWiki_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DoubleWiki/DoubleWiki_body.php
@@ -28,30 +28,18 @@
2929 * Constructor
3030 */
3131 function __construct() {
32 - global $wgParser, $wgHooks;
33 - $wgParser->setHook( 'iw_align' , array( &$this, 'iw_align' ) );
 32+ global $wgHooks;
3433 $wgHooks['OutputPageBeforeHTML'][] = array( &$this, 'addMatchedText' );
3534 }
3635
3736 /*
38 - * Wrap the list of matched phrases into a hidden element.
39 - */
40 - function iw_align( $input, $args, $parser ) {
41 - if ( isset( $args['lang'] ) ) {
42 - $lang = $args['lang'];
43 - return "<div id=\"align-$lang\" style=\"display:none;\">\n" . trim( $input ). "\n</div>";
44 - }
45 - return '';
46 - }
47 -
48 - /*
4937 * Read the list of matched phrases and add tags to the html output.
5038 */
5139 function addMatchingTags ( &$text, $lang ) {
5240 $pattern = "/<div id=\"align-$lang\" style=\"display:none;\">\n<p>([^<]*?)<\/p>\n<\/div>/is";
5341 if( ! preg_match( $pattern, $text, $m ) ) return ;
5442 $text = str_replace( $m[1], '', $text );
55 - $line_pattern = "/\s*([^\|\n]*?)\s*\|\s*([^\|\n]*?)\s*\n/i";
 43+ $line_pattern = "/\s*([^:\n]*?)\s*:\s*([^:\n]*?)\s*\n/i";
5644 preg_match_all( $line_pattern, $m[1], $items, PREG_SET_ORDER );
5745 foreach( $items as $n => $i ) {
5846 $text = str_replace( $i[1], "<span id=\"dw-$n\" title=\"{$i[2]}\"/>".$i[1], $text );

Follow-up revisions

RevisionCommit summaryAuthorDate
r82513fix regression in r73461: Use pre tag instead of p. Use equal sign instead of...thomasv16:29, 20 February 2011

Status & tagging log