public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: BPJ <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Lua filters: validating input and output formats
Date: Tue, 12 Jul 2022 18:58:06 +0200	[thread overview]
Message-ID: <CADAJKhAh25W8A2vUYPFzEsy86_bVYBF5jPULPpAiNOTr_PP1PQ@mail.gmail.com> (raw)
In-Reply-To: <87y1wyfwbv.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2205 bytes --]

Great. Thanks!

Den tis 12 juli 2022 12:41Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
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
> > 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.

[-- Attachment #2: Type: text/html, Size: 3340 bytes --]

      parent reply	other threads:[~2022-07-12 16:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-09  9:48 BPJ
     [not found] ` <CADAJKhCzFH-VpPV=snQkrhi8g_aCXYu4RDp0ghw3Pd8VmCXjzA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-07-12 10:38   ` Albert Krewinkel
     [not found]     ` <87y1wyfwbv.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2022-07-12 16:58       ` BPJ [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADAJKhAh25W8A2vUYPFzEsy86_bVYBF5jPULPpAiNOTr_PP1PQ@mail.gmail.com \
    --to=bpj-j3h7gcxpsitlodktgw+v6w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).