From cca68b88001b5b50dfbf0817224559abd3589760 Mon Sep 17 00:00:00 2001 From: Leo Koppelkamm Date: Fri, 15 Apr 2011 22:36:09 +0000 Subject: [PATCH] r85922: Fixing another table bordercase --- includes/parser/Parser.php | 5 +++-- tests/parser/parserTests.txt | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 822c966c74..28e1cda04d 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -846,7 +846,6 @@ class Parser { $table =& $this->last( $tables ); $table[0] = array(); // first row $currentRow =& $table[0]; - $table['indent'] = strlen( $matches[1] ); $attributes = $this->mStripState->unstripBoth( $matches[2] ); @@ -881,7 +880,7 @@ class Parser { } $o = ''; $curtable = array_pop( $tables ); - + #Add a line-ending before the table, but only if there isn't one already if ( substr( $out, -1 ) !== "\n" ) { $o .= "\n"; @@ -1052,6 +1051,7 @@ class Parser { // If we only have tbodies, mark table as simple for ( $i = 0; isset( $table[$i] ); $i++ ) { if ( !count( $table[$i] ) ) continue; + if ( !isset( $table[$i]['type'] ) ) $table[$i]['type'] = 'tbody'; if ( !$lastSection ) { $lastSection = $table[$i]['type']; } else if ( $lastSection != $table[$i]['type'] ) { @@ -1075,6 +1075,7 @@ class Parser { $return .= isset( $table[$i]['attributes'] ) ? $table[$i]['attributes'] : ''; $return .= '>'; for ( $j = 0; isset( $table[$i][$j] ); $j++ ) { + if ( !isset( $table[$i][$j]['type'] ) ) $table[$i][$j]['type'] = 'td'; $return .= "\n<" . $table[$i][$j]['type']; $return .= isset( $table[$i][$j]['attributes'] ) ? $table[$i][$j]['attributes'] : ''; $return .= '>'; diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 31cc66f59e..72208feeb8 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -1270,6 +1270,32 @@ Simple table !! end +!! test +Table inside unclosed table w/o cells +!! input +{| +{| +| foo bar +|} + +!! result + + + + +
+ + + + +
foo bar +
+


+

+
+ +!! end + !! test Table with thead !! input -- 2.20.1