Index: trunk/extensions/DoubleWiki/DoubleWiki_body.php |
— | — | @@ -28,30 +28,18 @@ |
29 | 29 | * Constructor |
30 | 30 | */ |
31 | 31 | function __construct() { |
32 | | - global $wgParser, $wgHooks; |
33 | | - $wgParser->setHook( 'iw_align' , array( &$this, 'iw_align' ) ); |
| 32 | + global $wgHooks; |
34 | 33 | $wgHooks['OutputPageBeforeHTML'][] = array( &$this, 'addMatchedText' ); |
35 | 34 | } |
36 | 35 | |
37 | 36 | /* |
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 | | - /* |
49 | 37 | * Read the list of matched phrases and add tags to the html output. |
50 | 38 | */ |
51 | 39 | function addMatchingTags ( &$text, $lang ) { |
52 | 40 | $pattern = "/<div id=\"align-$lang\" style=\"display:none;\">\n<p>([^<]*?)<\/p>\n<\/div>/is"; |
53 | 41 | if( ! preg_match( $pattern, $text, $m ) ) return ; |
54 | 42 | $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"; |
56 | 44 | preg_match_all( $line_pattern, $m[1], $items, PREG_SET_ORDER ); |
57 | 45 | foreach( $items as $n => $i ) { |
58 | 46 | $text = str_replace( $i[1], "<span id=\"dw-$n\" title=\"{$i[2]}\"/>".$i[1], $text ); |