From e03b8b2edc322c2dcdfb3001d9f623fe828b149c Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Tue, 3 Nov 2009 14:05:56 +0100 Subject: Align an empty cell left instead of right darcs-hash:20091103130556-e4919-f9045f6018952f2b02a699d18746a330526a4dbe.gz --- inc/parser/handler.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'inc/parser/handler.php') diff --git a/inc/parser/handler.php b/inc/parser/handler.php index 9527fd710..43c9489fe 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -1320,12 +1320,18 @@ class Doku_Handler_Table { } else if ( $call[0] == 'table_align' ) { + $prev = in_array($this->tableCalls[$key-1][0], array('tablecell_open', 'tableheader_open')); + $next = in_array($this->tableCalls[$key+1][0], array('tablecell_close', 'tableheader_close')); + // If the cell is empty, align left + if ($prev && $next) { + $this->tableCalls[$key-1][1][1] = 'left'; + // If the previous element was a cell open, align right - if ( $this->tableCalls[$key-1][0] == 'tablecell_open' || $this->tableCalls[$key-1][0] == 'tableheader_open' ) { + } elseif ($prev) { $this->tableCalls[$key-1][1][1] = 'right'; - // If the next element if the close of an element, align either center or left - } else if ( $this->tableCalls[$key+1][0] == 'tablecell_close' || $this->tableCalls[$key+1][0] == 'tableheader_close' ) { + // If the next element is the close of an element, align either center or left + } elseif ( $next) { if ( $this->tableCalls[$lastCell][1][1] == 'right' ) { $this->tableCalls[$lastCell][1][1] = 'center'; } else { -- cgit v1.2.3