diff options
author | andi <andi@splitbrain.org> | 2005-01-29 20:36:13 +0100 |
---|---|---|
committer | andi <andi@splitbrain.org> | 2005-01-29 20:36:13 +0100 |
commit | d648703944e713a7efeaf320ac57a0d1b41a353e (patch) | |
tree | 2d6e27564f0146aa54f57cc5ce4c6893ee34e093 /inc/parser.php | |
parent | 93470c105af0ae116dda52665e16c8eef839b887 (diff) | |
download | rpg-d648703944e713a7efeaf320ac57a0d1b41a353e.tar.gz rpg-d648703944e713a7efeaf320ac57a0d1b41a353e.tar.bz2 |
tablealign (#64) and addional break (#83)
darcs-hash:20050129193613-9977f-ef148b52b8323fe5dfe4d4290fe1eb172040b04e.gz
Diffstat (limited to 'inc/parser.php')
-rw-r--r-- | inc/parser.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/inc/parser.php b/inc/parser.php index f040d167e..73bbee765 100644 --- a/inc/parser.php +++ b/inc/parser.php @@ -596,6 +596,7 @@ function quoteformat($block){ * format inline tables * * @author Andreas Gohr <andi@splitbrain.org> + * @author Aaron Evans <aarone@klamathsystems.com> */ function tableformat($block) { $block = trim($block); @@ -630,7 +631,7 @@ function tableformat($block) { for ($c=0; $c < count($rows[$r]); $c++){ $cspan=1; - $data = trim($rows[$r][$c]['data']); + $data = $rows[$r][$c]['data']; $head = $rows[$r][$c]['head']; //join cells if next is empty @@ -644,15 +645,26 @@ function tableformat($block) { $cspan = ''; } + //determine alignment from whitespace + if (preg_match('/^\s\s/', $data)) { // right indentation + $td_class = "rightalign"; + if (preg_match('/\s\s$/', $data)) { // both left and right indentation + $td_class = "centeralign"; + } + } else { // left indentation (default) + $td_class = "leftalign"; + } + + $data = trim($data); if ($head) { - $ret .= " <th class=\"inline\" $cspan>$data</th>\n"; + $ret .= " <th class=\"$td_class\" $cspan>$data </th>\n"; // set css class for alignment } else { - $ret .= " <td class=\"inline\" $cspan>$data</td>\n"; + $ret .= " <td class=\"$td_class\" $cspan>$data </td>\n"; // set css class for alignment } } $ret .= " </tr>\n"; } - $ret .= "</table>\n<p>"; + $ret .= "</table><br />\n<p>"; return $ret; } |