From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/21984 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Ken Dow Newsgroups: gmane.text.pandoc Subject: How to Assign Class to HTML Table using a Filter Date: Wed, 30 Jan 2019 06:50:09 -0800 (PST) Message-ID: <553f3670-7cb1-402f-9a92-89f3774d17c0@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2613_1426383608.1548859809533" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="30846"; mail-complaints-to="usenet@blaine.gmane.org" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBD7LJ7PVSXEJB62ECCRPHRXCAUNAJN7JN5JQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Jan 30 15:50:13 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-oi1-f186.google.com ([209.85.167.186]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1gorBs-0007gM-4z for gtp-pandoc-discuss@m.gmane.org; Wed, 30 Jan 2019 15:50:12 +0100 Original-Received: by mail-oi1-f186.google.com with SMTP id n196sf12527715oig.15 for ; Wed, 30 Jan 2019 06:50:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=pSH0c4PU5vX1NUSqy+PA2Dw8UFsyIhAAzvQrvgXg2Ho=; b=FjFE1eetqbBw34tHOTBoJlIJiIMIln1Efl2zhR5/Ob86TAprljznyqepd8tkLUPTsU mIE5qxxxXbUb1rx6v2Msjh5zaKLqr82EH9GC3QGcjt+xxSoYam3ZV3KBUf5SL5aEw7gn 7D+HQBN5skwXEoJCoXTbVrk0QHaHjbtITINoZgsV8gh1welrUDpXCOY2XOpJYXeeXWtO b9bImfti8nNZ/k6Fcxb/AqeOCs/2agXQAbc5OB23sxvnublRzPAiVEfgpYvay84AFbu9 buhzBIhUKoWqq3yLx6L760wJbArZb0WVJpmjHQPOrpa82ugl5SZPN7DVvJlQhZiK+Tb/ VKlg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:subject:mime-version:x-original-sender :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=pSH0c4PU5vX1NUSqy+PA2Dw8UFsyIhAAzvQrvgXg2Ho=; b=JZeMS3008stWDiszakFkrk1MLep09+9MggNrxpbt6xhMnHuQkdWwIE8nhLUtiVtC9J +ZTZ/qv0sSHpuClq4UJ3q/RVeGTF+NMyPeBvY2trZGGIdtPSnHbkz5qQv8kIciExnLHV Vr3NDWAgwGz48jt2ehZeWvE8B5C7wjhkpCBDk7mGlGYlNwPX6TwQyO88dqHEhbnbzt0t 9BJqBrhbxqRrEZlyVktSY5wu0amWOroNCROqyoSm+JOsJ+89Uue2hz5yGJ2hINdEaewG 4pSp7BJA74UP7xBrjGxo37I6QT0i982TD9+oH3TBKPDQNLGBrWmkSr8PY9wsTleU1X8p zXXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=pSH0c4PU5vX1NUSqy+PA2Dw8UFsyIhAAzvQrvgXg2Ho=; b=EDM39L8oTDJTGjMh3Kcbsdlma2U9r95XgcPRuGKxirAVAPt7gSRG8/vyK1i7K5yXW6 QIA7HEjI6T6zydTABiIYMEUTbLHmyZ3UKWp4xWvANMRbTCbrp9OhR3/Z7mg8C1C2p4TE PQEJLybnQO6keOYmZ/FMx5GZhh1UIDXeAsA8O2Zzr9zB/kVdQoRIWPcLzktj2LW9lfvE aa57P3quf00arFBqTgLatLQ+esYK2oc5gEi0PeWXk72RDJtDmOPVvnSJ4zIEd1Ey1jfG GCmjQNzPo2UMcDuOtka3+BehotGvydV06eFymbTo0up9Phyg7YmgQScBeyRNpkQUp2sN wWJg== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AHQUAuaJVZpB+pBnGJuDV2J44mH6iUlFsEI1h/XwNhpcl1BhZUwz7AZB n0eO3dXlTIXGOWJ+DhYS+ao= X-Google-Smtp-Source: AHgI3IaxWbnmNXz6pmgOqgHNRzKgn9YjGGdKQNXZoJqu5bdHDtJL2peajxKUd/XkjIqRzN/MZhE4zw== X-Received: by 2002:a9d:6f14:: with SMTP id n20mr147578otq.2.1548859810818; Wed, 30 Jan 2019 06:50:10 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a9d:32c8:: with SMTP id u66ls1041427otb.0.gmail; Wed, 30 Jan 2019 06:50:10 -0800 (PST) X-Received: by 2002:a9d:da3:: with SMTP id 32mr144758ots.3.1548859810073; Wed, 30 Jan 2019 06:50:10 -0800 (PST) X-Original-Sender: thekenshow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:21984 Archived-At: ------=_Part_2613_1426383608.1548859809533 Content-Type: multipart/alternative; boundary="----=_Part_2614_1124678588.1548859809534" ------=_Part_2614_1124678588.1548859809534 Content-Type: text/plain; charset="UTF-8" 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! -- 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. ------=_Part_2614_1124678588.1548859809534 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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) {
=C2=A0 =C2=A0
if ('Str' =3D=3D $type) {<= /span>
=C2=A0 = =C2=A0 =C2=A0 =C2=A0
// use mb_convert_case instead of ucwords so filter works with u= nicode
= =C2=A0 =C2=A0 =C2=A0 =C2=A0
return mb_convert_case($value, M= B_CASE_LOWER, "UTF-8"= ;);=
=C2=A0 =C2=A0=
}<= span style=3D"color: #000;" class=3D"styled-by-prettify">
=C2=A0 =C2=A0 =
if<= span style=3D"color: #000;" class=3D"styled-by-prettify">
('Table' =3D=3D $type) {=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 $attrs
=3D array('classes' =3D> = 9;table');
= =C2=A0 =C2=A0 =C2=A0 =C2=A0
// return ???
=C2=A0 =C2=A0
}
});

The 'Str' manipulati= on works as expected, and any code I put into the 'Table' section i= s executed, but I can't get started on how to proceed from there. Any p= ointers would be very welcome!

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@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.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_2614_1124678588.1548859809534-- ------=_Part_2613_1426383608.1548859809533--