From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31506 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Re: Lua filters: Extensions with pandoc.read? Date: Tue, 4 Oct 2022 12:33:38 +0200 Message-ID: References: <87czbrfrzr.fsf@zeitkraut.de> <87v8oz3ohm.fsf@zeitkraut.de> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000e67f5005ea32fe8b" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15475"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCWMVYEK54FRBD4Y6CMQMGQE7ME7Y7I-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Oct 04 12:33:57 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-pl1-f185.google.com ([209.85.214.185]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1offFL-0003dY-NN for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 04 Oct 2022 12:33:55 +0200 Original-Received: by mail-pl1-f185.google.com with SMTP id o1-20020a170902d4c100b00177f59a9889sf10037121plg.13 for ; Tue, 04 Oct 2022 03:33:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1664879634; cv=pass; d=google.com; s=arc-20160816; b=DuH+OAhCooHg15z17LcyLTiVQ07AqiX+h7bO+LKRzhJEf48xCMKPQ2R/XFfB5CFDyW SaI+x/tr+hOvQkIejQpZRLjq6U21HJdrOqu7e5lghQYrES15jTWhFvmQpH8cCNjZ3dib Aerv+02+aMzH69VEL1FSiXbtEmiwvdhAkXBRQTYT9qRuOXXk/jkt4vvxug1UhDs6mNhg weBE0jgyqnjGz9EUgEpVg+6eFIAr2tD2Ml1lPjcZUUiPfDL/uXXruDQubnaAI8SSFMJu sqFztUDl1S1weLB2g/x7g9yP0BX6BnX5ZOGZGX8KN2/vftZbC1njjX429PIhY/yzrWJT 39RQ== 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:in-reply-to:references:mime-version:sender:dkim-signature :dkim-signature; bh=u3bTF1/LIgSfacS/UAoKBnFGvbmVHrE962VF2w49iAw=; b=JxIBnknBm1YAm/hhp/F+aypB7/19HM9PTs0p/Fo7OnNPRsR984wu9Ogz/19uuWEzjw yzYi75Q+ghUi656R2FQKm1DpASEV3mJLq7RDcjqnxHQvow3Ht8PfrLuLihllFG3k0RBX RPovor+qjvXc9mNQoau0Jvcsxwf1HEeBkg653R1Bhb6UVo5gbCqiSGrFN4gmkhJO8t+C hwzQgCDCX5HSCl/KJKX17qccV3iTGkJVhqdHNXV3Usv5RuVn7wgWbmn7++X4LiEUg1LB gIrJGHvbgdH6u8t8vD+jybabZIwOsy2S166Jc2GIHKfQiE6GX3Jq4VbL96KqGSheUZC+ 6TFw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cokXdFOs; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::b2c 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=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version:sender :from:to:cc:subject:date; bh=u3bTF1/LIgSfacS/UAoKBnFGvbmVHrE962VF2w49iAw=; b=Oy53fw9QyuaYrQQHLi5AjXWkpvh4SN1/lL7gcdgjj2fX5SzTM/UysoaWwP/UCp6jo0 9NzfKPOVJra2NDG7jSQ6460gxBL94lf+eX61nr4Ldx4+Cj+mIOAxpPXMSphlQeLTQ5Nr ncwDwXdhAFmahtL2RWo2utrPp1a0zCLSbLiitqpCHJ6OcwtcfCpRMhKhYs4Hujo1FFzX XX4S/AfdDlD7+vdbz1Yb6WsTzu+O04dL6C2Cy4Fhfi7v5pON7Ts4lH+oc9OerrN1eQkd lf2I/W4ljLPUAEchAaZbO8mefNbyoB3Ca/fhScYOb7F9Dz57CwMD83Mc8/e98VHowBaa aPPg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version:from:to:cc :subject:date; bh=u3bTF1/LIgSfacS/UAoKBnFGvbmVHrE962VF2w49iAw=; b=fajVcFGhF2hK2D3jvRczZSdtRHOAx9jcOHIJ5LMJu2FrcOfmAxbwEFIUXAg37y7KIC 5y5askbNtWqKMwap0BmYAmZHl9e+5GuHs2tXoSPkt9FPQlNAW4FVs84a9UP2qSM+g6jp b9jBw5nO6avFdvoDsi5yJ9e5RqutWVTXZeNuht4Auk7o9l0uGszdmv+eB40K2MX76+Ju +yvUFsp13czDxOkveV49fNrdUUA5Ku+dFJ2t6Slad9iOXbKYnqu5nz+cJMuxs4iGvRIM OqF7g50BqdXRL+OusEcaQeSWn104/u/AWStKKSy3zFJ5T7TNEDXtLmW9okPGBUwmyUoh j8KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:sender:from:to:cc:subject:date; bh=u3bTF1/LIgSfacS/UAoKBnFGvbmVHrE962VF2w49iAw=; b=6h+rjRiriaJZLVKLeMSzXw1FlZR6+GU61hEEbZfpbfbS/IPc9BO7nZruHi9BIQf15x h/6rRa2ASP2vJeELuAmyj9DJuDI4hfTnNv0rQVo4VjW2WHzlNTrptWhbt7BBD0OKU17G bf7WZSBNlvwAl5MmgHnCFrHCi2wPUa6Oxshj2QExBgP9P6I3shmieKoXlZxVfyWJjevq 3fIzIrorL4EOCXtynPTNp6kpCsBjPrcgyoo08oYZnQVJtGZ8aqPqXV28UkkYqRpN1BY2 2+kwgztw6kil3eyzvd90MhipdIe9wEyCaR19h7Ymh9zxkgBcIJVQiEKMgRpW0P716ys4 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ACrzQf0xDoz9JdBGjPvF5uzcOzcM2CBjfxTnATI83lmFDis1XXkbLqaj Vxw7LU0qN/qfhRkzpHKkvIw= X-Google-Smtp-Source: AMsMyM5wc5As/zO8NfFn7gwP5iRioU58ESyFW/vqx8YqalUMpYo9QsYfPHBIqXbeIOVu4CGvOzKjsw== X-Received: by 2002:a63:e153:0:b0:439:2fa3:74d1 with SMTP id h19-20020a63e153000000b004392fa374d1mr22635983pgk.85.1664879634211; Tue, 04 Oct 2022 03:33:54 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a17:902:b190:b0:178:35a3:84d9 with SMTP id s16-20020a170902b19000b0017835a384d9ls11712873plr.10.-pod-prod-gmail; Tue, 04 Oct 2022 03:33:50 -0700 (PDT) X-Received: by 2002:a17:902:d70a:b0:178:5d52:9e41 with SMTP id w10-20020a170902d70a00b001785d529e41mr26107770ply.0.1664879630510; Tue, 04 Oct 2022 03:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664879630; cv=none; d=google.com; s=arc-20160816; b=Xl9AYpgm2jflc1XaNRx8Jrh1ojhHBN8tl0mKTKfqFux7rbKkNalZMa8UIc6hYypHny PDg2WVcQ/Sf/FyvWhDlQjBBi3EbH/Z8Rv66/wK5JpH4iRT5uV9PuzpG5JdwTioB4/vKf qNQ7HWZ4MPH80qTQ3eIjM1O6JGU1o2p1sBwTglSeL0ov+n0iTMLxq2/KofS2n5gKTZoR f21FYo7m/YkxqOx9nV7ErBLIAzGag5nKGgXL1g1lQjfszYMFAxdNxdMLj9n+rTtCOM2T g6sFzG78VvxCrRJXOPXBfjFa6kjbssdTGNBalHRn9OQrxP82FM+C54Z2c/vF59cDumVC iikA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=I86UXD4EcBI2QukeJm6n23jMDvX5K7DmODosvrLffLI=; b=VBqwqSibB2Kg7pq3JVAGgpdntJv9yKceK5NGRCFlcqrwb6yn1pzn9zN+UgpIS2WN+R DEbsEKO3FlaR9ju0YgJHhVI2PLE5Ej0OtQSiR84/AG7iJU05PgMJ42J6yGbNdLMSy4Mn CsETZVVflR2hmdQOdUAl+HqmpHXC2/J0ui47p8hVVwNV3DrGVJtIADmV0KkNhwVLhd6l Kai/Jqjhftpex8UobXmoEXm2fj99KiFnhHVvMlv+GmAoqVSUiwmW/jLqNsiFivcF+950 Trsd7V8rWQ5BCjjn020TJmbz4MnzE83/P7Mbv0hLiCNd6roSjTxzvxQhl0ayU7dUBvom VE5g== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cokXdFOs; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::b2c 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-yb1-xb2c.google.com (mail-yb1-xb2c.google.com. [2607:f8b0:4864:20::b2c]) by gmr-mx.google.com with ESMTPS id h11-20020a170902f54b00b0017ec1b1bfa4si241649plf.8.2022.10.04.03.33.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Oct 2022 03:33:50 -0700 (PDT) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::b2c as permitted sender) client-ip=2607:f8b0:4864:20::b2c; Original-Received: by mail-yb1-xb2c.google.com with SMTP id 69so4553801ybl.6 for ; Tue, 04 Oct 2022 03:33:50 -0700 (PDT) X-Received: by 2002:a25:84ce:0:b0:6b9:20db:ece with SMTP id x14-20020a2584ce000000b006b920db0ecemr23717544ybm.69.1664879629335; Tue, 04 Oct 2022 03:33:49 -0700 (PDT) In-Reply-To: <87v8oz3ohm.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 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=cokXdFOs; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::b2c 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:31506 Archived-At: --000000000000e67f5005ea32fe8b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Den tis 4 okt. 2022 11:52Albert Krewinkel skrev: > > BPJ writes: > > > Den m=C3=A5n 19 sep. 2022 14:51 Albert Krewinkel < > >> albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> skrev: > >> > >> Extensions have to be passed as part of the format string, e.g., > >> > >> pandoc.read(source, 'markdown-tex_math_dollars') > >> > >> I'm not entirely happy with this, as it means that any extensions > >> passed via a ReaderOptions object will be ignored. > >> > >> -- this may seem like it should disable all extensions, > >> -- but the ReaderOptions `extensions` field is ignored. > >> -- The default 'markdown' extensions will be used instead. > >> pandoc.read(src, 'markdown', {extensions =3D {}}) > >> > >> Ideas to improve this would be most welcome. > > > > I would just change it to not ignore reader options, and throw an > > error if the format string and the reader options contradict each > > other (except for empty table =3D no extensions and no extensions in > > string =3D default extensions). And better hurry before someone starts > > to rely on reader options being ignored! :-) > > I believe that this has already become the expected behavior, so I'd be > very hesitant to break it. How about this approach: The format specifier > can currently only be a string. We change this to accept either a > string, or a table with the extensions being given in separate fields. > E.g. > > -- extensions relative to default for format > { format =3D 'markdown', > , disable =3D {'markdown_in_html_blocks'}, > , enable =3D {'emoji'}, > } > I like this! > or > > -- absolute set of extensions > { format =3D 'docx', > , extensions =3D {'auto_identifiers', 'styles', 'citations'} > } > This `extensions` field would be identical to the `enable` field, wouldn't it, or would it mean that all default extensions not explicitly mentioned in it would be disabled? And what would happen if someone uses it together with `disable` and/or `enable`; which would be ignored, or would it be an error condition? > If the function is called with either a string or a table that has > explicit info on extensions, then the ReaderOptions extensions are > overridden. If the table has no info about extensions, then we use the > ReaderOptions. > If the format can be a table as described I think it is better to always ignore the format/extension info in the ReaderOptions =E2=80=94 and say so = clearly in the documentation! > It might still be a little confusing, as > > pandoc.read(src, 'markdown', opts) -- default Markdown extensions > > will behave differently than > > pandoc.read(src, {format: 'markdown'}, opts) -- extensions in opts > > Extensions are closer to formats than to reader options, conceptually. > It seems sensible to tie them to formats. Agreed. But maybe there is a better > way? > I think this would be fine. Also I assume that `pandoc.write()` would behave analogously? > -- > Albert Krewinkel > GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 > > -- > 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/87v8oz3ohm.fsf%40zeitkra= ut.de > . > --=20 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 e= mail 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/CADAJKhCg3rMk%2B0fJBOcte32BVh2c9tYQHa57DEGHdyAz2u7%2BkQ%40ma= il.gmail.com. --000000000000e67f5005ea32fe8b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Den tis 4 okt. 2022 11:52Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>= skrev:

BPJ <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> writes:

> Den m=C3=A5n 19 sep. 2022 14:51 Albert Krewinkel <
>> albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> skrev:
>>
>> Extensions have to be passed as part of the format string, e.g., >>
>>=C2=A0 =C2=A0 =C2=A0pandoc.read(source, 'markdown-tex_math_doll= ars')
>>
>> I'm not entirely happy with this, as it means that any extensi= ons
>> passed=C2=A0 via a ReaderOptions object will be ignored.
>>
>>=C2=A0 =C2=A0 =C2=A0-- this may seem like it should disable all ext= ensions,
>>=C2=A0 =C2=A0 =C2=A0-- but the ReaderOptions `extensions` field is = ignored.
>>=C2=A0 =C2=A0 =C2=A0-- The default 'markdown' extensions wi= ll be used instead.
>>=C2=A0 =C2=A0 =C2=A0pandoc.read(src, 'markdown', {extension= s =3D {}})
>>
>> Ideas to improve this would be most welcome.
>
> I would just change it to not ignore reader options, and throw an
> error if the format string and the reader options contradict each
> other (except for empty table =3D no extensions and no extensions in > string =3D default extensions). And better hurry before someone starts=
> to rely on reader options being ignored! :-)

I believe that this has already become the expected behavior, so I'd be=
very hesitant to break it. How about this approach: The format specifier can currently only be a string. We change this to accept either a
string, or a table with the extensions being given in separate fields.
E.g.

=C2=A0 =C2=A0 -- extensions relative to default for format
=C2=A0 =C2=A0 { format =3D 'markdown',
=C2=A0 =C2=A0 , disable =3D {'markdown_in_html_blocks'},
=C2=A0 =C2=A0 , enable =3D {'emoji'},
=C2=A0 =C2=A0 }

I like this!


or

=C2=A0 =C2=A0 -- absolute set of extensions
=C2=A0 =C2=A0 { format =3D 'docx',
=C2=A0 =C2=A0 , extensions =3D {'auto_identifiers', 'styles'= ;, 'citations'}
=C2=A0 =C2=A0 }

This `extensions` field would be identical to the `enable` f= ield, wouldn't it, or would it mean that all default extensions not exp= licitly mentioned in it would be disabled? And what would happen if someone= uses it together with `disable` and/or `enable`; which would be ignored, o= r would it be an error condition?


If the function is called with either a string or a table that has
explicit info on extensions, then the ReaderOptions extensions are
overridden. If the table has no info about extensions, then we use the
ReaderOptions.

If the format can be a table as described I think it is bette= r to always ignore the format/extension info in the ReaderOptions =E2=80=94= and say so clearly in the documentation!

=

It might still be a little confusing, as

=C2=A0 =C2=A0 pandoc.read(src, 'markdown', opts)=C2=A0 -- default M= arkdown extensions

will behave differently than

=C2=A0 =C2=A0 pandoc.read(src, {format: 'markdown'}, opts) -- exten= sions in opts

Extensions are closer to formats than to reader options, conceptually.
It seems sensible to tie them to formats.

Agreed.

But maybe there is a better
way?

I think this would be fine.

Also I assume that `pandoc.write()` would behave analogously?

=

--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe=C2=A0 e836 388d c0b2 1f63 1124

--
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/87v8oz3ohm.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://gro= ups.google.com/d/msgid/pandoc-discuss/CADAJKhCg3rMk%2B0fJBOcte32BVh2c9tYQHa= 57DEGHdyAz2u7%2BkQ%40mail.gmail.com.
--000000000000e67f5005ea32fe8b--