Just curious on how support for tables in the new markup language is going? The define list thing is nice, but I prefer my 'headers' at the top of the table, not the side. Also, it's more limited then the old system (no alignment for example).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was bored, so I wrote my own old-skool table markup as a plugin :) It's not perfect (I just learned to write plug-in's a couple hours ago) and it ignores any additional markup (I can't figure out the parsing system yet) but here it is incase anyone wants it...
class WikiPlugin_Table extends WikiPlugin
{
function getName()
{
return _('Table');
}
function getDescription()
{
return _('Generate an old-skool table');
}
Just curious on how support for tables in the new markup language is going? The define list thing is nice, but I prefer my 'headers' at the top of the table, not the side. Also, it's more limited then the old system (no alignment for example).
I was bored, so I wrote my own old-skool table markup as a plugin :) It's not perfect (I just learned to write plug-in's a couple hours ago) and it ignores any additional markup (I can't figure out the parsing system yet) but here it is incase anyone wants it...
class WikiPlugin_Table extends WikiPlugin
{
function getName()
{
return _('Table');
}
function getDescription()
{
return _('Generate an old-skool table');
}
function run($dbi, $argstr, $request)
{
$html = '<table border="1" cellpadding="1" cellspacing="1">';
$row = '';
$lines = explode("\n", $argstr);
foreach ($lines as $line)
{
$row .= '<tr>';
while (preg_match('/^(|+)(v*)([<>^]?)([^|]*)/', $line, $m))
{
$line = substr($line, strlen($m[0]));
if (strlen($m[1]) > 1)
{
$colspan = ' colspan="'.strlen($m[1]).'"';
} else {
$colspan = '';
}
if (strlen($m[2]) > 0)
{
$rowspan = ' rowspan="'.(strlen($m[2]) + 1).'"';
} else {
$rowspan = '';
}
if (strlen(trim($m[4])) < 1)
{
$m[4] = ' ';
}
switch ($m[3])
{
case '^':
{
$align = 'center';
break;
}
case '>':
{
$align = 'right';
break;
}
default:
case '<':
{
$align = 'left';
break;
}
}
$row .= '<td align="'.$align.'"'.$colspan.$rowspan.'>'
.trim($m[4])
.'</td>'
;
}
$row .= '</tr>';
}
$html .= $row.'</table>';
return HTML::raw($html);
}
}
BTW, just write your tables as before, but surrond them with the <?plugin Table ?> tag.