From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/16014 Path: news.gmane.org!.POSTED!not-for-mail From: Melroch Newsgroups: gmane.text.pandoc Subject: Re: Markdown, tables and CSV Date: Mon, 14 Nov 2016 15:38:43 +0100 Message-ID: References: <047d7b86ebe83c062b05332eab9b@google.com> <20BF19CB-A2B0-4B19-A749-D750CDD89736@martinfenner.org> <14b8fa54-dc04-4874-bf47-fb268fc9f298@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113fb24cfce0d2054143cbf8 X-Trace: blaine.gmane.org 1479134342 1564 195.159.176.226 (14 Nov 2016 14:39:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 14 Nov 2016 14:39:02 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCWMVYEK54FRB5MYU7AQKGQEP3ZGLAA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Nov 14 15:38:57 2016 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-wm0-f57.google.com ([74.125.82.57]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c6IPD-0006Pm-9l for gtp-pandoc-discuss@m.gmane.org; Mon, 14 Nov 2016 15:38:43 +0100 Original-Received: by mail-wm0-f57.google.com with SMTP id t79sf6460256wmt.0 for ; Mon, 14 Nov 2016 06:38:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; 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:x-spam-checked-in-group :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=fLg6rUr0RT/sGdiYOyVHvjIE+CYq9RyXqu682ih7pVk=; b=MXmudce0TpGdg2DvLSHAgPLHJ5V/uomtX+JjziAtkHE8B8u701AJgm8j9Dwi2USbdg /o+teJqd5vZEJjycCBduQxHAuO/0fOw9OjbPRRHvw9hNqYLQr1gCJpaTOR2WaW3mvMt/ FzcSDMwmgQGckZw57UWEzszn3K636Jj+uIQtns/BjLVwX/6j7aXGJIVG0r57aS009W0c jSZ+UtDQRHGgfm11ZitjCuVbbCmSuZ1IQzXpuU4nJYIyI+Sii+4i6PQqxYG5crSJB32o K2EhvTePnZ//6q9a3VWRO9LoPIaDI88w92sk8CH4IOkyB/+OsAu6S/nsnzgnM3Px+oML x/Iw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; 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:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=fLg6rUr0RT/sGdiYOyVHvjIE+CYq9RyXqu682ih7pVk=; b=kvnkJJPr5zRUftGW3s51FWJjf2bdWTivHojR69zgKWrWxLH4A+XsPUg0+HqG1MlUKg cpkTG6Ph2+bmomGyTvpuQ4+sEPAfDKqs9ngNUCyQzWlT6LaigUz7Co+dcYI8dg2B4jga VQ0knO9jeyaPcMhc3fSWvWJvPDrMvVyx2GfwPLq4x63KaFh5WmqfXBqArOvswNpWFU4B 3gqKUcS257AVfXByRWbig5+dVwLXWWnsYBlkENQ0EsKlUEykT0GgslMKH9JghaMbGR76 Po6Ujukrr4U3hzNUcuBd4anVwyLbpgirDNuXaXjECv6zO0gQfWnp4QZBEfQWKpFI80fj u1tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; 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=fLg6rUr0RT/sGdiYOyVHvjIE+CYq9RyXqu682ih7pVk=; b=imEXqw9SqA7dZSjXQyg+asRCtqYdyhKfDAN/I9O56jQEZPXEWUkEy7k/aK8M1pxIJi KpMnt8lP5UlG+HPqqe6M/aVqXyB8RO8on/fxBhNqfAXIqDUeNiDsRV8Dk+amnpxeJmzo mDDNOMxIoSM9G1C+/k4paxicUhIiuc5s/Ocujlg36tLVcbvTVV9Z+bXXzSOYDCKLMwFJ wTRp2F5hh8mQZqBfLNyN2xhHqIcUntuXsUPJ/vUM+26R1R/a3COtfkYXawA9hIoi8fvv thMdE65eFijpsCspwnauuzWiZAW8zx1iGOzeZHRfJ5N3KsDp7vJwi74/TKqhnj+KejV6 JzRA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ABUngvcta8nERVWyG5KbFMepEHIhN0BhVIo6MhPtJgCoCs5rY1JiapeEKUwUnjD1LLQZ8A== X-Received: by 10.25.23.201 with SMTP id 70mr175848lfx.9.1479134326807; Mon, 14 Nov 2016 06:38:46 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.25.18.68 with SMTP id h65ls595319lfi.46.gmail; Mon, 14 Nov 2016 06:38:45 -0800 (PST) X-Received: by 10.25.215.85 with SMTP id o82mr2296014lfg.30.1479134325340; Mon, 14 Nov 2016 06:38:45 -0800 (PST) Original-Received: from mail-lf0-x244.google.com (mail-lf0-x244.google.com. [2a00:1450:4010:c07::244]) by gmr-mx.google.com with ESMTPS id l19si213381wmg.0.2016.11.14.06.38.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Nov 2016 06:38:45 -0800 (PST) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4010:c07::244 as permitted sender) client-ip=2a00:1450:4010:c07::244; Original-Received: by mail-lf0-x244.google.com with SMTP id p100so7208756lfg.2 for ; Mon, 14 Nov 2016 06:38:45 -0800 (PST) X-Received: by 10.25.137.87 with SMTP id l84mr9295003lfd.144.1479134324513; Mon, 14 Nov 2016 06:38:44 -0800 (PST) Original-Received: by 10.114.27.71 with HTTP; Mon, 14 Nov 2016 06:38:43 -0800 (PST) Original-Received: by 10.114.27.71 with HTTP; Mon, 14 Nov 2016 06:38:43 -0800 (PST) In-Reply-To: <14b8fa54-dc04-4874-bf47-fb268fc9f298-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4010:c07::244 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=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:16014 Archived-At: --001a113fb24cfce0d2054143cbf8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable One possible problem with including metadata as YAML is that it may become harder for filters earlier in the chain to query the metadata or inject a CSV block using the normal attribute interface, if any, of the filter engine, not to mention parsing the CSV, query or alter it and write it back. For that reason I think it be better if the content of the code block is the pure CSV data. FWIW I tried both strategies with my unpublished filters, so I'm not just speculating. Also since there are many filters doing the same thing the identifying class should better not be just `csv` but also identify the filter expected to handle the data. Den 14 nov 2016 08:41 skrev "Kolen Cheung" : > <#m_-2424333709963600538_>Yet Another Pandoc Filters on CSV Tables > > For those who are interested in using CSV tables in pandoc markdown, I=E2= =80=99m > writing a filter that build upon one of panflute=E2=80=99s example. And I= =E2=80=99m still > thinking about which exact syntax to use. Feel free to give suggestions. > <#m_-2424333709963600538_>Features > > What separate this to existing filters is the automatic calculation of th= e > column-width (in contrast with pandoc-placetable) and write to pandoc AST > directly (in contrast with pandoc-csv2table), as well as specifying the > table width (a ratio to the line-width). And comparing with the 2 said > filters, panflute=E2=80=99s example use YAML to store data, rather than t= he > attributes of the code-block (which I think is more natural for data). > > There=E2=80=99s a notebook in ickc/pandoc-table-csv-test/panflute-csv2tab= le.ipynb > > and the the filter is at ickc/pandoc-table-csv-test/csv-tables.py > > . > > The current syntax is this (borrow much from panflute=E2=80=99s example, = and the > csv is borrowed from pandoc-csv2table): > > ~~~csv > title: "*Great* Title" > has-header: False > column-width: > - 0.1 > - 0.2 > - 0.3 > - 0.4 > table-width: 0.8 > alignment: LRCmarkdown: True > --- > 1,2,3,4 > ~~~ > > <#m_-2424333709963600538_>A Comparison of Metadata Keys Between Pandoc > Filters on CSV Tables > > My biggest questions is which metadata keys to use. > Backward-compatibility-wise, since pandoc-csv2table and pandoc-placetable > use attributes to store metadata, while panflute=E2=80=99s example and mi= ne use > YAML to store, the only one I need to consider backward-compatibility is > panflute=E2=80=99s. But I actually think pandoc-csv2table/placetable=E2= =80=99s keys make > more sense. e.g. header vs has-header, caption vs title. > > And for alignment, pandoc-csv2table/placetable use aligns. For width, > placetable use widths. I=E2=80=99m not sure if I should follow them. > > A comparison of the keys: (The output is generated by my filter) > > +--------+----------------------------+-------------------+--------------= ------+--------------------------+ > | | pandoc-csv2table | pandoc-placetable | panflute exam= ple | my proposal | > +=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D+ > | type | type=3Dsimple|multiline|grid | | = | | > | | |pipe | | = | | > +--------+----------------------------+-------------------+--------------= ------+--------------------------+ > | header | header=3Dyes|no | header=3Dyes|no | has-heade= r: | header: True|False | > | | | | True|False = | | > +--------+----------------------------+-------------------+--------------= ------+--------------------------+ > | captio | caption | caption | title = | caption | > | n | | | = | | > +--------+----------------------------+-------------------+--------------= ------+--------------------------+ > | source | source | file | source = | source | > +--------+----------------------------+-------------------+--------------= ------+--------------------------+ > | aligns | aligns=3DLRCD | aligns=3DLRCD | = | alignment: LRCD | > +--------+----------------------------+-------------------+--------------= ------+--------------------------+ > | width | | widths=3D"0.5 0.2 | = | column-width: \[0.5, | > | | | 0.3" | = | 0.2, 0.3\] | > +--------+----------------------------+-------------------+--------------= ------+--------------------------+ > | | | inlinemarkdown | = | markdown: True|False | > +--------+----------------------------+-------------------+--------------= ------+--------------------------+ > | | | delimiter | = | | > +--------+----------------------------+-------------------+--------------= ------+--------------------------+ > | | | quotechar | = | | > +--------+----------------------------+-------------------+--------------= ------+--------------------------+ > | | | id (wrapped by | = | | > | | | div) | = | | > +--------+----------------------------+-------------------+--------------= ------+--------------------------+ > > =E2=80=8B > > -- > 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/14b8fa54-dc04-4874-bf47-fb268fc9f298% > 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/CADAJKhBcAxdQxytFdiug2iqxL%2BVxwECtWD-nMH4qPcfUUZUzUA%40mail= .gmail.com. For more options, visit https://groups.google.com/d/optout. --001a113fb24cfce0d2054143cbf8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

One possible problem with including metadata as YAML is that= it may become harder for filters earlier in the chain to query the metadat= a or inject a CSV block using the normal attribute interface, if any, of th= e filter engine, not to mention parsing the CSV, query or alter it and writ= e it back. For that reason I think it be better if the content of the code = block is the pure CSV data. FWIW I tried both strategies with my unpublishe= d filters, so I'm not just speculating.

Also since there are many filters doing the same thing the i= dentifying class should better not be just `csv` but also identify the filt= er expected to handle the data.


Den 14 nov 2016 0= 8:41 skrev "Kolen Cheung" <christian.kolen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:

Yet Another Pandoc Filters on CSV Tables

For those who are interested in= using CSV tables in pandoc markdown, I=E2=80=99m writing a filter that bui= ld upon one of panflute=E2=80=99s example. And I=E2=80=99m still thinking a= bout which exact syntax to use. Feel free to give suggestions.

Features

What separate this to existing = filters is the automatic calculation of the column-width (in contrast with = pandoc-placetable) and write to pandoc AST directly (in contrast with pando= c-csv2table), as well as specifying the table width (a ratio to the line-wi= dth). And comparing with the 2 said filters, panflute=E2=80=99s example use= YAML to store data, rather than the attributes of the code-block (which I = think is more natural for data).

There=E2=80=99s a notebook in <= a href=3D"https://github.com/ickc/pandoc-table-csv-test/blob/master/ipynb/p= anflute-csv2table.ipynb" target=3D"_blank">ickc/pandoc-table-csv-test/= panflute-csv2table.ipynb and the the filter is at ickc/pandoc-table-csv-test/csv-tables.py.

The current syntax is this (bor= row much from panflute=E2=80=99s example, and the csv is borrowed from pand= oc-csv2table):

~~~csv
title: "*Great* Title"
has-header: False
column-width:
  - 0.1
  - 0.2
  - 0.3
  - 0.4
table-width: 0.8
alignment: LRC
markdown: True
---
1,2,3,4
~~~

A Comparison of Metadata Keys Between Pandoc Filters on CSV Tables

My biggest questions is which m= etadata keys to use. Backward-compatibility-wise, since pandoc-csv2table an= d pandoc-placetable use attributes to store metadata, while panflute=E2=80= =99s example and mine use YAML to store, the only one I need to consider ba= ckward-compatibility is panflute=E2=80=99s. But I actually think pandoc-csv= 2table/placetable=E2=80=99s keys make more sense. e.g. header vs has-header, caption<= /code> vs title.

And for alignment, pandoc-csv2t= able/placetable use aligns. For width, placetable use widths. I=E2=80=99m n= ot sure if I should follow them.

A comparison of the keys: (The = output is generated by my filter)

+--------+----------------------------+--=
-----------------+--------------------+--------------------------=
+
|        | pandoc-csv2table           | pandoc-placetable | panflute exampl=
e   | my proposal              |
+=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D+
| type   | type=3Dsimple|multiline|grid |                   |              =
      |                          |
|        | |pipe                      |                   |                =
    |                          |
+--------+----------------------------+-------------------+------=
--------------+--------------------------+
| header | header=3Dyes|no              | header=3Dyes|no     | has-header:=
        | header: True|False       |
|        |                            |                   | True|False     =
    |                          |
+--------+----------------------------+-------------------+------=
--------------+--------------------------+
| captio | caption                    | caption           | title          =
    | caption                  |
| n      |                            |                   |                =
    |                          |
+--------+----------------------------+-------------------+------=
--------------+--------------------------+
| source | source                     | file              | source         =
    | source                   |
+--------+----------------------------+-------------------+------=
--------------+--------------------------+
| aligns | aligns=3DLRCD                | aligns=3DLRCD       |            =
        | alignment: LRCD          |
+--------+----------------------------+-------------------+------=
--------------+--------------------------+
| width  |                            | widths=3D"0.5 0.2   |         =
           | column-width: \[0.5,     |
|        |                            | 0.3"              |           =
         | 0.2, 0.3\]               |
+--------+----------------------------+-------------------+------=
--------------+--------------------------+
|        |                            | inlinemarkdown    |                =
    | markdown: True|False     |
+--------+----------------------------+-------------------+------=
--------------+--------------------------+
|        |                            | delimiter         |                =
    |                          |
+--------+----------------------------+-------------------+------=
--------------+--------------------------+
|        |                            | quotechar         |                =
    |                          |
+--------+----------------------------+-------------------+------=
--------------+--------------------------+
|        |                            | id (wrapped by    |                =
    |                          |
|        |                            | div)              |                =
    |                          |
+--------+----------------------------+-------------------+------=
--------------+--------------------------+
=E2=80=8B

--
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 pandoc-discuss+unsubscribe@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.com/d/msgid/pandoc-discuss/14b8fa54-dc04-4874-bf4= 7-fb268fc9f298%40googlegroups.com.
For more options, visit https://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/CADAJKhBcAxdQxytFdiug2iqxL%2BVxwECtWD-n= MH4qPcfUUZUzUA%40mail.gmail.com.
For more options, visit http= s://groups.google.com/d/optout.
--001a113fb24cfce0d2054143cbf8--