From: Ken Dow <thekenshow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: How to Assign Class to HTML Table using a Filter
Date: Wed, 30 Jan 2019 06:50:09 -0800 (PST) [thread overview]
Message-ID: <553f3670-7cb1-402f-9a92-89f3774d17c0@googlegroups.com> (raw)
[-- 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 --]
next reply other threads:[~2019-01-30 14:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-30 14:50 Ken Dow [this message]
[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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=553f3670-7cb1-402f-9a92-89f3774d17c0@googlegroups.com \
--to=thekenshow-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).