From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/18641 Path: news.gmane.org!.POSTED!not-for-mail From: Nizamudheen Ahmed Newsgroups: gmane.text.pandoc Subject: Re: Pandoc Python filter + Table constructor Date: Mon, 13 Nov 2017 11:38:04 +0530 Message-ID: References: <1be02d85-bd95-4709-82f8-f6a5460930c6@googlegroups.com> <20171104230532.GC97257@Johns-MacBook-Pro.local> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c11b0def27ff5055dd7170f" X-Trace: blaine.gmane.org 1510553285 15002 195.159.176.226 (13 Nov 2017 06:08:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 13 Nov 2017 06:08:05 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDG5REGGQMDRBRPNUTIAKGQE5KSM3QI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Nov 13 07:08:01 2017 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-oi0-f56.google.com ([209.85.218.56]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eE7uY-0003XW-QH for gtp-pandoc-discuss@m.gmane.org; Mon, 13 Nov 2017 07:07:59 +0100 Original-Received: by mail-oi0-f56.google.com with SMTP id 72sf3746162oik.6 for ; Sun, 12 Nov 2017 22:08:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1510553286; cv=pass; d=google.com; s=arc-20160816; b=RL8j2n/6K7O435FcuRi2IJOGPl83irdNzKb7axA5YN5TlZ5BJ2/QRiLmH5LBpy8QPW 82rNQnG97BGrPs8eXwMy+VkjMAYkaNKKQ92FJMf+YUnRi1WSUMqQ9Ag9vdW9sb8dN20T XAlecbmVm2DRBbBLZBq5MFqX/n+QUVngQQNu9m1zecPHpr5BXW5jnQG6RM1miGn5r21T nz8hHiZhKnjd7dXEdBeSgtCsvutSnqGaIaC4C8eB2AqLa1Tc20PT0bVARiNOJdpygu0U nAicKc1yGE3IdZ1c94vTYUMxqzHwtAhcQBWwuhlEr7FyQ46M6edFoMhr40U/+e/lyT+J JIWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date :from:references:in-reply-to:mime-version:arc-authentication-results :arc-message-signature:sender:dkim-signature:dkim-signature :arc-authentication-results; bh=viuGBH65vEs9pOJdDUSDH5tphX1rcveP3n6fQBuV4As=; b=GkdMAyje0dROHNPHvlcDvoMfvhYobu4mNochkOVosV/2RElb8RL9T4RaFh8HnfS0lM bv+h5pM9vdIW0o9PpVCnCV/Qkj807sDdKBCgPOJo9ZjpXB4Qyo5zw7gwoOaMh2ogaawh mDNJcmx+0O2T6gWPxSqzxkgQ4LD/dgPp++HAoSHQfZdrGKNkVgdrvVd56P1ml46LKt3L /jrudmOGX4vORpLKu0VSNKyXU9emBac8yS+HN74Osicf9GOjl3VhrSroVaClFx+v3FaG 0xFnfRQ7ClTYT48l2APtK1tJaJkz7bEVCiPHDNnSFn0q5I/zPFInbTTt3Apls0iMxI4U iofw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=os6DjDzw; spf=pass (google.com: domain of nizam.ahmed-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:400d:c0d::235 as permitted sender) smtp.mailfrom=nizam.ahmed-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:in-reply-to:references:from:date:message-id :subject:to:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=viuGBH65vEs9pOJdDUSDH5tphX1rcveP3n6fQBuV4As=; b=angEyyK5EA9qg73Um9+8TXXGIfEmvxN0aU4nYEa7J79WRN5vGneJLmN1mCpqRvSIR/ kuvPmyGWYbMb99MV/TOnwvOMcptPRYEP3RPNI6jl4GNViS274F5y9OQyKDeS5cMUKMU1 6WFd0pBgQlCfAglhlT+jpk9gQFkxNG3bfxLJ/lFnqgjMg7ULQCOjUyUutYtM97CYTJsO jVSe26S5ZlfFBBUXANMWxb2Hwv3mxYWAJILX16oiFJGEKfXguS9wFIkBJz4Lgy4fhovF gWNKF/UfoX3fsoPGxNho+OcUxV+D1Z8JqqVzCRg8qd7Bjbu2N5+WqyNkwGtKXtmFe1/u bNOw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=viuGBH65vEs9pOJdDUSDH5tphX1rcveP3n6fQBuV4As=; b=lbv/maepUuAkqYAfVWuUNZbzPPkpb88KftXn427vtOVrlfO6Vcf+BDYDC4XBgH6A0H kns6vBPgbBztAqOWsX41UofkYF5R7+hmiMl06CbLOjVV9E/A3hEniAUxFKUfR9+8eb+6 cYEQtaCDM4SohuMOZLK9Uv0Cutf+Ec4ahTkwb2xrTflSgtxyAXGmZHLIZSOBTOG2pJLl FOXbERJNSTTPt7agaxJl7qR3qbf18ypTbQTNpKMnC+c0p5FJIhxYq6hk7pwNQAggPnX2 aUHod0Cvy3ynxSvYOg+DTLBXVNGOWOuDiTG66+TN+r3BUN5xU7+BsA+W8MZCsyRnkhI2 EOyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:in-reply-to:references:from :date:message-id:subject:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=viuGBH65vEs9pOJdDUSDH5tphX1rcveP3n6fQBuV4As=; b=Z6zV83sW9Eiwu3PAQy1PTUIAf0m1+QrdZQlyvli8SSvlIiJICLhSuxyGENVi9XsHVC ysrGn6cZYY0dYOK0Wng1PqERizy9HrSKtjlnUkpIqoY4p52WL8esOwQlYty95+G8XUL4 WcTvJ80Go/VhS1xNvUT0MTdvNVyoRb6rvWKKis/ZV2ABgsGN6Xerrjsrw4EI6dnXtwAR AVtNJV4idsOCIAcD8IxmadIU5tYN+aJbneeX+IndjfweQmCv97+nSnEm6mll17hYHXt5 yMbxVN1e8G8ekIP9x8MJXXMaffq7rK36VMaZe4xhPP2odU6Q26IO6h1BE0lFpvKUEJqH RxSw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AJaThX6TA5ZZ1IIthVdcYVcHOw9kpiOwrjs3AfY2lal5DyuNjWO8OQAC E/Bx81MXTKF96r3f8UHz5Ss= X-Google-Smtp-Source: AGs4zMaOJX31zyO3eCF/sdx7RpDyLZHDsKI9DvOW0fti3Rd1q/fdTtrphS+xjBc2hwEeQf3cufudrw== X-Received: by 10.157.42.99 with SMTP id t90mr378563ota.5.1510553286117; Sun, 12 Nov 2017 22:08:06 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.202.199.140 with SMTP id x134ls8260109oif.14.gmail; Sun, 12 Nov 2017 22:08:05 -0800 (PST) X-Received: by 10.202.206.86 with SMTP id e83mr766608oig.5.1510553285160; Sun, 12 Nov 2017 22:08:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510553285; cv=none; d=google.com; s=arc-20160816; b=TC/ZLW9bJWx+jeBmmS3kXhAL2ATqViz7oGRdZmRjGwxO3GGIHZiX926jlq6WX8pLgj NtEcm+247M3oKzfooJ33bNDBe3ZWYQbZ1hVKisXIL92MKLIYxTAU6Ec6zOzYiLtzPV+I tRmjluCfXqJDtaAOG+PTHV6+bhEM2NFJEK2dU2yQ23GemasVmADsXc0PUs49L1l7TanQ 4T3NIudX7BuwTkfM7N6w9yasexMJSG9C14vF8TsA/PRVJ9VhcFOhe//9dFC8H4RJp9D5 BJ8lUju9yHApXPNe7eknc+pi3B/gM0+nj6a8wMvirt5ABbtey6f7V+a+1veuYWNDIYuY xTAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=Ev+3Tbgn7IHjHxtN5R6Ih82H2/lbf37M6SDKIhCT/i8=; b=AxAY3JOGFxj9vzLNkPP1uOJpQh/axM8McWxhsJ/Snp0kwvvrnSXnqavd5cchOhYEZy yKv7S77qL3jeZZyKbqQXwxeu1AOWC7W4ueeB8RCrhRN4JG7wu0z6PTBpoEwXAFR227Dy IVorV36dZ65RS7Pxi9L1H7u4bxSGpulcJjkf0nECWHNOSKuXh9ZCQ3xmthj1QdDnrNZS nNJvCudJZdL/pJwcGlvPThkqCW60GiaZnhsqVdmYcmZMH9I0SNMgw89DfgkvDM5OkntZ 1RwglMOHILErlM5ppAW1FYcn5Iyg1krRSZQkDqueplr/amz0XknfWGOKX7mkPdfXEsOe Kp4Q== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=os6DjDzw; spf=pass (google.com: domain of nizam.ahmed-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:400d:c0d::235 as permitted sender) smtp.mailfrom=nizam.ahmed-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Original-Received: from mail-qt0-x235.google.com (mail-qt0-x235.google.com. [2607:f8b0:400d:c0d::235]) by gmr-mx.google.com with ESMTPS id t9si1229139ote.1.2017.11.12.22.08.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Nov 2017 22:08:05 -0800 (PST) Received-SPF: pass (google.com: domain of nizam.ahmed-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:400d:c0d::235 as permitted sender) client-ip=2607:f8b0:400d:c0d::235; Original-Received: by mail-qt0-x235.google.com with SMTP id e19so13450152qte.8 for ; Sun, 12 Nov 2017 22:08:05 -0800 (PST) X-Received: by 10.200.22.12 with SMTP id p12mr11860499qtj.142.1510553284671; Sun, 12 Nov 2017 22:08:04 -0800 (PST) Original-Received: by 10.140.30.202 with HTTP; Sun, 12 Nov 2017 22:08:04 -0800 (PST) In-Reply-To: X-Original-Sender: nizam.ahmed-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=os6DjDzw; spf=pass (google.com: domain of nizam.ahmed-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:400d:c0d::235 as permitted sender) smtp.mailfrom=nizam.ahmed-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com 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:18641 Archived-At: --94eb2c11b0def27ff5055dd7170f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks Kolen. I will take your suggestion forward, and keep you posted. On Mon, Nov 6, 2017 at 4:33 PM, Kolen Cheung wrote: > Interesting. I think panflute would be a good fit. Try reading the > panflute documentation first. There=E2=80=99s an example on csv table tha= t can show > you how to manipulate table elements. You can also checkout the source of > pantable.py, which is inspired by the csv example, and is more > sophisticated. Other examples in the panflute documentation also shows yo= u > how to capture a certain elements (possibly with attributes) in general. > > When writing a filter, sometimes it is useful to see the AST of a MWE. > Pandoc has the native and json output, while the filters see the JSON, th= e > native is more readable. panflute also has a helper script (I think in th= e > panflute filters repo) that can print the =E2=80=9Cpanflute AST=E2=80=9D,= which will even > be more useful if you use panflute. (panflute basically parses pandoc=E2= =80=99s AST > into its own using OOP, or in other words, a representation of pandoc=E2= =80=99s AST > using Python objects.) > > -- > You received this message because you are subscribed to a topic in the > Google Groups "pandoc-discuss" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/pandoc-discuss/OBlbFj5HJ9I/unsubscribe. > To unsubscribe from this group and all its topics, 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/ae54a6c7-f694-4337-87d6-15178ab3f18d% > 40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > --=20 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 e= mail 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/CA%2BzEWHBcdnzHekVNY3Tdi4qZCkwbgqt4PWAQKYXOzyXmHtAn2Q%40mail= .gmail.com. For more options, visit https://groups.google.com/d/optout. --94eb2c11b0def27ff5055dd7170f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks Kolen. I will take your suggestion forward, and kee= p you posted.



On Mon, Nov 6, 2017 at 4:33 PM, Kolen Cheun= g <christian.kolen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Interesting. I think panflute would be a good fit. Try r= eading the panflute documentation first. There=E2=80=99s an example on csv = table that can show you how to manipulate table elements. You can also chec= kout the source of pantable.py, which is inspired by the csv example, and i= s more sophisticated. Other examples in the panflute documentation also sho= ws you how to capture a certain elements (possibly with attributes) in gene= ral.

When writing a filter, sometimes it is useful to see the AST of a MWE. Pand= oc has the native and json output, while the filters see the JSON, the nati= ve is more readable. panflute also has a helper script (I think in the panf= lute filters repo) that can print the =E2=80=9Cpanflute AST=E2=80=9D, which= will even be more useful if you use panflute. (panflute basically parses p= andoc=E2=80=99s AST into its own using OOP, or in other words, a representa= tion of pandoc=E2=80=99s AST using Python objects.)

--
You received this message because you are subscribed to a topic in the Goog= le Groups "pandoc-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pandoc-discuss/OBlb= Fj5HJ9I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pandoc-discuss+un= subscribe@googlegroups.com.
To post to this group, send email to pandoc-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.c= om/d/msgid/pandoc-discuss/ae54a6c7-f694-4337-87d6-15178ab3f18d%40googlegroups.com.
For more options, visit ht= tps://groups.google.com/d/optout.

--
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://group= s.google.com/d/msgid/pandoc-discuss/CA%2BzEWHBcdnzHekVNY3Tdi4qZCkwbgqt4PWAQ= KYXOzyXmHtAn2Q%40mail.gmail.com.
For more options, visit http= s://groups.google.com/d/optout.
--94eb2c11b0def27ff5055dd7170f--