From: Jens Frank Date: Wed, 4 Aug 2004 16:37:48 +0000 (+0000) Subject: Allow indentation of tables using :{| X-Git-Tag: 1.5.0alpha1~2520 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=40d9911ee1f57306d6ff4eeca776443f67b0ced0;p=lhc%2Fweb%2Fwiklou.git Allow indentation of tables using :{| Bug #989788. --- diff --git a/includes/Parser.php b/includes/Parser.php index 6ae7903a7e..745228c4a1 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -713,13 +713,17 @@ class Parser $ltd = array () ; # Was it TD or TH? $tr = array () ; # Is currently a tr tag open? $ltr = array () ; # tr attributes + $indent_level = 0; # indent level of the table foreach ( $t AS $k => $x ) { $x = trim ( $x ) ; $fc = substr ( $x , 0 , 1 ) ; - if ( '{|' == substr ( $x , 0 , 2 ) ) + if ( preg_match( '/^(:*)\{\|(.*)$/', $x, $matches ) ) { - $t[$k] = "\nfixTagAttributes ( substr ( $x , 2 ) ) . '>' ; + $indent_level = strlen( $matches[1] ); + $t[$k] = "\n" . + str_repeat( "
", $indent_level ) . + "
fixTagAttributes ( $matches[2] ) . '>' ; array_push ( $td , false ) ; array_push ( $ltd , '' ) ; array_push ( $tr , false ) ; @@ -733,7 +737,7 @@ class Parser if ( array_pop ( $tr ) ) $z = '' . $z ; if ( array_pop ( $td ) ) $z = "" . $z ; array_pop ( $ltr ) ; - $t[$k] = $z ; + $t[$k] = $z . str_repeat( "", $indent_level ); } else if ( '|-' == substr ( $x , 0 , 2 ) ) # Allows for |--------------- {