From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29608 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: Detectiing footnotes in Lua scripts Date: Wed, 24 Nov 2021 09:59:44 -0800 Message-ID: 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="22409"; mail-complaints-to="usenet@ciao.gmane.io" To: jcr , pandoc-discuss Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBHH37GGAMGQEZ6YANJI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Nov 24 19:00:01 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f64.google.com ([209.85.210.64]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mpwYp-0005ZV-9R for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 24 Nov 2021 18:59:59 +0100 Original-Received: by mail-ot1-f64.google.com with SMTP id 61-20020a9d02c3000000b00553c97d94absf2066826otl.9 for ; Wed, 24 Nov 2021 09:59:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637776798; cv=pass; d=google.com; s=arc-20160816; b=H0aYieqdS3dNQbp7w5q90z5ngVeCpGO+Ow9xgIjLz+2PjEm483P1zBz/2GObCISnQ5 yIotVpEcPaaEBpZa73QQKOZQRd+1fDG2d7rvSlcwfKPlPzk0IELOCzjM61cXdT4827sg GY8Rf3Nw6uoL+eWVIkCOPeZsgyOUWr7evJ8Lo/ho7KjFTIm3OWiYTSjfVVgcr1Mmka6y ZJmcOyXhyolyc6VznsoS964TwqsAL7FVOIU5j9ddZQX7QE5iGiNDwIMI/YS0IjeViLkH fBr3hd5Qwoh4aizklQW3BBhEQ4bEDbpB+Cw0wd5jM81uyzrFIn/RfKOFE+feQxkfuGY0 +Cqw== 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:references:in-reply-to:subject:to:from:sender:dkim-signature; bh=7vKYbNRK1v/0bPNyiur7+yJiEhXEZYYHoggRtmyaZdU=; b=eZkUOPx38e7qB1CD4k6+rr5urqlcB5DPCZSgCto7gI9DUyJkWScPDpEVaJMksUSnoM fTQ88wpvpE1poV5LycNy7JQ4NyI3jpQ6oM9NHxo7xmGscdcn7vWsLfm49q/XQvbZxHLb n7r+T3GqB+yX8PGOegnEQ5hVRDXoYw2W9jDDJbn2p+ANW5ayIgr1DQcA9SkEWGehWak3 e9FyviNapuu09SiKQh/munoj6kLOcRDsKxCgxdaGHeDc3ZQTgRJeHPU8HuBwHiO7pau4 zmbivPaRRLBwbDEPl4CjKJaiHbuiq07J6dM6qmUm3soqZpWk+k5vW0FtOY2eJXAg2c7S eNJg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20210112.gappssmtp.com header.s=20210112 header.b=SsaqKDOr; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::630 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:from:to:subject:in-reply-to:references: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=7vKYbNRK1v/0bPNyiur7+yJiEhXEZYYHoggRtmyaZdU=; b=Kal3EPcN2wAZ63ox+geLwFSKlHpDZWM5eWs3WuhE8AxFvAVBn18yC2UU7PlGDi7JkO kwIRjHKLR2rPFG1zAUlO9FOfnFs7koDRuw1bp83oBdn2lxKeIKcJ6rB7aitzI4kitW1Z CMjbBIG7K+jZM+qlwdZ0ImYltwgXijLPFOECegS3KUcIvQ086DUGA82kV+kaQwhkT406 /uqh3WrANcLQ7+Jet372fSR9EL1n0LLxL7f+SAytmVA9MYtaLyFxkBWY0EzoSBCVG1en J/qXLjjqV7DshSV6XPj6gAZ4KZwmhhBsPxptL83aAbQWJ0wE2yGuTIWJn+j2//wHNmmL o1IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:to:subject:in-reply-to:references :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=7vKYbNRK1v/0bPNyiur7+yJiEhXEZYYHoggRtmyaZdU=; b=tECCbAbcJcao/4MddtabAr9rAvPJopSGTVArTooI8EUv8wbMEHIq9LhpRAyONkuUe4 UbllqB9omD31IcY+ppTQj2OSi64HC10KBI0PsNeNXQcW1HXw/w0SPyaktsvLrwa+k7JD k1xbNJWuXOazN6YFukH971r/4pwISnbz8BWeCqKxLCGiDM0oJKhr2ytCMxhNPVIdtrVt 0Ts4cTKeelntnX6CqwpOuHTMISpMudTUJqgO0FjfeFpc83KYEO8bLYPlheuHTSM+ARQL 6ReB6X/TPCGfkTmopS/O9sfYj0gt1N1eJvUjcEkIyMD+DgxKaWMaWUDPx4Gs/LLfCkOV RESg== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM530BPtKsZnRhBizkCXY3FYumx4qNvQB4/+dhc696lIvqDMyO67WI CB4br1tbdqj1D+kB8l6tKkY= X-Google-Smtp-Source: ABdhPJzureAWlR5LFNRN0NEVcutu/Cu47tl2cOdVhR0EQ4GJkHBmd6eIEDZPlziDsbucsQsJ6uDVbg== X-Received: by 2002:aca:df82:: with SMTP id w124mr8145514oig.171.1637776798003; Wed, 24 Nov 2021 09:59:58 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6808:d48:: with SMTP id w8ls169963oik.8.gmail; Wed, 24 Nov 2021 09:59:56 -0800 (PST) X-Received: by 2002:aca:1303:: with SMTP id e3mr8234903oii.101.1637776796493; Wed, 24 Nov 2021 09:59:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637776796; cv=none; d=google.com; s=arc-20160816; b=ksEhz0PN0VlPgCX+1pOCXjZBUoR5O/Ybl26ax9D9JWy3PCXGemnBc13+JduavILlX4 aVhJvDeU4pMkegk6bGZrsjSEVl05zxzNFc8Qsxj0eC5pdoUZ/bHnS7UULUUOGgNd6tpl Om8H0LAoyH4eo3uZL+4HbAdm3DHSd3tgZjMd9X6/2eKcmFWiD8LOrX9JDVsxEODA3og5 7ahC7gKfYOcNl3gNYuzdnQcP9EDGxlkehfV+9lCGl/E29cdsEUsnL0/wHEvh6ZtOeMqX d0HgpMMD7DFZC/Ycbf4Z7VUZ+/HLQFlM/mCfCd51f6F0wDBQ04veKLe0F+YNxifOTaoo rI1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :dkim-signature; bh=FAd5WR4zm5DdsDILbgo7MjYdhsCtK1QBfRobUhjx5R0=; b=BUQ+/viNIQ8EQcM82so399fSqhKmL+w8biJEfMe9fhioMfzP4qgTCUfLbPLuyqulxF OhfdPMyc535QnrGerKYBSXiBK1LeEmuqwhOLpoyUvr3L2Ev/m+bpAw/Q1BHCJsMEGyUZ THwzo/2VUeJAw1fToa9D/0asjUSBDA9XNqut7Q5SHBwWm0l82dQk4/b8AqeOzXK3Xn/X wK2uMWXWXD4yXvFAFAfMvE5to8G+WvhS0rWMCup8oyucdERULQ3UrxeHFsFNsCCKODdt LjdRwyYqQcouGAviYTPebvSic+h9RMxfZfCmXQO1gzdUsdIEnM1NKJi+kexvwmWjGMpD eNrQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20210112.gappssmtp.com header.s=20210112 header.b=SsaqKDOr; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::630 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com. [2607:f8b0:4864:20::630]) by gmr-mx.google.com with ESMTPS id p6si35323ots.0.2021.11.24.09.59.56 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Nov 2021 09:59:56 -0800 (PST) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::630 as permitted sender) client-ip=2607:f8b0:4864:20::630; Original-Received: by mail-pl1-x630.google.com with SMTP id y7so2538571plp.0 for ; Wed, 24 Nov 2021 09:59:56 -0800 (PST) X-Received: by 2002:a17:903:120a:b0:143:e4e9:4cdb with SMTP id l10-20020a170903120a00b00143e4e94cdbmr21026274plh.89.1637776795664; Wed, 24 Nov 2021 09:59:55 -0800 (PST) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id r2sm268253pgm.4.2021.11.24.09.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 09:59:55 -0800 (PST) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id 6E4FCA24D; Wed, 24 Nov 2021 12:59:44 -0500 (EST) In-Reply-To: <111b665a-1b7a-4856-bf37-d96780a07c24n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20210112.gappssmtp.com header.s=20210112 header.b=SsaqKDOr; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::630 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@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:29608 Archived-At: This is a limitation of the current architecture -- there's no way to determine the "parent" context. Sometimes you can work around this by using walk_block to do a transformation inside a particular kind of block (e.g. a footnote) -- but in this case you want to do the transformation OUTSIDE of the block, and that's more difficult. Doesn't pandoc's --citeproc do this punctuation moving for you (in the case of citations automatically added as footnotes)? If not, try setting `notes-after-punctuation` as described in the manual. (If you are talking about footnotoes you insert explicitly, instead of citations that become footnotes, then this doesn't apply, but in that case why would you need to adjust the punctuation?) 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. > > In this particular case, I can work around the limitation because any Cite > in a footnote will either be the first element or will have a Space before > it. So with that assumption, I can look for the last innermost element > before the Cite and check its type: if it's a Str, can append the > punctuation to it and delete the punctuation from where it was. if it's a > Space, I do nothing, because I must be in a footnote. However, at least in > the long term, I'd like to be able to tell whether or not I'm in a footnote. > > -- > 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/111b665a-1b7a-4856-bf37-d96780a07c24n%40googlegroups.com.