summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Lang <lang@cosmocode.de>2009-11-03 14:05:56 +0100
committerAdrian Lang <lang@cosmocode.de>2009-11-03 14:05:56 +0100
commite03b8b2edc322c2dcdfb3001d9f623fe828b149c (patch)
tree699a59b8b60317935f72ae656ff3bcd5169c9392
parentab24fc7f2b46da9840c7a6a441c67d433f32a28e (diff)
downloadrpg-e03b8b2edc322c2dcdfb3001d9f623fe828b149c.tar.gz
rpg-e03b8b2edc322c2dcdfb3001d9f623fe828b149c.tar.bz2
Align an empty cell left instead of right
darcs-hash:20091103130556-e4919-f9045f6018952f2b02a699d18746a330526a4dbe.gz
-rw-r--r--inc/parser/handler.php12
1 files changed, 9 insertions, 3 deletions
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 {