From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30952 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Re: Lua filters: validating input and output formats Date: Tue, 12 Jul 2022 18:58:06 +0200 Message-ID: References: <87y1wyfwbv.fsf@zeitkraut.de> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000fd6a9505e39e922b" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33240"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCWMVYEK54FRBJ6QW2LAMGQEWYU2GFQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Jul 12 18:58:21 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ed1-f64.google.com ([209.85.208.64]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oBJDH-0008XR-7j for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 12 Jul 2022 18:58:19 +0200 Original-Received: by mail-ed1-f64.google.com with SMTP id f9-20020a056402354900b0043a902b7452sf6519738edd.13 for ; Tue, 12 Jul 2022 09:58:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657645099; cv=pass; d=google.com; s=arc-20160816; b=hJLlbaFmXKI+HF7/TYuC/qkvTQi72oZ5ysmz19gPhAPeMQETFiDLhznj51EfrwlwqH jMdwoEMXSBxY5ityfe06bHCmGhpIu+TUyDFvUq40q10/bqiprR4CEBUssM5zNRwN4mzt ednz+R6zalczHMpPJp/Az520aTnrwpdJHkF4vQQf47y2zyJzyuvZ4S6OTJvG5sBXEafo XZlVwbm6pX+aO9h58Q4ruaB8ZulnUllaWa1rfEKRunBxvK1YdhRgoA2wPwZhPU1psLzu fmPyfVjl5HZcBRwLFIDclV3dGa2NfVGjWWiWGU30GLA+IjnqX2pGhE3v3jtBxc72DZfo nJ2g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:sender:dkim-signature; bh=nzdTP5OWu3f0rFkDGn0RtyxC/71ZbHw6EiCIH/CPlQc=; b=CzQT8PyUo6439QCBuPDVe+Y2LiB6mvHUtSHcyFITCp4x6LfyxYNFiX4zmZNe7DudhD SvY1dkbvyZp0MMGLtr4aIRYMtQ9UgUz5uJfr8b4wWfMsWBSpet2WOuWDEaYGadeuv2Ko 2Tw1nPX8KgIZVsO5zCOe7XHqH3Ya+lB3L4I0pC/oDxGladb288f8aoSjJUfLjYncUXoV GsEqSMls2QSkvhalqOqkELAaqHhNqe+1ojOCEjKrWwzZit+2IdxrWwFIDsCeEuPwVpcv W73E9UNaQ8vzXhhhOFp9SeUBC7NUcZMcq2aaSi2HJ+GfOFLHVqAdjlP3F1/vzkXJ86EH jDeQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.218.52 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:mime-version:references:in-reply-to:reply-to:from:date :message-id:subject:to:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=nzdTP5OWu3f0rFkDGn0RtyxC/71ZbHw6EiCIH/CPlQc=; b=ZY/EeJv7dC26OdKuFJeL3Z7woJ6UWqZhZpCNEsfwtN84v1jvgZVCksIZxouTznt8n3 SQnpbCM+6eBry36JEU8WbhiBaR6bIDVfpPhz05gL3d0aFb5pfVNjIQVVPjUIrak1dJx4 mVKJFkhKfXBo2CpXVnp2R9ng7PpPhCQVN5yjUHl0zWQYYTOISUWgjvL1UY0wJPrX/s/E 1nZIKZD0Qi0LWNhFV/J1XKux7qBi45X85aRF8DbvgsC7nhH7QluB7QjyJGepabDeZ5F8 OFX2/lGd0Twj9ZKh8DPAPjdywCUSpjolSqCVcuO72gF4EO4P10v+b24BGC0Q2DA47qMR zBdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:mime-version:references:in-reply-to :reply-to:from:date:message-id:subject:to:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=nzdTP5OWu3f0rFkDGn0RtyxC/71ZbHw6EiCIH/CPlQc=; b=tqrkrztVfx05Lb24dBaC8eBER3JIQ7674m0Jqtw3ejk6L46XMNA/jdj22BK/qOrsHa GEoBR+Tqz9/T/JQnaJ4pYgvbPB2EiarHKLR6NLnBEbwGKlgSId8kY5KVQmGxYc4gbdkC 8vzYD6Xt2nioB9DPsRBOyK9OE3fCDEOaT4zY8zpTtjVJXfoLkHcEbYWdkxKMvqPQpvVI Z3Om9XkitThJwXs9pMbkk59+8yrAadoSfm72fgJNhTI6tvbdmqEKEMDUQlrjIEACDaGB ZhGw96hVefmy04yfKX4Ans/qfUg5ZVZwyMuVxLx7Y2rrd3v/8f3lErGgNYgHghzphY5J RX+g== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AJIora8iHahZZSoDdXh6ke/3kQ4R4SofFWZ1fBYbuwKI4PbN3vszIlF7 E4Wk/vtsnn+TGsr6RuK01c4= X-Google-Smtp-Source: AGRyM1uUYfbf0Vy5Bi70fu5Lx49Wz62Hy0gF2+U0OHvrjMGAaqoGcNg/WQYRUzrKggv0D4XraMmiEg== X-Received: by 2002:a05:6402:35d1:b0:43a:cb5b:208b with SMTP id z17-20020a05640235d100b0043acb5b208bmr19437395edc.275.1657645098808; Tue, 12 Jul 2022 09:58:18 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6402:42c7:b0:43a:82dc:c2a2 with SMTP id i7-20020a05640242c700b0043a82dcc2a2ls2621457edc.3.gmail; Tue, 12 Jul 2022 09:58:14 -0700 (PDT) X-Received: by 2002:a50:fe83:0:b0:437:9c60:12f3 with SMTP id d3-20020a50fe83000000b004379c6012f3mr32557809edt.120.1657645094637; Tue, 12 Jul 2022 09:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657645094; cv=none; d=google.com; s=arc-20160816; b=cvLpMFAlIponoxdUbVNRU73oR16QzxLPp0n4ChKf6jDFFf3pXA1dttNBWd20IJpKYI AoiY2Hk85lZXQyxnYOTYIrA+nzf47IxlWHYQRM4u0uK5t0S8VyPlyWiGhYgc55CXMh8k vW5jMy3tfN7FtsFb7tc37OKDx3H5sxmUgGjPtj27ldCO/XYSJXiVOOmUEmPkKhFv4KYD 4lbpQfrbuM69CjeIEucW9lj84DU/qGj3YwkWiLzOrsZyVZwO++FSbPX090EvTKzq0nXk TJf1Se07ern+yqGHgHpbOAvyDrbl3p3L+3vMPH3KkoDOuRG12jOcrwqLhWXdWRcoweYO veaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version; bh=KYWgp1Nn3ijLATH7v60/EaqIKjeCweOLZApEj7roQHU=; b=zrK0TWB0uqQPfj/x5Xi5si64/YKYfeFvJt2chhCxjgdz8qT+mKkWSGe1eG6VCNWp8l dpDDX4Lp43FHGOr6NJ5Z1y7iFfxwvRC+LIZjD7QqX2GArn1oRux/vYOAbq3S5IAf1+Px XzGkuNL6Mt/t0wV/vbHsXnYQ1o4XW5UxtEM7IfgPOnnaKJCMV61ll+QFY0w+eJuLlE9b D9bQqQCv1xw25qT572ys3rs4PpiimtySpV+ETVWMXREpZGMuh+WXQ0j9KAO/E2fGh6Dn IWiCILmaLecz7l6wVKaccmIXuqwBcWBn/RwsJ7gwhe2ssJ7jKsSoxkb2gW8DbnhNgyCE wOsw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.218.52 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Original-Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com. [209.85.218.52]) by gmr-mx.google.com with ESMTPS id d2-20020aa7d682000000b0043780485814si391447edr.2.2022.07.12.09.58.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Jul 2022 09:58:14 -0700 (PDT) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.218.52 as permitted sender) client-ip=209.85.218.52; Original-Received: by mail-ej1-f52.google.com with SMTP id l23so15405456ejr.5 for ; Tue, 12 Jul 2022 09:58:14 -0700 (PDT) X-Received: by 2002:a17:907:728a:b0:726:d6c8:d95c with SMTP id dt10-20020a170907728a00b00726d6c8d95cmr25120817ejc.269.1657645093970; Tue, 12 Jul 2022 09:58:13 -0700 (PDT) In-Reply-To: <87y1wyfwbv.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.218.52 as permitted sender) smtp.mailfrom=melroch-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-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:30952 Archived-At: --000000000000fd6a9505e39e922b Content-Type: text/plain; charset="UTF-8" Great. Thanks! Den tis 12 juli 2022 12:41Albert Krewinkel skrev: > > BPJ writes: > > > I'm writing a filter which walks a table read from CSV, which are all > > read in as literal strings by Pandoc, and parses them with pandoc.read. > > In order to know which format to read the filter inspects a metadata > > field expecting the value to be the one to pass as second argument to > > pandoc.read. However there is easy way to validate that value before > > calling pandoc.read. To be sure I could create a table mapping every > > name returned by --list-input-formats to `true`, but it would seem that > > rather than every filter which needs this information (and conversely > > output formats for pandoc.write) maintaining its own lookup it would be > > better if the Lua API provided it, either as a pair of functions > > returning true if their argument is a valid format, or as (objects > > which act as) tables (sets) with valid formats mapped to true, which is > > something I assume Pandoc already has provision for internally. Does > > this seem like a good idea, or is my use case with the filter taking > > this info from the user too unusual to warrant this? > > That seems like a good idea to me. I've created a PR: > https://github.com/jgm/pandoc/pull/8177 > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/87y1wyfwbv.fsf%40zeitkraut.de > . > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAh25W8A2vUYPFzEsy86_bVYBF5jPULPpAiNOTr_PP1PQ%40mail.gmail.com. --000000000000fd6a9505e39e922b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Great. Thanks!

Den tis 12 juli 2022 12:41Albert Krewinkel = <albert+pandoc@zeitkraut= .de> skrev:

BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> I'm writing a filter which walks a table read from CSV, which are = all
> read in as literal strings by Pandoc, and parses them with pandoc.read= .
> In order to know which format to read the filter inspects a metadata > field expecting the value to be the one to pass as second argument to<= br> > pandoc.read. However there is easy way to validate that value before > calling pandoc.read. To be sure I could create a table mapping every > name returned by --list-input-formats to `true`, but it would seem tha= t
> rather than every filter which needs this information (and conversely<= br> > output formats for pandoc.write) maintaining its own lookup it would b= e
> better if the Lua API provided it, either as a pair of functions
> returning true if their argument is a valid format, or as (objects
> which act as) tables (sets) with valid formats mapped to true, which i= s
> something I assume Pandoc already has provision for internally. Does > this seem like a good idea, or is my use case with the filter taking > this info from the user too unusual to warrant this?

That seems like a good idea to me. I've created a PR:
https://github.com/jgm/pandoc/pull/8177

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-disc= uss/87y1wyfwbv.fsf%40zeitkraut.de.

--
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 view this discussion on the web visit https://groups.= google.com/d/msgid/pandoc-discuss/CADAJKhAh25W8A2vUYPFzEsy86_bVYBF5jPULPpAi= NOTr_PP1PQ%40mail.gmail.com.
--000000000000fd6a9505e39e922b--