From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/16614 Path: news.gmane.org!.POSTED!not-for-mail From: Joost Kremers Newsgroups: gmane.text.pandoc Subject: Re: Filter with arguments Date: Fri, 06 Jan 2017 13:27:13 +0100 Message-ID: <8760ls8jby.fsf@fastmail.fm> References: <20170106114647.GG791@Administrateurs-iMac-3.local> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=UTF-8 X-Trace: blaine.gmane.org 1483705645 27079 195.159.176.226 (6 Jan 2017 12:27:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 6 Jan 2017 12:27:25 +0000 (UTC) User-Agent: mu4e 0.9.19; emacs 25.1.50.3 To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCS7B5O6XUOBBKE2X3BQKGQEYDAY4ZQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Jan 06 13:27:20 2017 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-qk0-f185.google.com ([209.85.220.185]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cPTc5-00064U-CF for gtp-pandoc-discuss@m.gmane.org; Fri, 06 Jan 2017 13:27:17 +0100 Original-Received: by mail-qk0-f185.google.com with SMTP id d201sf16660865qkg.0 for ; Fri, 06 Jan 2017 04:27:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:references:user-agent:from:to:subject:in-reply-to:date :message-id:mime-version: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=A4Zr6r3sAJe16IIZLKgxJFdwrBpWFk61fkLEFW/AFso=; b=N1gY8vlHSw8FjuD/fiYz3lJKPIAFOVfxYV0UXRXKjgShPoLibPI2GZmWG85lt9V4FA 7PcShpmzW0yJFijf30O1QJuVeZpDziqqtmP4ww2Y4oGKriEHrjR8ZR1vquYZEjJTQJj0 evoCxsiDZ5Hent2d9ejULqIjx3U3GkxZecmWNjoLAyLmCewQr43jsdxl7P3OR+3hPF1J WGT0IPr8GzLowKE+oGBnsEUmeTzYtn+u6lW04+NxPh2kPCBPZk4Ksqqs98LaqMYuA1Q4 hMV38z82x8leIF58n66ZZJ1Gko3BN96WN5mmK4gSVHfvzri9LLwJEdhle1vRXUkKbEdt XtZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:references:user-agent:from:to:subject :in-reply-to:date:message-id:mime-version: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=A4Zr6r3sAJe16IIZLKgxJFdwrBpWFk61fkLEFW/AFso=; b=pHVb3i5hefBAUunXtEkCL6zgnEqet3aGJioqsZDryGOCDrXcrK15jGXTVEHPJ06kKG tw4UgSLHePfUiQLmi5aIT2FbR68vqL9+wTFghBnTNAApuMWcrxVQ9+t/fpBXte+YF2fc MONnr9KZgaHOFELOQ6wUN1dR3fG2nHyflBVg4bSvF8crjpKQjetjnJUGDLH0PkWDMCiu qMHz4qR4aYaHUw1uxGf4FPjp4+DfHdSV3zISzo5J3yEq4aoBm7F2y6NbcQ59ozeuYoJY eegITDzl+/Dhriw6FsbvIkCEbjsfL9+U7hNhM9gsTUDD68iTM/J9QnErKfOl7+5Rrk6G 6UmQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AIkVDXJ4LNJ8r0m8VqD+hv/NJDGQLY3mnSs1cXec5IrIan1L3nzXLlF9GWRJ3C63q3qY2g== X-Received: by 10.36.103.131 with SMTP id u125mr104230itc.4.1483705641598; Fri, 06 Jan 2017 04:27:21 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.36.207.132 with SMTP id y126ls640243itf.10.gmail; Fri, 06 Jan 2017 04:27:20 -0800 (PST) X-Received: by 10.99.114.3 with SMTP id n3mr43610717pgc.140.1483705640848; Fri, 06 Jan 2017 04:27:20 -0800 (PST) Original-Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com. [66.111.4.26]) by gmr-mx.google.com with ESMTPS id i9si7359865ywc.0.2017.01.06.04.27.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jan 2017 04:27:20 -0800 (PST) Received-SPF: pass (google.com: domain of joostkremers-97jfqw80gc6171pxa8y+qA@public.gmane.org designates 66.111.4.26 as permitted sender) client-ip=66.111.4.26; Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 67A4720FF9 for ; Fri, 6 Jan 2017 07:27:20 -0500 (EST) Original-Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Fri, 06 Jan 2017 07:27:20 -0500 X-ME-Sender: X-Sasl-enc: SRaAwwShqBK1m3FGF/iJS7UNWF0fBsD+ehVbfbrVPqyG 1483705639 Original-Received: from IdeaPad.messagingengine.com (x4d0aae6b.dyn.telefonica.de [77.10.174.107]) by mail.messagingengine.com (Postfix) with ESMTPA id D609124428 for ; Fri, 6 Jan 2017 07:27:19 -0500 (EST) In-reply-to: <20170106114647.GG791-BKjuZOBx5Kn2N3qrpRCZGbhGAdq7xJNKhPhL2mjWHbk@public.gmane.org> X-Original-Sender: joostkremers-97jfqw80gc6171pxa8y+qA@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@fastmail.fm; dkim=pass header.i=@messagingengine.com; spf=pass (google.com: domain of joostkremers-97jfqw80gc6171pxa8y+qA@public.gmane.org designates 66.111.4.26 as permitted sender) smtp.mailfrom=joostkremers-97jfqw80gc6171pxa8y+qA@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:16614 Archived-At: On Fri, Jan 06 2017, John MacFarlane wrote: > 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? For a properly written filter that shouldn't be a problem, should it? You just need to decide on one way of doing it and stick to it. Filters then need to be updated accordingly. Or are you worried about backward compatibility? > 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. Perhaps the way to overcome this problem is to introduce another option, e.g., --filter-args, so you'd get: pandoc --filter "My Cool Filter.py" --filter-args "-t csv" with each --filter-args referring to the immediately preceding --filters option. Depending on how Pandoc calls filters, it may even be possible to just pass it the literal string argument of --filter-args without having to parse it into different options. -- Joost Kremers Life has its moments