From 4f31d8313746d96c0373639d425718e5bf2fbf90 Mon Sep 17 00:00:00 2001 From: Wil Mahan Date: Fri, 1 Oct 2004 21:20:47 +0000 Subject: [PATCH] Fix bug 553: when a piped link contains a template parameter, it sometimes confuses the table code, because '|' is also used to delimit cell attributes. This change prevents doTableStuff() from treating any text containing '[[' as attributes. --- includes/Parser.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/includes/Parser.php b/includes/Parser.php index 8ced46d785..7cb0ad1281 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -584,6 +584,7 @@ class Parser array_push ( $ltr , $this->fixTagAttributes ( $x ) ) ; } else if ( '|' == $fc || '!' == $fc || '|+' == substr ( $x , 0 , 2 ) ) { # Caption + # $x is a table row if ( '|+' == substr ( $x , 0 , 2 ) ) { $fc = '+' ; $x = substr ( $x , 1 ) ; @@ -592,6 +593,8 @@ class Parser if ( $fc == '!' ) $after = str_replace ( '!!' , '||' , $after ) ; $after = explode ( '||' , $after ) ; $t[$k] = '' ; + + # Loop through each table cell foreach ( $after AS $theline ) { $z = '' ; @@ -610,8 +613,16 @@ class Parser else if ( $fc == '+' ) $l = 'caption' ; else $l = '' ; array_push ( $ltd , $l ) ; + + # Cell parameters $y = explode ( '|' , $theline , 2 ) ; - if ( count ( $y ) == 1 ) $y = "{$z}<{$l}>{$y[0]}" ; + # Note that a '|' inside an invalid link should not + # be mistaken as delimiting cell parameters + if ( strpos( $y[0], '[[' ) !== false ) { + $y = array ($theline); + } + if ( count ( $y ) == 1 ) + $y = "{$z}<{$l}>{$y[0]}" ; else $y = $y = "{$z}<{$l} ".$this->fixTagAttributes($y[0]).">{$y[1]}" ; $t[$k] .= $y ; array_push ( $td , true ) ; -- 2.20.1