Hi,
I'd like to assign a class to every table in my HTML output. I've got
PHP filters working but can't figure out how to manipulate the AST to do what I want.
Building on an example PHP filter, I have:
Pandoc_Filter::toJSONFilter(function ($type, $value, $format, $meta) {
if ('Str' == $type) {
// use mb_convert_case instead of ucwords so filter works with unicode
return mb_convert_case($value, MB_CASE_LOWER, "UTF-8");
}
if ('Table' == $type) {
$attrs = array('classes' => 'table');
// return ???
}
});
The 'Str' manipulation works as expected, and any code I put into the 'Table' section is executed, but I can't get started on how to proceed from there. Any pointers would be very welcome!