From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30950 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Albert Krewinkel Newsgroups: gmane.text.pandoc Subject: Re: Lua filters: validating input and output formats Date: Tue, 12 Jul 2022 12:38:48 +0200 Message-ID: <87y1wyfwbv.fsf@zeitkraut.de> References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33584"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCZJF7XJTILRBGU7WWLAMGQER3JUILI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Jul 12 12:40:30 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ua1-f63.google.com ([209.85.222.63]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oBDJd-0008XM-Pu for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 12 Jul 2022 12:40:29 +0200 Original-Received: by mail-ua1-f63.google.com with SMTP id 33-20020ab00424000000b003829f08fd3fsf1965237uav.22 for ; Tue, 12 Jul 2022 03:40:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657622428; cv=pass; d=google.com; s=arc-20160816; b=X5lyYNOiONT4ZwYfdK0vcB6eAZ0NfHuQChDdy65cSVH8vHrutBh4aspVlWZACx/L/V lDz5g0WjqxtFJJWP1ASxxwWlXPe+Rf55Qa+v6ufBZc00UOATvlGhTpXNVuQqzXQkP81T +j8gOwM6x7FUjY/PkZSuUyAxVjwNRjAr2nxT9L3IptFbvu+tP5ljp+UUufhol1Av1zVw /AEac0M/VHVlhszbbqdYbhcRHVGqoJKpo7MIgGgv2fz3It/qdop+6r5UsfJ8aR29pD/y zVfrKY5zWKE6Yu52HUzCwXZqe6xhhExSs49SMaL1FupRGYLZwUIwhe9Va3etlmSkhxQw pmoQ== 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:reply-to:mime-version:message-id :in-reply-to:date:subject:to:from:references:sender:dkim-signature; bh=BwDYI0ivdQ7uTYfRFuAPECiCukj7inxow6qVaZ7wWFw=; b=MdpwPDCjeqcds6Y5Sa4seWPevBqX5r5OWChVhd64yEvWzRgS4PA6YPkskJCKJZj4um 97O6rKf2WPpKvtgyMSlWxvIqWp+ESQiEgjEnTy9gO3GjTfa0i/VySRCzn/haOHCRlzxo X/wp8u36g4hBFVzFMAOY10s7t0SghCJ8J6sQ5Z/8XUWfpmqjTXaP4Slx27p0zT6Ipfig h3oo+MqmlgJhDWguiyRPKHzjjAjdwzc+5ju/UCNbezGsjTE+1D5KitZzY5vZNUL27CVu wbJw+ttU5d88W8tLK36LGJ0L0FT6GjapKzo36dO2kY7o5HBtcqIl9TmfqHShsecWiJzU J+Rg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 80.241.56.171 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:references:from:to:subject:date:in-reply-to:message-id :mime-version:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=BwDYI0ivdQ7uTYfRFuAPECiCukj7inxow6qVaZ7wWFw=; b=SDx2Um0mS8TXh7Txy+YaYSSprhacx9cyS6YLdjwZPZMZfgV/sKWdGqCemy7LadeEWE BRqH+sCbjvUZ6YtBQNbt6BWkFZSKWPvPUE7mjLxQyaO20H/uNbK0+xJ9lXl7WpFFk7xq ya3gPxQJLVwhQpcmBUjOr3gQyzRizDxh7yQb4XHtuvHeD+1m1ozidq3Ax8twboSqD7r6 9pCTWehU4epxZxGLDQHOPIoFTyDbbR/IALr8Jrgp5U53Bbxxi6iyKp5tHxYOWCTOosVN P2qi0SAP3auGBvZXIam8hMDLMNYL/FlXqbbu3dpIj7gEy/vLUat6PcuGgdnpSfLRJxud rOIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:references:from:to:subject:date :in-reply-to: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=BwDYI0ivdQ7uTYfRFuAPECiCukj7inxow6qVaZ7wWFw=; b=xR8Hiv0lukWY6+qLgCzYhB7YOFUHHT92rWeO30fxh/P4a11ulb+AsF7r9jr7Xm+0X4 FRUnKFkpzGg7aA3KbyIpFV+kWazkEVDD7LpjJdjrDrm9i8DFl4ojMF3f2pXO2mw1reNl R1maD4bNHGvTOBWh653kbNbl2nn5i4yPu9QGzJoKFaBuii60kjI4nA7dqKtr08rZcQPP wXTOweUtOR2zf+QzOqRvphP0DZJz3jp6JVE6Kc1zGt4AL8B+gcQo+HUH3ERIaqmcY2vw MOnRrsLFCwyl8tTzj7+XqZNgqrnSA7ogmnK08ku+gh6a1FMCGxLhtk3FwtxD3HnloKP0 o6oQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AJIora/IaugTdq+E3fLpWKrQoohZ2LuuYgCU0dPVf3A7uElH8fam1SnI Q0pBIJModVKeUy2NxFL9A/k= X-Google-Smtp-Source: AGRyM1smcZmSozYSKZClv6tXC1PwrMdA0nfpoUQ51C0GGZB7VNDS9AeQEz99c3MVC9eQzG3VQOrd8w== X-Received: by 2002:a1f:2fcc:0:b0:370:da7f:788d with SMTP id v195-20020a1f2fcc000000b00370da7f788dmr7983426vkv.17.1657622428803; Tue, 12 Jul 2022 03:40:28 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6102:162b:b0:356:36f4:841d with SMTP id cu43-20020a056102162b00b0035636f4841dls419724vsb.3.gmail; Tue, 12 Jul 2022 03:40:25 -0700 (PDT) X-Received: by 2002:a67:d389:0:b0:357:4c4a:b7a4 with SMTP id b9-20020a67d389000000b003574c4ab7a4mr5283960vsj.33.1657622425606; Tue, 12 Jul 2022 03:40:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657622425; cv=none; d=google.com; s=arc-20160816; b=mClgVL/dLUAMki5QlgZyKDIH2evoZuZmurolXD3Tgffcbafzo81/2VKUpX5rwWOFgd K3RL13H6afxqlDpmsSvOLvdKEvgCbx/weRSeRMlqSJWi63gCSbMmK/I44mx9xgoGYq0p K4HwOdXOHRl8mX+d0M+8mciTfP0E7cb3xXkLwoIgspArVvxY0ZC46iyl+a+nISetrN7C DVpHeenWpZjNTnwt68sj40o4BDCBGNLE+j84BnBpA6C0fbBx3o/jS7xSfqhchAOyzsOK KqK+IkjB+2rZQJIP2CBSUScZVpIwLPanGyTF2msee35cDTCjdbNDTYJtnpDs48PVX/+s kDPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:in-reply-to:date:subject:to:from:references; bh=1OJqvGpOQpAU7eHAY+cYCI0JuZJ2GProsxxAzspSEz8=; b=B6qZ6Hq9fbRQsx14WQoN/cTHtZ9NWERSoaShX/nsCopfbceYut3ZcvUPDu2Do0Yda1 Y7/6E1GSXfBhdua5PqaIYjJpWkzLTcVryq7pXKTmHuAT0iZkNi39kIkKvOdMbw2+iBUM YptSYPUH7/VK66Eqc/qtE4SLtO8gX2/xgPP9nWlFeaNfCLIGr+agWLpPmUegtTopmNIK n0xdtFs9h9QqDdPczLTRCj5T0WwOBUaW8+ylNtVTKp9dkGLPi32fscNyeqd+3KDipapb mIBhgjspiINnAHHjYpCudab6/CKRjooMf1w2hwaNXw8i9CuWKiEtLE/liw0Y6o2n93Be /rvA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 80.241.56.171 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org Original-Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org. [80.241.56.171]) by gmr-mx.google.com with ESMTPS id h135-20020a1f218d000000b0036c18b4c646si258877vkh.2.2022.07.12.03.40.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 03:40:25 -0700 (PDT) Received-SPF: pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 80.241.56.171 as permitted sender) client-ip=80.241.56.171; Original-Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4Lhy2F6VzHz9sRW for ; Tue, 12 Jul 2022 12:40:21 +0200 (CEST) In-reply-to: X-Original-Sender: albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 80.241.56.171 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@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:30950 Archived-At: 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