From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/16633 Path: news.gmane.org!.POSTED!not-for-mail From: BP Jonsson Newsgroups: gmane.text.pandoc Subject: Re: Filter with arguments Date: Sat, 7 Jan 2017 23:53:46 +0100 Message-ID: References: <20170106114647.GG791@Administrateurs-iMac-3.local> <1239e0f1-2538-4781-8a75-90c59f86aabc@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=001a114770c0d8f5ba0545890111 X-Trace: blaine.gmane.org 1483829639 32633 195.159.176.226 (7 Jan 2017 22:53:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 7 Jan 2017 22:53:59 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDIY76M674FRB67CYXBQKGQE6T7JR4Q-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Jan 07 23:53:51 2017 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-pg0-f57.google.com ([74.125.83.57]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cPzrs-0006nF-I4 for gtp-pandoc-discuss@m.gmane.org; Sat, 07 Jan 2017 23:53:44 +0100 Original-Received: by mail-pg0-f57.google.com with SMTP id 194sf13492522pgd.0 for ; Sat, 07 Jan 2017 14:53:49 -0800 (PST) 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:x-spam-checked-in-group :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=YZ7VL4hSXbOfAUAoJTHs16qXJakatXNZk01jDr5IhA8=; b=CGkXYWPB/b0Oa08VjvgkcHhjMp5GOoyvgwfNYoqZuPizcy0BMVUuRBYG5kJ54emmmT wVQRESfqU+Arjn6LyUs8qX3Zt5C0C9EDBMHDwAIG1mSh6gkO5HmScFvQbdjNESG6ZNin xTmAQzXs2A9o2qI9Wr3Jo4dfO0ISIi8CTDafzefQtOkiFXhguhmIoYTMxMPLPtHBtmrF pKTgFslNFdqXynMrfYJCUS9xWLQyF9CtGIr8LeG3azKIrCQWAat/Hhj7qzg4KLdQboQX Go0prgLQzzYBkoVZ0nD/jDUon/NVMI+T+ZOvC1695TNMDJ96Yutan63VYOIYtQ40cJR1 eDBg== 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:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=YZ7VL4hSXbOfAUAoJTHs16qXJakatXNZk01jDr5IhA8=; b=GNoKIJ1Be42J+unMjNQaAFVwxDSLQDsQfT4HtuuA4KEq7QAh24+3ys3n7mDYSb6g+9 2A7F8PHnhXUTGxbo1KQF3E3ofWp47kybXtoMENzqCodWkWoefbN3zznwvKyzVuvhDY4v DulvtCs+CmZwAgR0VLVDaknv2xDKY3UE1zXhTPbfJ+eJyR4HBE8KYRHv6rdT5a/dyQfN d55jlIBS57uRCFM4LzOFkQVPJF215Ldm2o7L3uI2zLBo6M8hxTnL0D/jGi2not8d04fk oKwUqtBmEZF++Z4qhJ2cEbWtiBQgs38aZv2zRsi2vdTC1hcYyMmGP3l5LWW6BXd7bzP/ 8slA== 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=YZ7VL4hSXbOfAUAoJTHs16qXJakatXNZk01jDr5IhA8=; b=tNqRNv257MKzMT39EVcQAPrSAGfdxFsxSXRdHoD6PxenqnXU353D08TngV42YD5pXV SXHAaStmh13XKI14og5tnPTPvWc8/xzd9hHraIb4CsuuSDjaKZ1Hw+lY13NGnIjAwq4h OtA362PYjdcdow/b64KMuBmF5xfhcERje2b3RbppW2LncROrdgVTpaNKRJ/PRVzBPTFA bj3xkVZK6Ll32Q6GbogxnAxRWacw5j2BXgNFZ4syE5JVUvpNT+uFQzidyqHf/gVgRmtJ feXgamOMA3gE4qCWp9RrtUNIB7VF48V7fRPSnPcM7KvOoqCkDv50dtI4MySPJh2aduZ6 w/IQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AIkVDXKo00mHLpDMwavIKxaOIseYt0mZ0OFGU0vANODOnaq2RnpdoXNWNssWPlAIETzSaQ== X-Received: by 10.36.91.136 with SMTP id g130mr268133itb.8.1483829628540; Sat, 07 Jan 2017 14:53:48 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.36.123.87 with SMTP id q84ls1500445itc.6.canary-gmail; Sat, 07 Jan 2017 14:53:47 -0800 (PST) X-Received: by 10.99.253.81 with SMTP id m17mr50098034pgj.138.1483829627815; Sat, 07 Jan 2017 14:53:47 -0800 (PST) Original-Received: from mail-oi0-x22c.google.com (mail-oi0-x22c.google.com. [2607:f8b0:4003:c06::22c]) by gmr-mx.google.com with ESMTPS id g193si638086ita.3.2017.01.07.14.53.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Jan 2017 14:53:47 -0800 (PST) Received-SPF: pass (google.com: domain of bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4003:c06::22c as permitted sender) client-ip=2607:f8b0:4003:c06::22c; Original-Received: by mail-oi0-x22c.google.com with SMTP id 3so471109021oih.1 for ; Sat, 07 Jan 2017 14:53:47 -0800 (PST) X-Received: by 10.202.76.146 with SMTP id z140mr1564684oia.68.1483829627383; Sat, 07 Jan 2017 14:53:47 -0800 (PST) Original-Received: by 10.157.42.231 with HTTP; Sat, 7 Jan 2017 14:53:46 -0800 (PST) Original-Received: by 10.157.42.231 with HTTP; Sat, 7 Jan 2017 14:53:46 -0800 (PST) In-Reply-To: X-Original-Sender: bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com; spf=pass (google.com: domain of bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4003:c06::22c as permitted sender) smtp.mailfrom=bpjonsson-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:16633 Archived-At: --001a114770c0d8f5ba0545890111 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Yes of course with `-M` you get all the ugliness (IMO) of a single level of key-value pairs which was my point, but that is no different from traditional command line options, apart from `--option=3Dkey=3Dvalue` where= you get an additional level. Sure there are things which you may want to communicate to a filter on the command line and not in the document but those are in my experience in the minority. What do you mean with outputting different formats? If you mean what we usually mean by "output format" in a pandoc context I'd expect the format argument which pandoc gives to filters to suffice in most cases, wouldn't it? It would be a little ironic to start adding command line options to suit different people's filter writing style, since we got filters to avoid adding support for everyone's needed features in the pandoc ececutable. That said if a separate filter option option is implemented it would probably be wiser to implement it analogously to the -M option, something like `--filter-option myfilter:option[=3Dvalue]` and pass those options to the filter as a second 'line' of JSON, thereby not breaking backwards compatibility. Dual filter/cli scripts can just (a) check whether there are any command line options and (b) whether the first two input records are JSON and do their thing based on that. Den 7 jan 2017 21:51 skrev "Kolen Cheung" : > Is that a realistic scenario? > > At least in my case of pantable it actually is. Because either way it is > calling pandoc to do some heavy lifting. So many of the functions I wrote > will be the same. The only differences are how the options are given, and > then how the input/output format might be different (e.g. from csv as a > filter expects the csv in CodeBlock, but from csv on cli expects just a > plain csv). > > As for hierarchical metadata structures being ugly I don=E2=80=99t think = they are. > > They aren=E2=80=99t if in YAML, but they seems to be when specified using= -M (or > am I missing something?). In the case of any of the suggested method, the > filter arg is only available to that particular filter, so there=E2=80=99= s no > mixing of name spaces. And just to add that sometimes it is not desirable > to put this info in the YAML. e.g. when converting all pandoc Table to > other formats (currently I only have CSV in CodeBlock output, but I might > add some others soon, and not to mention it can works the other way > around), one want to be able to input any random sources (it would very > well be from a .docx) and have the ability to specifies the output format > (say CSV in ClodeBlock, CSS tables using Div, etc.) *without* touching > the documents. > =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/de2e97b1-17a4-4f70-8c17-b3cd960dceb2% > 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/CAFC_yuTR%3D2UQZPN4EFbKTCOAwR9tOoS1%2BsYy5rLRViNo908s-Q%40ma= il.gmail.com. For more options, visit https://groups.google.com/d/optout. --001a114770c0d8f5ba0545890111 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Yes of course with `-M` you get all the ugliness (IMO) of= a single level of key-value pairs which was my point, but that is no diffe= rent from traditional command line options, apart from `--option=3Dkey=3Dva= lue` where you get an additional level.

Sure there are things which you may want to communicate to a filt= er on the command line and not in the document but those are in my experien= ce in the minority.

What= do you mean with outputting different formats? If you mean what we usually= mean by "output format" in a pandoc context I'd expect the f= ormat argument which pandoc gives to filters to suffice in most cases, woul= dn't it?

It would be= a little ironic to start adding command line options to suit different peo= ple's filter writing style, since we got filters to avoid adding suppor= t for everyone's needed features in the pandoc ececutable.

That said if a separate filter optio= n option is implemented it would probably be wiser to implement it analogou= sly to the -M option, something like `--filter-option myfilter:option[=3Dva= lue]` and pass those options to the filter as a second 'line' of JS= ON, thereby not breaking backwards compatibility.
Du= al filter/cli scripts can just (a) check whether there are any command line= options and (b) whether the first two input records are JSON and do their = thing based on that.

Den 7 jan 2017 21:51 skrev "Kolen Cheung" <christian.kolen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>= ;:
=

Is that a realistic scenario?

At least in my case of pantable= it actually is. Because either way it is calling pandoc to do some heavy l= ifting. So many of the functions I wrote will be the same. The only differe= nces are how the options are given, and then how the input/output format mi= ght be different (e.g. from csv as a filter expects the csv in CodeBlock, b= ut from csv on cli expects just a plain csv).

As for hierarchical metadata st= ructures being ugly I don=E2=80=99t think=20 they are.

They aren=E2=80=99t if in YAML,= but they seems to be when specified using -M (or am I missing something?). In the case of any of the su= ggested method, the filter arg is only available to that particular filter,= so there=E2=80=99s no mixing of name spaces. And just to add that sometime= s it is not desirable to put this info in the YAML. e.g. when converting al= l pandoc Table to other formats (currently I only have CSV in CodeBlock out= put, but I might add some others soon, and not to mention it can works the = other way around), one want to be able to input any random sources (it woul= d very well be from a .docx) and have the ability to specifies the output format (say CSV in ClodeBlo= ck, CSS tables using Div, etc.) without touching the documents.

=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/de2e97b1-17a4-4f70-8c1= 7-b3cd960dceb2%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://gro= ups.google.com/d/msgid/pandoc-discuss/CAFC_yuTR%3D2UQZPN4EFbKTCOAwR9tOoS1%2= BsYy5rLRViNo908s-Q%40mail.gmail.com.
For more options, visit http= s://groups.google.com/d/optout.
--001a114770c0d8f5ba0545890111--