From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30943 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Lua filters: validating input and output formats Date: Sat, 9 Jul 2022 11:48:13 +0200 Message-ID: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000001c82e305e35c3808" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34636"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCWMVYEK54FRBZ45UWLAMGQES33HWSA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Jul 09 11:48:27 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lf1-f64.google.com ([209.85.167.64]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oA74d-0008mP-MO for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 09 Jul 2022 11:48:27 +0200 Original-Received: by mail-lf1-f64.google.com with SMTP id r2-20020a19da02000000b00488c1f8322bsf450152lfg.9 for ; Sat, 09 Jul 2022 02:48:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657360107; cv=pass; d=google.com; s=arc-20160816; b=jqCuWjolH3Dx8OEEHCiU4IuK6ST1tXjJfJSRCzaVl4njNnfMMpFIsaxwZ5mnaMNyM7 MFaaiNZbtHXEpaQ4znsAfUMRwZ5+aySR+AIQFgeZxj2ET4xhAs1v5yYkuq80fhcPIUtl L0lTNKQ/xvM7AO1ikbybu0sFJWaJHB6/RZTbanEWcJDAZ6Ty7J8uPkJrf12qranHeLiz IfBD0OYfsCkvbIqLeJrlXDqJOSv/cJls1kFGpNVsX9FOBXIsuI6bohXekzzm/g3cVQsK tdRiKK6AGBIUF+VKxqv6ZaSb/qDhxVmWPRc7m5igZpj5FIQ4l1CDSgSRRp/mr1NOhfIZ GFuA== 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:to:subject:message-id:date :from:mime-version:sender:dkim-signature:dkim-signature; bh=GwIwPfRmmDdYKXdITa0ojnP9O4vApk+BX/KXWh3yMNw=; b=HP5AfSB94vJJm+ElDxLl4CeuSlxi8RKo3WLsmW4UwQgHHcL21hwfTOWJIPjwKrjma7 KYxwa1K1J6iRs6tqTGZUQicbs4tB2Y/77S0Qtl1Bx1sarqyu0AU8OFb+iUJL1ZQKiQOw 4VGogb8I6eRXh77fmQt2XjtqNb7Ou9bA9f5kOTR7eNJqYbPlXkRrXRG8tgbozrF7MRJ6 GkuxVUu51akmjK3Wq29m301pCOGntcBGU4hB9QL59AEfx/QbrZEoQ/h942l3khtGuJyT uKQ0DUac9cM/mGVliZ2Zy4K50xfEZeKT+KzB9SN7xEK5uLThAQXtGr0dB1v7w7kuirVo MnUg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cDuj0RU4; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::533 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:mime-version:from:date:message-id:subject:to :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=GwIwPfRmmDdYKXdITa0ojnP9O4vApk+BX/KXWh3yMNw=; b=C6ssRTsPD7ZqgCn19YmA3h7RIuIfyRA1NuWA7A4Hn8FKnCR5iQjkemP3/JMuEw3GFR P4VtH6jwMyqsCgbt8U0fE0yhISbmDd5o05GM0jlIuFgxUendVyTh3L+k0BoDddVvUXl4 On/RTb1xch+PYjnhy2fEAaG66ZROZSEZ7Mc3DwxNnN+oDnmz473lL+WSqr+a2NBSclxj oU7fxre+ae5LyhKvYK9k+UUO4wg27LDftoBfyMSSwUk5G3mx3KV3gJ/CVYIbAuID4t7o MvIycOJGrPDUCC5ga0YGIqhLikYDsvaHQlA2Oj+QbCkrQqk5C1iBgL7GbR5l51T9iR7N iBUA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to: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=GwIwPfRmmDdYKXdITa0ojnP9O4vApk+BX/KXWh3yMNw=; b=GBCp7jBUuaXxkKz2nl28Y+GLNSISVwqV5+uIVoT22t4AMkRmf8/3QhRcNYAYxcQJmO AiZE6xeGuzE3eFsRN5wCFddKwHqh7JCjUenznQE7GOSwJsv6BM9s6Hqqqo9oLxM2vWbc FjxkpR86Q1K1wl9giOWNA+bDSF+zPDN0Pndrakvh5jE3vEb4b5O0uj3rvtDRcC7LHtKp u1vglVZL60GbMbkvkyPAt0tSFJXKMHyDgXEgtjM0x1HGZfCA8tfg5uWzhMVGX2ubchsS WSYkZ1dM0oa5h1bZu8DTU0wZBRD7zhNYsR99m4d+Nc+r8lmSPGpPgCwWsW/mj5E3Ev+v 3uOQ== 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: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=GwIwPfRmmDdYKXdITa0ojnP9O4vApk+BX/KXWh3yMNw=; b=3FKy1GEUbuDYFf5SRBSXGaoKhGXBjKxLy1yDjrf8YQ7BZNVEgH4HQvUbgqaFzQ83WL lOT5DfcHTuy9vI/0i9a6ghPc6GxYGoNmwx86Pi9zWGb01h+tuvfcRp4zWCRxbI/orIrr VOZVvr+tKpuBbclyDJb+is7Uv7lx4c83qzqnL5zrLguzRBRxZRCmqj6rtjI90B8kRBaV 0tuixtEigUkYAA5IksxOzJMZLIfR3rzO28ujw5wySDaGStWScwftP4nS9TluXJJuISzk l7/+cx/y6+efbscNLDRwbez8mAxx8JQpn17txGdRyADQw68moQ89WWsCkTmsBH8oBcyy nadw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AJIora9uhEHDdG94xTBq42uGTqiPuy/ama9IuGpKYfYg79k4jcew34I5 jq/xpWLcIJrxawJ0cUwN4Q0= X-Google-Smtp-Source: AGRyM1v21Sajam5dY//KBTtPD3mF3QW4DhIzVmQaW4Eoewq0LuB4k4PAsbT0U6ZywjA2BGOyghRNNw== X-Received: by 2002:a05:6512:3b2c:b0:47f:6fc2:a9de with SMTP id f44-20020a0565123b2c00b0047f6fc2a9demr5530385lfv.352.1657360107047; Sat, 09 Jul 2022 02:48:27 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a2e:a7d6:0:b0:25d:302b:5ef8 with SMTP id x22-20020a2ea7d6000000b0025d302b5ef8ls2512970ljp.8.gmail; Sat, 09 Jul 2022 02:48:22 -0700 (PDT) X-Received: by 2002:a2e:b911:0:b0:25a:9942:4171 with SMTP id b17-20020a2eb911000000b0025a99424171mr4181060ljb.426.1657360102146; Sat, 09 Jul 2022 02:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657360102; cv=none; d=google.com; s=arc-20160816; b=QgH6UqFuWY3JheOthVoT+BDrMBybsNePtvr0NwQ4U0tAlrj68mBO81f1uNjDIjnfH7 ekN25uJd6lcVJprPMetaIUZC+n98mmPEYYeJY4JNKH+ALgdlMG77uRSoAZbTFDtZSY3y PpgEUjsIllPU9REagz6FxxtbWj0M7BVIkNPcMqYb8l2nCkESp4u2wRux4Qc4urYsbvDi +N/JSNzJC23bWedfe2sJXKVOgtH/FK+l2dtFgt15LWHaVDu13/GOWowLbVbprQwfNKAB bpMNnP8/QVICeTAdLs9E9TDfZa9GJ86lBfF9O2iYzOxWK1Abqf+vF6o3yA/WHqt9Vxtk txAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:mime-version:dkim-signature; bh=OIJNQTVVaVIGgnZbp9hQ8jyXdbHZdcS2U25OvZC+bN0=; b=sVIV0mx+HJyKIxhY/uNGMCfcOb8KMtYwZOhewbF4kwRMjEVR5Y6mBprsv/ZUc9PrJ8 7CW9/Em+0aEj7CkuttDyeNfu5EjnVtxkYFdbHZ/Xxk/OI3OYHo2uUFAC3ATMM7LVN8Rv StoT2ahKvHmQNTfcRGr4vCevHwF7YFQ47C4qvnZ+r6lx/L5RFZ1RRLFWNwAkA0i1W1+q g73o3lhO4epeEhC7R4NfLhm+i9+iXFKtBe+B2EsS6E+lfq+uEFcXr0nrVv99Y3LUXOpQ +CPBB1cBZgyrfBxuY9LLUuLAkoD54lRVdw1WOsfj6iBsp/coLXuWH/CsfXxocUM0758A qQcg== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cDuj0RU4; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::533 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Original-Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com. [2a00:1450:4864:20::533]) by gmr-mx.google.com with ESMTPS id k7-20020a2ea267000000b0025d5ca4448esi46748ljm.3.2022.07.09.02.48.22 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 09 Jul 2022 02:48:22 -0700 (PDT) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::533 as permitted sender) client-ip=2a00:1450:4864:20::533; Original-Received: by mail-ed1-x533.google.com with SMTP id m16so1071265edb.11 for ; Sat, 09 Jul 2022 02:48:22 -0700 (PDT) X-Received: by 2002:a05:6402:12d8:b0:43a:6a70:9039 with SMTP id k24-20020a05640212d800b0043a6a709039mr10503806edx.379.1657360101441; Sat, 09 Jul 2022 02:48:21 -0700 (PDT) X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cDuj0RU4; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::533 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE 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.io gmane.text.pandoc:30943 Archived-At: --0000000000001c82e305e35c3808 Content-Type: text/plain; charset="UTF-8" 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? -- 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/CADAJKhCzFH-VpPV%3DsnQkrhi8g_aCXYu4RDp0ghw3Pd8VmCXjzA%40mail.gmail.com. --0000000000001c82e305e35c3808 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'm writing a filter which walks a table read from CS= V, 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 m= etadata 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 cal= ling pandoc.read. To be sure I could create a table mapping every name retu= rned by --list-input-formats to `true`, but it would seem that rather than = every filter which needs this information (and conversely output formats fo= r pandoc.write) maintaining its own lookup it would be better if the Lua AP= I provided it, either as a pair of functions returning true if their argume= nt 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 pro= vision for internally. Does this seem like a good idea, or is my use case w= ith the filter taking this info from the user too unusual to warrant this?<= /div>

--
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://group= s.google.com/d/msgid/pandoc-discuss/CADAJKhCzFH-VpPV%3DsnQkrhi8g_aCXYu4RDp0= ghw3Pd8VmCXjzA%40mail.gmail.com.
--0000000000001c82e305e35c3808--