Skip to content
Snippets Groups Projects
Commit d6487039 authored by andi's avatar andi
Browse files

tablealign (#64) and addional break (#83)

darcs-hash:20050129193613-9977f-ef148b52b8323fe5dfe4d4290fe1eb172040b04e.gz
parent 93470c10
No related branches found
No related tags found
No related merge requests found
......@@ -251,6 +251,20 @@ As you can see, it's the cell separator before a cell which decides about the fo
Note: Vertical spans (rowspan) are not possible.
You can align the table contents, too. Just add at least two whitespaces at the opposite end of your text: Add two spaces on the left to align right, two spaces on the right to align left and two spaces at least at both ends for centered text.
^ Table with alignment ^^^
| right| center |left |
|left | right| center |
| xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |
This is how it looks in the source:
^ Table with alignment ^^^
| right| center |left |
|left | right| center |
| xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |
===== Nonparsed Blocks =====
You can include non parsed blocks into your documents by either indenting them by at least two spaces (like used for the previous examples) or by using the tags ''code'' or ''file''.
......
......@@ -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;
}
......
......@@ -197,19 +197,27 @@ table.inline {
border-collapse: collapse;
}
th.inline{
table.inline th {
padding: 3px;
border: 1px solid #000000;
border-bottom: 2px solid #000000;
text-align: left;
}
td.inline{
table.inline td {
padding: 3px;
border: 1px solid #000000;
}
.leftalign{
text-align: left;
}
.centeralign{
text-align: center;
}
.rightalign{
text-align: right;
}
.toc, .footerinc, .header, .bar, .user {display:none}
......@@ -445,19 +445,28 @@ table.inline {
border-collapse: collapse;
}
th.inline{
table.inline th {
padding: 3px;
border: 1px solid #8cacbb;
background-color: #dee7ec;
text-align: left;
}
td.inline{
table.inline td {
padding: 3px;
border: 1px solid #8cacbb;
}
.leftalign{
text-align: left;
}
.centeralign{
text-align: center;
}
.rightalign{
text-align: right;
}
/* ---------- table of contents ------------------- */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment