From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29777 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Newsgroups: gmane.text.pandoc Subject: Re: Detectiing footnotes in Lua scripts Date: Mon, 13 Dec 2021 20:08:27 +0100 Message-ID: References: <87fsqwo28w.fsf@zeitkraut.de> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 (1.0) Content-Type: multipart/alternative; boundary=Apple-Mail-01E3CBF9-6BFA-4AD1-A3A4-B2940DBFC501 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25204"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDQLFNXWVILBBLVU32GQMGQEJ37VZCI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Dec 13 20:08:33 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ed1-f61.google.com ([209.85.208.61]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mwqgb-0006OH-7F for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 13 Dec 2021 20:08:33 +0100 Original-Received: by mail-ed1-f61.google.com with SMTP id a3-20020a05640213c300b003e7d12bb925sf14863223edx.9 for ; Mon, 13 Dec 2021 11:08:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639422512; cv=pass; d=google.com; s=arc-20160816; b=Ervz9VBBL9BJcewzw7Yw9UmOYvfpniog7uI3IvW6UJcyu0HptF3kvZ4lvwd89dy+zD uD9WWBhf6OX/yk8hHQvlZvk/Cznggz3Sw2Egqyp26EBLUMkQ8UXf9FxLlby8sMGDloGU PSu6WEggGkPXKMUyeprlBno4NC4upAKSFQKCFr+B3zxojB68/XXJ9b73i8xmX+ernvth 424ywkR1e34WG+Mv88AWBuGz1HE08/ek96h35CjWjU7j+GdpWiUqrTnISpmEFkDe808g KarKdgVAd5OP7mIDs0XUDptRXZ6ZfQNjm57SKcTfyvjY4nhxo5U/0Zn534M9Uuc22s9G 22wg== 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:in-reply-to:references :message-id:date:subject:mime-version:from:content-transfer-encoding :sender:dkim-signature:dkim-signature; bh=vB8OdXo3pZb56YkXbSCjIgnwCUIDTCbifVKKZ3P6cS8=; b=FYLDXHyYW9eXZNa4HTN3EvXprtbZ6ghYAyyKpngCFJCSWo4pUNepGKXbt+Y1TA5mwJ syGIsIkkOf0MkzLcrob60Z6EREcyBZ0/JXpUITXu7TFOwOUTVpl87o4MWzrtfzBbpMTJ yyd13L6M/aOmagNCPgzRJsTrFBC2xNm5nizEf/RwXURsbCZIkdB0Ry/eNEj2/c1gDHd6 MarbJkkx7f7d8bmV2/8YA3Tq72Yg+QwOvFy4SVhEWP1u2RcYLu+1fG0FSd/R7y8RXKM6 OL47kTZouKRI0F1NuHC+enLTNavSFCvGylJegIHB15oidAZt9yBb/a3FhIcw/JAAEIta 2+cA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="CMeR/xYk"; spf=pass (google.com: domain of ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::534 as permitted sender) smtp.mailfrom=ffi.appdev-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:content-transfer-encoding:from:mime-version:subject:date :message-id:references:in-reply-to: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=vB8OdXo3pZb56YkXbSCjIgnwCUIDTCbifVKKZ3P6cS8=; b=HjP91j17Z5W2KZJlcz8mDdVcbzeix3yIyz5oSpEqYDpk9ISYTfe2OeWlYdu5eZ3TRS I8BqgcUq/cMc13RTMap4hKMhqoAaLTWUn9S+4ruMY0wgxP09HD7z2wMZIfgUad63+1b1 QzFvrJoz6yKcjr6WYxdBML2GFGHTz1GYFO++5McBr+YZ73vJFk/3Oa7qIwfo3mkAFiAK cCRl07M7P8kqL0Zj+qI3KxIR4E0itTvyv8tQZ5fMJfN2H4yVZgbHuB35FQXQEFfEQkdW r9MVABw8Lz2I5I53JwQpU+bGq4j6Tzu8u4RhwhqfnKUp/X2Y27k5jBQxwvO6CvtXyZES UpcQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:in-reply-to: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=vB8OdXo3pZb56YkXbSCjIgnwCUIDTCbifVKKZ3P6cS8=; b=aipfiOQQImEO8sPDY7i2KX+UQ+7ORToEcZ5COdgs6CKEWprj0h446/CX7gurAlQ2hL tK3zxc9QN4M2Z1iLat6Kvtn4FU8ChKcmjEsb8SGaIkl3IwOhL5eD4PpPyTMx7492inZp tXH0qQIy3tAUKs5JvRND3vu85T39pqVguiUcftxB6BzFwQuaQ4U1BPFpYCGJk4Xhs6ba KIDJ+cyZBMhbX3bhilBhWAmv6XbJtH2FzPnvMJn0lgQAwvPHmykLkn+ima7o6fl3Lr2v 5h07eQ5Fq3EtOuq66tEfGkJMR7k5NMvseObkflyCOFefoPJ8zwh/I/dmk3I4NXm9JxSQ M7rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:content-transfer-encoding:from :mime-version:subject:date:message-id:references:in-reply-to: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=vB8OdXo3pZb56YkXbSCjIgnwCUIDTCbifVKKZ3P6cS8=; b=jXPFMoIcf/9Glz8c3jHzwLPb6FdadsMuaO/7EdpuMD2BgyOqCbVygEu3IAZwxiQZwQ XQMpdMTXKsd6qWgqeKHSYAVErbfCuH78wJEJeq9s/4ME65eTzT8DpVp91uD+B1xIdmKo 9dBboSlZ1GcMWrhmpC6jjv9tgCeMCkXOryP/fyBZ9LRmmC+DBrSMt+nUTFWNqiq8lUlJ 0lNQsndpDboFhklJ4N5iAn00F+b1mEp96xllGiWHzFSNWdRd65iFUYKQY+bfAVSVjaGn DPOpvV4ca2X12yaTE9DwNAiaAuGz3oQeKdMdrBTNLpBKzdpcg5I7DBttCmOVzHv3SZxz Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM530MAA9OTV8IfH5D2nRJvuL/1Aj3ygo9jvBUdjTgVfyoIFqk49sY Hxnw5MqeinJs1O1RWtyFxGQ= X-Google-Smtp-Source: ABdhPJzYeMj8NbEZn4Fd40Z1pCKiiASubXp/a571HJYYsydn2DaCFS28Jp/dJ1PSH5XHaQnD6Hadvg== X-Received: by 2002:aa7:cb45:: with SMTP id w5mr812062edt.405.1639422512533; Mon, 13 Dec 2021 11:08:32 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6402:4246:: with SMTP id g6ls1968602edb.1.gmail; Mon, 13 Dec 2021 11:08:30 -0800 (PST) X-Received: by 2002:a05:6402:40d2:: with SMTP id z18mr814255edb.395.1639422510182; Mon, 13 Dec 2021 11:08:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639422510; cv=none; d=google.com; s=arc-20160816; b=EhOTTG6cm9nOWforIl1fOd30vSZX1Xl+SUxDRxwoJaca2Y6jZ8cyVhRM2mwB0fz5P3 kNcrXltoOr6llW54bYxcCZPyHS4EKHdgO5cShImpCeXLkyKzq4hN++Zrb9toVUdEN0us Oyd4MXJxxbVQK/phxMQK2wHtkUmcrtcYNk+waW7LLMdovLMVd1Nl4ybjr1nQAsGiiAvk BxXu2hmiETcePdh/Hl+NyOywcWna3H1AmHbCWP8sPVdZCIiJAlPRs0zwMnWuz/aEPHWZ nmz7eJKC/RponZgjXHnXjTOykE4DstNkjAn2X0refG2+/sDPLtuUCrSoZ6eM3xrGzkPZ RxBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:in-reply-to:references:message-id:date:subject:mime-version:from :content-transfer-encoding:dkim-signature; bh=2MLEDZodeWBuC7YI7/qN5e+zfyIj5zLLWh5ADDV1bmw=; b=HHKmDXKva4/tmgre95L1sozZ/8VzEDne0dd8lFl126YVf7FGSx9KZvj5G+WKv+5EOg myhPTHBXXny/GrxOqFmTHnZWbymF9GP8z0BnrDYEoTfd2xdq/BcIlv6Bv1IFXPRCXOd3 ZDMjK2ylpUGPT5Gv01O+GwdZdbySRezUCetOOt6+QFsS+2eLBqTIwkbsz9BlesZp8qjS WbYRmSsN7e4fDLrPH8zKM8Xcq3nOd1+zs6KCIorL6/Tkr9awP4x3Ws1KxEjUeO3dZKHZ Blcyvk/1rsBZB2KHzXPg4VHGfY0BzfqBJQL2EG+wIdcGEFSrz1JGCgDvdj4bfSwjyIiM aH8g== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="CMeR/xYk"; spf=pass (google.com: domain of ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::534 as permitted sender) smtp.mailfrom=ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Original-Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com. [2a00:1450:4864:20::534]) by gmr-mx.google.com with ESMTPS id fl21si798094ejc.0.2021.12.13.11.08.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Dec 2021 11:08:30 -0800 (PST) Received-SPF: pass (google.com: domain of ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::534 as permitted sender) client-ip=2a00:1450:4864:20::534; Original-Received: by mail-ed1-x534.google.com with SMTP id z9so965161edb.5 for ; Mon, 13 Dec 2021 11:08:30 -0800 (PST) X-Received: by 2002:a50:eacb:: with SMTP id u11mr884445edp.290.1639422509820; Mon, 13 Dec 2021 11:08:29 -0800 (PST) Original-Received: from smtpclient.apple (host-87-10-63-247.retail.telecomitalia.it. [87.10.63.247]) by smtp.gmail.com with ESMTPSA id f19sm96288ejl.214.2021.12.13.11.08.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Dec 2021 11:08:29 -0800 (PST) In-Reply-To: <87fsqwo28w.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> X-Mailer: iPad Mail (19B74) X-Original-Sender: ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="CMeR/xYk"; spf=pass (google.com: domain of ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::534 as permitted sender) smtp.mailfrom=ffi.appdev-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:29777 Archived-At: --Apple-Mail-01E3CBF9-6BFA-4AD1-A3A4-B2940DBFC501 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable That sounds like a clever solution: it doesn't change the data model or req= uire pandoc to marshal all the parents for possible access. I'll wait for t= he next release, though. Looking at the PR, I spotted a typo on line 233 of doc/lua-filter.md: "be" = should be deleted from "will be try the following filter functions". I see that the documentation only illustrates how to not traverse footnotes= . Should it also illustrate how to apply a separate filter? The walk() meth= od is new to me. > On Dec 13, 2021, at 6:15 PM, Albert Krewinkel wrote: >=20 > =EF=BB=BF > jcr writes: >=20 >> I find in Lua filters that I sometimes would like to know whether or not >> I'm in a footnote. Currently, I'm trying to move punctuation before >> footnotes. Given my citation style, I know that a Cite in body text will >> produce a footnote, while a Cite in a footnote will not. So I want to mo= ve >> punctuation before a Cite when it's not in a footnote. Since a filter >> function for Inlines will descend into footnotes as well, there doesn't >> seem to be any way to tell when the Cite is in a footnote. >>=20 >> [...] at least in the long term, I'd like to be able to tell whether >> or not I'm in a footnote. >=20 > We just committed code[^1] that will help with this: it is now possible > to let the filter traverse the document top-down (root to leaves), and > to prevent processing of all element children by using `false` as a > second return value. >=20 > To exclude footnote contents from being processed, one can now use >=20 > traverse =3D 'topdown' >=20 > function Note (n) > return n, false > end >=20 > If you want to apply a *separate* filter in footnotes, you can write >=20 > traverse =3D 'topdown' > function Note (n) > return n:walk(my_footnote_filter), false > end >=20 > You should be able to try the feature after downloading the next nightly > build, which should become available at around 09:00 UTC. >=20 > [^1]: See https://github.com/jgm/pandoc/pull/7751/files >=20 > -- > Albert Krewinkel > GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 >=20 > --=20 > You received this message because you are subscribed to a topic in the Go= ogle Groups "pandoc-discuss" group. > To unsubscribe from this topic, visit https://groups.google.com/d/topic/p= andoc-discuss/4S38_f_-384/unsubscribe. > To unsubscribe from this group and all its topics, send an email to pando= c-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgi= d/pandoc-discuss/87fsqwo28w.fsf%40zeitkraut.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/F8CB6356-E282-40D0-BCB6-36D0C8FAAF1C%40gmail.com. --Apple-Mail-01E3CBF9-6BFA-4AD1-A3A4-B2940DBFC501 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
That sound= s like a clever solution: it doesn't change the data model or require pando= c to marshal all the parents for possible access. I'll wait for the next re= lease, though.

Looking = at the PR, I spotted a typo on line 233 of doc/lua-filter.md: "be" should b= e deleted from "will be try the following filter functions".

I see that the documentatio= n only illustrates how to not traverse footnotes. Should it also illustrate= how to apply a separate filter? The walk() method is new to me.

On Dec 13, 2021, at 6:15 PM, Albe= rt Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> wrote:

=
=EF=BB=BF
= jcr <ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

<= blockquote type=3D"cite">I find in Lua filters that I sometimes would= like to know whether or not
I'm in a footnote. Currently, I'm trying to move punctuation befor= e
footnotes. Given m= y citation style, I know that a Cite in body text will
produce a footnote, while a Cite in a fo= otnote will not. So I want to move
punctuation before a Cite when it's not in a footnote. Sinc= e a filter
function = for Inlines will descend into footnotes as well, there doesn't
seem to be any way to tell when = the Cite is in a footnote.

[...] at lea= st in the long term, I'd like to be able to tell whether
or not I'm in a footnote.

We just committed code[^1] that will help= with this: it is now possible
to let the filter traverse t= he document top-down (root to leaves), and
to prevent proce= ssing of all element children by using `false` as a
second = return value.

To exclude footnote contents= from being processed, one can now use

&n= bsp;  traverse =3D 'topdown'

&n= bsp;  function Note (n)
    =  return n, false
   end

If you want to apply a *separate* filter in footnotes, y= ou can write

   traverse = =3D 'topdown'
   function Note (n)      return n:walk(my_footnote_filter), f= alse
   end

You should be able to try the feature after downloading the next nightly<= /span>
build, which should become available at around 09:00 UTC.

[^1]: See https://github.com/jgm/pandoc/pul= l/7751/files

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

--
You received = this message because you are subscribed to a topic in the Google Groups "pa= ndoc-discuss" group.
To unsubscribe from this topic, visit = https://groups.google.com/d/topic/pandoc-discuss/4S38_f_-384/unsubscribe.
To unsubscribe from this group and all its topics, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To vie= w this discussion on the web visit https://groups.google.com/d/msgid/pandoc= -discuss/87fsqwo28w.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/p= andoc-discuss/F8CB6356-E282-40D0-BCB6-36D0C8FAAF1C%40gmail.com.
--Apple-Mail-01E3CBF9-6BFA-4AD1-A3A4-B2940DBFC501--