From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/15003 Path: news.gmane.org!not-for-mail From: Sergio Correia Newsgroups: gmane.text.pandoc Subject: Re: Markdown, tables and CSV Date: Wed, 25 May 2016 22:42:50 -0700 (PDT) Message-ID: References: <047d7b86ebe83c062b05332eab9b@google.com> <20BF19CB-A2B0-4B19-A749-D750CDD89736@martinfenner.org> <1463766905.1918988.613990665.6CD67781@webmail.messagingengine.com> <471daa3c-e2ec-4445-b4fd-44e5c8a3fd6b@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_436_1617991770.1464241370397" X-Trace: ger.gmane.org 1464241379 10174 80.91.229.3 (26 May 2016 05:42:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 26 May 2016 05:42:59 +0000 (UTC) To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCOYT6WP5QGRBW4ZTK5AKGQEPD4IBWA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu May 26 07:42:52 2016 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-qg0-f62.google.com ([209.85.192.62]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b5o4K-00059K-H1 for gtp-pandoc-discuss@m.gmane.org; Thu, 26 May 2016 07:42:52 +0200 Original-Received: by mail-qg0-f62.google.com with SMTP id e35sf14317340qge.0 for ; Wed, 25 May 2016 22:42:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=sender:date:from:to:message-id:in-reply-to:references: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=ff09BsMn94bCzDFmTPQadxR5ptM3buKP3BgkZLAGCHo=; b=ON/qIA63UVP++MjngFIGNyMXGkbbt4MOLUQ+3IuDMnzwzAE53UJVs23zZpI5w3NBVk 6/LdE+9YhDZvC6ewk3wYSobJtiYAW0em45Bk/HVIGAS8/GKIupWaRwBgDUazOiuSjqc2 D7lpicwkXh5kl4yLi9hpV90VrKY/NcJy68ktGb9PnpEXTR2OnADJixEPD1nSibjTjbCB 3Lmjc9RCbbW6DbUpXDlKJr4l9bNkQ++0035bNC7l+uFWgTQ0IvyOKwHntPVtAq/dauOe rNDSN9310GLtdSMPpEn9a6y4XipuBa0J1xvZPdSfjhGNpymWAyThbnZaPuAgNC3BXCN5 uVtg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:in-reply-to:references: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=ff09BsMn94bCzDFmTPQadxR5ptM3buKP3BgkZLAGCHo=; b=EaXSggMvKmU8TpCUxWltUZV/2NZbBVxma9fGbaP4+LuNZofJ+yVQDb+/m0FUBSqPc9 J3gonQ5+0w+gB7nC4LQqzDdKvICC8n3owRmoYkwIv2LVXGQwG8SuUJQsLFM3M8lNavH4 DNzeH4fCCylRuAe+jGgk9+517Zx7qLPxWHydAf6btQdLT4g5+4p3qF4NDXLWDnZv5iux wXf1YoFmhCfd40TcSMBWa3YKC3rE0hd3fAVTlzAdOIgpGsMK10Hidrcv1xwl/wjz9McS 4sxwbvMlbfVbhf1Lpzc6IRL595nLV8yRdiVd8+COKEheWwJl8oK6A1CF+SH4InQnTnQg 5leA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references: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=ff09BsMn94bCzDFmTPQadxR5ptM3buKP3BgkZLAGCHo=; b=gI9OAFvRWbWowWKZ2A7XQiJ6L7V/Gm23k+f3lksJaGLN7wTuvuXh69alIchELG2mAp 74oguywcfledNdrz+0oPDiVjUOPZQ0Hiu6wbCp2zXsuaSnpvGFfk6yfJ2glD3KcA/8g9 shuEqZEeBCtep9b5EFi1vg93iDxjEOXETqJmwNRI8nwvmF/mXATlxUYzp/UTo7ct6Mmq L5c3Tr889zytKWfNySKIl7zrK3kXdpu9jX+lWa4mjk89969KYQCafkIaqwZ/0iUqqV6P q75llIve5qWYLTiE80LXwgEZROwjISO+0XKc/s+uY+HfpgMxL5+yPHfiyaWU9C3F1SLg e7xA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ALyK8tIq4PIWfcZdEgHQlciIO42c25ipUUX+rgQ00qbdqVNp7jWpGV3ix+2EI/JyL/jjXg== X-Received: by 10.157.3.195 with SMTP id f61mr118802otf.1.1464241371616; Wed, 25 May 2016 22:42:51 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.157.8.180 with SMTP id 49ls620817otf.51.gmail; Wed, 25 May 2016 22:42:50 -0700 (PDT) X-Received: by 10.157.10.23 with SMTP id 23mr119013otg.12.1464241370807; Wed, 25 May 2016 22:42:50 -0700 (PDT) In-Reply-To: <471daa3c-e2ec-4445-b4fd-44e5c8a3fd6b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: sergio.correia-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-Spam-Checked-In-Group: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:15003 Archived-At: ------=_Part_436_1617991770.1464241370397 Content-Type: multipart/alternative; boundary="----=_Part_437_1036855705.1464241370397" ------=_Part_437_1036855705.1464241370397 Content-Type: text/plain; charset=UTF-8 A bit late to the party, but: 1) An alternative to using extensions to indicate the required action would be to use protocols. For instance, this example pandoc filter: http://scorreia.com/software/panflute/guide.html#calling-external-programs Thus, you can do [Caption of the Table](csv://some/path.csv) Or maybe [some/path.md](include://) 2) For tables, I would also suggest to take a look at this filter: http://scorreia.com/software/panflute/guide.html#yaml-code-blocks It allows markdown like this: Some text ~~~ csv title: Some Title has-header: True --- Col1, Col2, Col3 1, 2, 3 10, 20, 30 ~~~ More text This combines pure CSV with options set up in YAML, so you can add captions and customize the table. Since the CSV is handled by python's CSV library, it is quite powerful. Also, complex things like selecting a subset of rows/cols, or adding format, could be done in 1-2 lines of code. If you are interested, shoot me an email and I can add a more complex working example. Cheers, S On Wednesday, May 25, 2016 at 7:18:10 AM UTC-7, Frank Colcord wrote: > > I'd like to second this proposal. As a simple Pandoc user, these would be > very helpful: > > > ![an image](foo.jpg) > > ![an include](foo.txt) > > ![a csv to be rendered as a table](foo.csv) > > thanks for all the development. > > Frank > > On Friday, May 20, 2016 at 6:55:10 PM UTC+1, jgabriele wrote: >> >> Hi Martin, >> >> There's also [issue 553](https://github.com/jgm/pandoc/issues/553 >> >> ). >> >> Personally, I think I like (from that issue thread) anton-k's original >> idea: >> >> ![an image](foo.jpg) >> >> ![an include](foo.txt) >> >> ![a csv to be rendered as a table](foo.csv) >> >> (that is, based on filename extension) >> >> Those seem sensible, symmetrical, easy to remember, and I think fit well >> with what pandoc already does (`![]()` is already like an include). >> >> As for a syntax to allow writing your csv data right into your md file, >> ... Pandoc already supports a generous number of table formats that are >> pretty easy to type. And for larger tables that you might be tempted to >> copy/paste in, might be better easier to bang-include them (as in, >> `![]()`), rather than muck up your pretty markdown file with a giant bunch >> of csv data. :) >> >> -- John >> >> >> >> >> On Fri, May 20, 2016, at 05:38 AM, Martin Fenner wrote: >> >> Dear group, >> >> The topic of CSV support in Pandoc has come up several times on this >> list, includes this thread from 2014: >> https://groups.google.com/forum/#!topic/pandoc-discuss/kBdJU_JktzI >> >> Since last year I work for an organisation that frequently deals with >> tabular data (and helped organize CSVconf earlier this month), and I have >> done some thinking on how CSV could fit into Pandoc. I see two important >> use cases: >> >> * CSV reader that converts to tables in HTML, docx, latex, etc. >> * CSV has a format to describe tables in markdown >> >> For the first use case I wrote a hack for the Jekyll blogging platform >> this week that turns CSV files into markdown grid tables format that is >> then processed by Pandoc (https://github.com/datacite/jekyll-csvy). I >> would rather use Pandoc with a CSV reader, but my Haskell isn't good enough >> to write one. But for now I can generate blog posts directly from CSV >> files. Other people have done similar things with Pandoc and CSV. >> >> For the second use case I see a clear advantage of CSV over the various >> attempts to format tables in markdown (simple_tables, multiline_tables, >> grid_tables, pipe_tables). Everyone (and many tools) understands the CSV >> format, and you can do most of the things with CSV that the other table >> formats allow (multi-column formats and column alignment are a bit >> trickier). This has been done before using Pandoc filters, but I think a >> Pandoc "csv_tables" Pandoc extension would make this easier for the casual >> user. Using the grid_tables example from the Pandoc documentation, this >> could look like this: >> >> : Sample csv table. >> >> ,,, >> Fruit,Price,Advantages >> Bananas,$1.34,- built-in wrapper\n- bright color >> Oranges,$2.10, - cures scurvy\n- tasty >> ,,, >> >> I like three commas on a new line to indicate the start and end of a >> table, but that is of course open for discussion. The format is much easier >> to read and edit for humans compared to grid tables, the only tricky bit is >> maybe the \n for multiline columns. I would think we could add metadata to >> the fenced table blog similar to code blocks, e.g. >> >> ,,,{ #mytable .numberRows } >> >> One challenge with CSV is that it is an ill-defined format somewhat >> similar to markdown before CommonMark. It may make things easier to only >> support a specific CSV variant (e.g. comma as separator, header required, >> comment lines not allowed). >> >> Thoughts? >> >> Best, >> >> Martin >> >> >> >> >> >> -- >> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/20BF19CB-A2B0-4B19-A749-D750CDD89736%40martinfenner.org >> >> . >> For more options, visit https://groups.google.com/d/optout. >> >> >> > -- 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/b9147aed-bf8e-4136-8fd2-949dea1034ea%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_437_1036855705.1464241370397 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
A bit late to the party, but:

1) An alt= ernative to using extensions to indicate the required action would be to us= e protocols.
For instance, this example pandoc filter:

http://scorreia.com/software/panflute/guide.html#calling-external-= programs

Thus, you can do

[Caption of the Table](csv://some/path.csv)

O= r maybe

[some/path.md](include://)
<= /div>



2) For tables, I wou= ld also suggest to take a look at this filter:

htt= p://scorreia.com/software/panflute/guide.html#yaml-code-blocks

It allows markdown like this:
Some text

~~~ csv
title: Some Title
has-header: True
---
Col1, Col2, Col3
1, 2, 3
10, 20, 30
~~~

More text

This combines pure CSV with option= s set up in YAML, so you can add captions and customize the table.

Since the CSV is handled by python's CSV library, it i= s quite powerful. Also, complex things like selecting a subset of rows/cols= , or adding format, could be done in 1-2 lines of code. If you are interest= ed, shoot me an email and I can add a more complex working example.

Cheers,
S


On Wednesday, May 25, 2016 at 7:18:10 AM UTC-7, Frank Colcord wrote:
I'd like to s= econd this proposal. As a simple Pandoc user, these would be very helpful:<= div>
=C2=A0
=C2=A0=C2=A0=C2=A0 ![an image](foo.jpg)
=C2=A0
= =C2=A0=C2=A0=C2=A0 ![an include](foo.txt)
=C2=A0
=C2=A0=C2=A0=C2=A0 ![= a csv to be rendered as a table](foo.csv)
=C2=A0
thanks for all th= e development.

Frank

On Friday, May 20, 2016 at 6:55:10 PM= UTC+1, jgabriele wrote:
Hi Martin,
=C2=A0
=C2=A0
Personally, I think I like (from that issu= e thread) anton-k's original idea:
=C2=A0
=C2=A0=C2=A0=C2=A0 ![an image](foo.jpg)
=C2=A0
=C2=A0=C2=A0=C2=A0 ![an include](foo.txt)<= br>
=C2=A0
=C2=A0=C2=A0=C2=A0 ![a csv to be rendered = as a table](foo.csv)
=C2=A0
(that is, based on filename extension)
=
=C2=A0
Those seem sensible, symmetrical, easy to = remember, and I think fit well with what pandoc already does (`![]()` is al= ready like an include).
=C2=A0
As for a syntax to allow writing your csv = data right into your md file, ... Pandoc already supports a generous number= of table formats that are pretty easy to type. And for larger tables that = you might be tempted to copy/paste in, might be better easier to bang-inclu= de them (as in, `![]()`), rather than muck up your pretty markdown file wit= h a giant bunch of csv data. :)
=C2=A0
-- John
=C2=A0
=C2=A0
=C2=A0
=C2=A0
On Fri, May 20, 2016, at 05:38 AM, Martin Fenner wrote:
Dear group,
<= /div>
=C2=A0
The topic of CSV support in Pandoc has come up several times on this l= ist, includes this thread from 2014:
=C2=A0
Since last year I work for an organisation that frequently deals with = tabular data (and helped organize CSVconf earlier this month), and I have d= one some thinking on how CSV could fit into Pandoc. I see two important use= cases:
=C2=A0
* CSV reader that converts to tables in HTML, docx, latex, etc.
* CSV has a format to describe tables in markdown
=C2=A0
For the first use case I wrote a hack for the Jekyll blogging platform= this week that turns CSV files into markdown grid tables format that is th= en processed by Pandoc (https://github= .com/datacite/jekyll-csvy). I would rather use Pandoc with a CSV r= eader, but my Haskell isn't good enough to write one. But for now I can= generate blog posts directly from CSV files. Other people have done simila= r things with Pandoc and CSV.
=C2=A0
For the second use case I see a clear advantage of CSV over the variou= s attempts to format tables in markdown (simple_tables, multiline_tables, g= rid_tables, pipe_tables). Everyone (and many tools) understands the CSV for= mat, and you can do most of the things with CSV that the other table format= s allow (multi-column formats and column alignment are a bit trickier). Thi= s has been done before using Pandoc filters, but I think a Pandoc "csv= _tables" Pandoc extension would make this easier for the casual user. = Using the grid_tables example from the Pandoc documentation, this could loo= k like this:
=C2=A0
: Sample csv table.
=C2=A0
,,,
Fruit,Price,Advantages
Bananas,$1.34,- built-in wrapper\n- bright color
Oranges,$2.10, - cures scurvy\n- tasty
,,,
=C2=A0
I like three commas on a new line to indicate the start and end of a t= able, but that is of course open for discussion. The format is much easier = to read and edit for humans compared to grid tables, the only tricky bit is= maybe the \n for multiline columns. I would think we could add metadata to= the fenced table blog similar to code blocks, e.g.
=C2=A0
,,,{ #mytable .numberRows }
=C2=A0
One challenge with CSV is that it is an ill-defined format somewhat si= milar to markdown before CommonMark. It may make things easier to only supp= ort a specific CSV variant (e.g. comma as separator, header required, comme= nt lines not allowed).
=C2=A0
Thoughts?
=C2=A0
Best,
=C2=A0
Martin
=C2=A0
=C2=A0
=C2=A0


--
You received this message because you are= subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop r= eceiving emails from it, send an email to pandoc-discus= ...@googlegroups.com.
To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
=C2=A0

--
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/b9147aed-bf8e-4136-8fd2-949dea1034ea%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_437_1036855705.1464241370397-- ------=_Part_436_1617991770.1464241370397--