public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* How to Assign Class to HTML Table using a Filter
@ 2019-01-30 14:50 Ken Dow
       [not found] ` <553f3670-7cb1-402f-9a92-89f3774d17c0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Ken Dow @ 2019-01-30 14:50 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1375 bytes --]

Hi,

I'd like to assign a class to every table in my HTML output. I've got PHP 
filters <https://github.com/glassdimly/pandocfilters-php> 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!

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/553f3670-7cb1-402f-9a92-89f3774d17c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 6526 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-01-31 19:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-30 14:50 How to Assign Class to HTML Table using a Filter Ken Dow
     [not found] ` <553f3670-7cb1-402f-9a92-89f3774d17c0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-01-30 19:06   ` John MacFarlane
     [not found]     ` <yh480kmunirmm8.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2019-01-30 21:53       ` Ken Dow
     [not found]         ` <b411caba-b372-4f99-aca5-36c5b614c91c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-01-31  0:37           ` John MacFarlane
2019-01-31  1:22             ` Ken
2019-01-31  5:10               ` John MacFarlane
     [not found]                 ` <m2k1ilxvhf.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2019-01-31 12:52                   ` Ken Dow
     [not found]                     ` <fdd9a7c1-f66f-4116-bbff-2ee91842c4a8-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-01-31 15:06                       ` John MacFarlane
     [not found]                         ` <m25zu4yigh.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2019-01-31 15:09                           ` John MacFarlane
     [not found]                             ` <m236p8yicd.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2019-01-31 16:49                               ` Ken Dow
     [not found]                                 ` <ae8d390d-1006-4c90-96ed-3f921f7a0dfa-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-01-31 19:08                                   ` John MacFarlane
     [not found]             ` <yh480kef8tr7aj.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2019-01-31  2:51               ` Ken Dow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).