From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/16612 Path: news.gmane.org!.POSTED!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: Filter with arguments Date: Fri, 6 Jan 2017 12:46:47 +0100 Message-ID: <20170106114647.GG791@Administrateurs-iMac-3.local> References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1483703262 17911 195.159.176.226 (6 Jan 2017 11:47:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 6 Jan 2017 11:47:42 +0000 (UTC) User-Agent: Mutt/1.7.0 (2016-08-17) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBVUHX3BQKGQETDZ6PEY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Jan 06 12:47:38 2017 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-qt0-f184.google.com ([209.85.216.184]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cPSza-0003Jb-7W for gtp-pandoc-discuss@m.gmane.org; Fri, 06 Jan 2017 12:47:30 +0100 Original-Received: by mail-qt0-f184.google.com with SMTP id l7sf6270399qtd.1 for ; Fri, 06 Jan 2017 03:47:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:date:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent: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=pmz9Y/NBRuhG6Z0GojaFTbWDC0r6i6gqJ9PJ4pkG5i0=; b=ECZrg4RQ1j8+h+BKxqh3VZIrtNcI/hH/i6tF3zJm5XO18oKiP00ZzPiQ85mps8FR7e bY8/zPOmNqJ5AVkGGfOILaxxy73NLb0O2qcGD9KEhBSOv1N799iqU9KDwH3HgGwO73LP XdyB6M6/PX1Tck/e++v1TO0cYvJKaQSRRgmfl/zX1jfFPV/pwViGAXXpJqz0sFRUWJzn 5t6l/wmhtTgYBenhrUJ1Sri1SyP+cgIZt0tT8nAwV7CpFZwJgZ+pryZSQs0aJqPLX/4s ree5/h4UpkO/A93eF0Zsd2VSAh6j/ef9EBoXMJk5m7jU5Qd+vlWZbgMuRNYVsa7D X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:date:to:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent: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=pmz9Y/NBRuhG6Z0GojaFTbWDC0r6i6gqJ9PJ4pkG5i0=; b=b393k5gGemMxFpMTLGt7yl29tFqcFKw1nEk3LUjdehW8tkoRetvv4S0IiYAoPnzg3K O42EzBzIm+x0MI6I7hZBPyUhdO8tkzr5UbEYOs7KqVAQdRFkoFgJzQkR3tDDc5x1Sy68 BQadaNIP9P9+kHzwkP83Qvomw1FWR7u901cFjhwBE4Uhal2SQ4KKhvCUN6suEh5DVXPK 4vI+okwMeAG1+zsPdpgZ5LRbpg3Dpp3oUF8SDTMuFH416QgEkBrtrzJxCJflQs54HSJ4 Dt7R1Iyq+RAg3VbRWt4It6dSi8L0uudTe Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AIkVDXJ2N5wpjyqe5N10Zg4jciRMuyEI1YKHNFD+eSsbnm2XZve3Z2RrUNjCU7rxEDiCfA== X-Received: by 10.157.46.212 with SMTP id w78mr105011ota.0.1483703254390; Fri, 06 Jan 2017 03:47:34 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.157.13.110 with SMTP id 101ls1029288oti.25.gmail; Fri, 06 Jan 2017 03:47:33 -0800 (PST) X-Received: by 10.200.38.59 with SMTP id u56mr909468qtu.89.1483703253901; Fri, 06 Jan 2017 03:47:33 -0800 (PST) Original-Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com. [2607:f8b0:400e:c00::241]) by gmr-mx.google.com with ESMTPS id o85si12291426pfj.2.2017.01.06.03.47.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jan 2017 03:47:33 -0800 (PST) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c00::241 as permitted sender) client-ip=2607:f8b0:400e:c00::241; Original-Received: by mail-pf0-x241.google.com with SMTP id y68so29895843pfb.1 for ; Fri, 06 Jan 2017 03:47:33 -0800 (PST) X-Received: by 10.84.141.1 with SMTP id 1mr166152760plu.133.1483703253455; Fri, 06 Jan 2017 03:47:33 -0800 (PST) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id u64sm153641003pgc.39.2017.01.06.03.47.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jan 2017 03:47:32 -0800 (PST) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id 851E9A0C5; Fri, 6 Jan 2017 06:47:21 -0500 (EST) Content-Disposition: inline In-Reply-To: X-PGP-Key: http://johnmacfarlane.net/jgm.asc X-Original-Sender: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c00::241 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@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:16612 Archived-At: This is a pretty common request. A couple of complications: 1. Pandoc calls each filter with one argument, the name of the output format. (Filters thus have access to this.) If we allowed `-F "pantable -t csv"`, how would this work? Would pandoc call `pantable latex -t csv`? Would the filter be expecting this? 2. We'd get a quoted argument like `"pantable -t csv"` as a single string from the environment. So pandoc would have to do its own parsing of this string into a command, options and arguments. This is tricky. Maybe some people are already using filters with spaces in them, like `-F "My Cool Filter.py". This kind of thing would break if pandoc assumed that the command was "My" and "Cool" an argument. +++ Kolen Cheung [Jan 05 17 20:32 ]: > Currently, if one need to pass arguments to a filter, one need to pipe > it through. > > It would be convenient in some cases to allow passing argument to > filters. e.g. >pandoc -F "pantable -t csv" -s -o example.tex example.md ># which is equiv. to >pandoc -t json -s example.md | pantable -t csv | pandoc -f json -s -o exam= ple.te >x > > To elaborate a little bit further: I want to write a filter that at the > same time do: > 1. convert code block to table > 2. convert pandoc tables to code block, potentially with different > output code formats (e.g. csv, yaml, json, etc. or even other kinds > e.g. HTML, Div with CSS table, etc.) > 3. standalone cli. i.e. not a filter > > Right now (1) and (2) are mutually exclusive and has to be split into 2 > filters. (1) and (3) can potentially be written in the same executable, > but it is uglier and pointless to do so without including (2). > =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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to > [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > [3]https://groups.google.com/d/msgid/pandoc-discuss/e8cf9c92-7aa7-4841- > 85d0-7464c771cf6e%40googlegroups.com. > For more options, visit [4]https://groups.google.com/d/optout. > >References > > 1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 3. https://groups.google.com/d/msgid/pandoc-discuss/e8cf9c92-7aa7-4841-= 85d0-7464c771cf6e-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=3Demail&utm_source=3Dfooter > 4. 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/20170106114647.GG791%40Administrateurs-iMac-3.local. For more options, visit https://groups.google.com/d/optout.