From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29773 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Albert Krewinkel Newsgroups: gmane.text.pandoc Subject: Re: Detectiing footnotes in Lua scripts Date: Mon, 13 Dec 2021 18:15:11 +0100 Message-ID: <87fsqwo28w.fsf@zeitkraut.de> References: <111b665a-1b7a-4856-bf37-d96780a07c24n@googlegroups.com> 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="5748"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCZJF7XJTILRBMP73WGQMGQEX4SZTPA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Dec 13 18:15:32 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lj1-f191.google.com ([209.85.208.191]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mwovD-0001Ew-FZ for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 13 Dec 2021 18:15:31 +0100 Original-Received: by mail-lj1-f191.google.com with SMTP id w16-20020a05651c103000b00218c9d46faesf4677418ljm.2 for ; Mon, 13 Dec 2021 09:15:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639415730; cv=pass; d=google.com; s=arc-20160816; b=ie1IEzJM+bZyxbJV6kVPt10nLBZptGTuwZQCKE1lW/3w3XNM7fC6E8VSPzzLBF99Vv 0gWQqyhcnIEapxZpnRyH6hVDZ3CF+hw8CXXvu/dX8IGR0E3z2xdvHr1PKaVl8su0qKKh vtF+olJpX5dOlquO9j3WapQ67cUH2W+NxVY+r0VKLcvIscksvJR4FFrA89AxX7ESHliY z8xqzAmFatMxrtHS5GGxTfptdW4IR3eg/QCrKzlyC1PGBfGtzg9hT8O34G6dvGDKQTYP mXnX8hTJcjA3T0EAHTIlzi6KsUHPf3M5oroQg0dK4kTRzWLAQbbegCzFEInOuCOTEt0g fDpA== 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 :date:in-reply-to:subject:to:from:references:sender:dkim-signature; bh=b1+xWUTlkxALUwAc0QNj1i0UqMyiyFxHNTft0j2Fybo=; b=Ch1xccj6ggy18j9Ze2vDVuJhN4t8r/eeD6J8Fd20Me2tzXKz/mNrOWqeehYUBmYyP0 /mavqeZgcOhY2WyFa38cg2LC8TY5Ey0EYfCTffhg5U5m+o7gWCPQY6VI+FFJtVeRaQRG a1tJOH0otj9LXlKDGLBN+e27fTmQ4h6rmD6KKHmrUmhfPY6rd7eTPeOotTppOb/S7Z45 PQnGmFKHo35mtPitnsIGKejAnAAX92zzJXA+FI2w9sFez4UWKoQRIcjCfTd8pkws/o43 Amh7qjj17OJQy3bf0LMImF69/2AIcQfJqVy7DEJmlE6LxBUwaDID3zrLQbgpT+U9SqDu 17Lg== 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.152 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:in-reply-to:date: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=b1+xWUTlkxALUwAc0QNj1i0UqMyiyFxHNTft0j2Fybo=; b=ihYndY7PAW+RAtPX8b6MB3Ar4IYkMFbWiZUj+P5xO0zKufEtE/473gmF4jTRoTzPWq xtvMG2wG+ITkapIlrZOMJORGdGYaefGmYD2EtOQw24pMnawUaE/h1jMYazQ05TBuU8+8 a2bWyJtU3Ir3BIy5Sn5YoM8L0HsZEmtUfuR3188Ri1DER2nHNgomv5ohAOzkvQzXLpeS 1CgBanwSmTy8/2Q4cOIisrvqV8ebnyGQ/X8qdbqo0hN3Bun5EsD5eFvW24yTVlJyoYgq JpmGn0RQzkp96anlpT6Wt6fTV9+Bd2QD+c52WyXGGXz+7RX+vdfg9F4TCvG/qOOViqda br+w== 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:in-reply-to :date: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=b1+xWUTlkxALUwAc0QNj1i0UqMyiyFxHNTft0j2Fybo=; b=QaewDXAz/4CFQkx7oA9bGRTXI5qv9mM94Tr13ra12Kj7bMS1tHCh47S8o+eqZ03vGj qyUntePoh5NF2jHp7hGrbOI7l518zscK9H/f3HytO8cuFNenIj99VLSkcH2knUShLdWB WVwIjumFbEaY8iS6MKSmLivT+CP91uOGzL/tccFlOrZaCuJAo7czPeNgBZpV9l8PME3y lDGF5WVttWHRRFZzVGWeN1LcPdsxq1lpiF29zTZrsE3FHu6QoJKiqd9YQH1orYPbOa/M oUxmnseo4gjl0ru/N714sNIOxGKlOlk50jwvPO1Mu2uq8GTCXXIwMOXufiI1MTcx1CNF M+/w== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM531Okxbsh+jJaFWs1Y+lNVMTazKQ680rjpzDGeapBuPk/p6Bi9BL BIxaKgU5isfYq3dN6Psd1C8= X-Google-Smtp-Source: ABdhPJzarx41dtjdQ2/q82s62G97NV5oAlVg/y+6s0OY1EO1kUm8mDgZUqHqjHTR9BwwA9tmO/pBjw== X-Received: by 2002:a2e:8502:: with SMTP id j2mr31299280lji.191.1639415730830; Mon, 13 Dec 2021 09:15:30 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a2e:a222:: with SMTP id i2ls2602250ljm.9.gmail; Mon, 13 Dec 2021 09:15:28 -0800 (PST) X-Received: by 2002:a2e:95cb:: with SMTP id y11mr31659997ljh.431.1639415728144; Mon, 13 Dec 2021 09:15:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639415728; cv=none; d=google.com; s=arc-20160816; b=a0v0jGkvy724LL//7GuApwZ6EEQIjrR0goQUIeRxG7ba+pFfgq74ofXKTJQUusYXnV 7oicFd3BzRbp5PcF8QjLwbHKt3EOFabBnv3HQbyH0Fn3VCl3wByZcpbeBkSRolhsrXlZ PjpMJZMGCcgDHPVD048M+u7mgK66uf8zSmkiYFLDsAVExkIAtwsXG351uRz5SeLTCmIH wupHODRsvucZp1nqDRzXEbslMg4eiDK/Uhddxkbjytf7dP+cMfapKPbgJicKZuX2U657 tUEl6bDQd6fKQnKqaZBksnk/XoqKrLn3hPuTU6sAA7riIHTBn1lq4mDPS3BmpwTgaihL mPNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:in-reply-to:subject:to:from:references; bh=pifdtAdZrpu8lrWtXC5Hkj3qfl90P869mLN6F+4BZDs=; b=JqOe09fFr5NmStEOauNkx5eZIHWIx59WRrp0YbELk8seNgxW5zu+3xLEnkDK9NMcRM rWUnleBtZefilRxSOvfxcROZof7CBZ7OnaDR7g8foumIsnal1LxOTeaXAgCCnY4aqxFM mjK1tTKB/U3vwsVqbetB8DdZL1ZsRLOUWprYZAOFZEpYWDIvZOMdnDwfwDL5Wx8VeWnM zu3VBtdD6BcPfAqjBvbyoH6ATbMrZ1jLHqB8Qw7pNbpfRk59E/G7IQE6Xki6BHDnpP32 u43QKh+Ubp4PkyYi5pYnOg8rFLxTZN9ifr0jWWJumBK/k+dYuJlFlny44RIII38ItmaA GcWQ== 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.152 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org Original-Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org. [80.241.56.152]) by gmr-mx.google.com with ESMTPS id k26si625624lfe.10.2021.12.13.09.15.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 09:15:28 -0800 (PST) Received-SPF: pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 80.241.56.152 as permitted sender) client-ip=80.241.56.152; Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (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-102.mailbox.org (Postfix) with ESMTPS id 4JCSnV0Lj4zQk3F for ; Mon, 13 Dec 2021 18:15:26 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de In-reply-to: <111b665a-1b7a-4856-bf37-d96780a07c24n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 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.152 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:29773 Archived-At: jcr writes: > 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 move > 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. > > [...] at least 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 the document top-down (root to leaves), and to prevent processing of all element children by using `false` as a second return value. To exclude footnote contents from being processed, one can now use traverse = 'topdown' function Note (n) return n, false end If you want to apply a *separate* filter in footnotes, you can write traverse = 'topdown' function Note (n) return n:walk(my_footnote_filter), false end You should be able to try the feature after downloading the next nightly build, which should become available at around 09:00 UTC. [^1]: See https://github.com/jgm/pandoc/pull/7751/files -- Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124