From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29661 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: Thu, 2 Dec 2021 19:58:12 +0100 Message-ID: References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 (1.0) Content-Type: multipart/alternative; boundary=Apple-Mail-1CBE3C3E-DA67-4D6E-803C-7D82F69DD09B Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15767"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDQLFNXWVILBBR5OUSGQMGQETH2CFSQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Dec 02 19:58:19 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wr1-f57.google.com ([209.85.221.57]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1msrHe-0003sv-F0 for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 02 Dec 2021 19:58:18 +0100 Original-Received: by mail-wr1-f57.google.com with SMTP id c4-20020adfed84000000b00185ca4eba36sf91258wro.21 for ; Thu, 02 Dec 2021 10:58:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1638471497; cv=pass; d=google.com; s=arc-20160816; b=DZiBIDWDdMiqUAZk9yTTVOuL3Um7iidWtz0klF7+E/29p3Jzu289y8SATtBiOI2ZMz SFDFjNS6usjsQkkxGfw2C0U8Iub00YPYfoqfiEitzyopR8W9aYsmEjeIGQCidEtuntyn 28ey8mADJFzWV3ADeDlpnJX3qhZF+BG0n9hV/m7LbsX7gzigQSgxJTnjH1dEeaGbU96c ZinurBhJJzCJZZPhRZf9jNW7KCxRGDKXLD7l7dt6g2FWC/EMwP7ch9VAomDBfRZ93Y4W EqHPuA2BLCF79CD/cClYdZeHmM+n69xzwlXwmORs/9wdkmEvxYpAjYHxm1+gHumYRzqt Kyhg== 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=Vqz8DpxaxOx+dxPmKw0sNU7emuTXA+0Vrfq+MDbxCsQ=; b=KmeXrk5UUZy3xLCLmp72i4ThOdBPhPDCRULJOyDdQsHnqn3Y0NBL4nJAx7bEUqABFG t0XZSUhKNf8d76IqzftlN5CViMgKDt4GoFXJfwrfXNBx39mIYgDjnUfX5QI2heC1O3Rd APkno85pN1fNnqXVCwdWC8hFLOiiJK2rFGQctlbAVvgh9ahqKqDE12UFO4J5TEoNnBHz oK/YSm+322ygPzgadV8fGQDk4obAqpw02Kpsm/7mXCqTKGI0m5UmWsX8QItHh7OiPSzI z+2Plg1cztXXl8cGaUs8w21adhSmPYvgbADdQSI0HHGzfzhxbAgmmrBo1u9sUeAP3cA8 ie/w== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LiTJeZiN; spf=pass (google.com: domain of ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::52d 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=Vqz8DpxaxOx+dxPmKw0sNU7emuTXA+0Vrfq+MDbxCsQ=; b=QRXGWQ5J70m4VIB3dxdgdCIU2x/7+LwBMj0JJuMHeZagvhIsQoUc+4CMPxBhactthc TjEWZRoIdZ+oXUwO/S1gu8gVcQYRrbQupSMLVuQjsmWVL8sxTaGLpuUjlPTV6f0OLgmh 6mmRMMwKckrExXCcGVkF2mw1yDVJ7HZyqBFC+lgdwnwQ9qfCvEpSKnPURpUsUPrnJqgA Bh054a4pPtoXI4rchWfRa2GwhMXqIRcbx5smcbcD4TJlZt715nXfl4yYeW/or08lDiVe Jo7Mk//YeAXLT/+bbVHtGg9N63zSa7qlkOY8AGVGIhvAWu/5GmB/ePySWHU6lfQu5vJK JW8A== 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=Vqz8DpxaxOx+dxPmKw0sNU7emuTXA+0Vrfq+MDbxCsQ=; b=PSBVWBpCFTM9Fkj0sirILLtpTx3iohWzQMb4I4jTZnnrqbK+XJtwzOOjVq+Sv5V6gd vgpP5TkOVMPtlOYS9PxiwOPMq7J4p9pocLHjgD9+PSIdlXqiOEILtdaOd+RKZFTUplEl HuVUZXaaqKMKDyttPJPsZZqYLHAyQ8jBYflfVFQorfSOPVFAc02BIp3ljlOtxnGptPV9 aVv9mAYioQzr3nYS3q5OqrylvWuMPxPkRfWQzGZXA53lHqKsmij2UpcHzEa058N2kzF5 Z4V9vD8Z6gm7EfhV/3Q5lrrdYDjwW3yRqSwfxtPArsWHNQbWkTGi4tw4wMd2ruQ4qNUn L0aQ== 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=Vqz8DpxaxOx+dxPmKw0sNU7emuTXA+0Vrfq+MDbxCsQ=; b=zkgWC2wAcq9z8W8607mcQEwcoGwSgW0S/eguK5WrAqNSTzNi7h3SRtPj+pX71LkM/7 K0yo3yZgsy1iCS9p/VvetOoyL5eXlcWZtiKnjxdA9AMCewM35hsG3lizrsbxYCrL/PPw KIa1iJ/hH7T370QuQP5OHPvySX4mZfPCmm1MUoqO8yf1irLGjPb/5GhoO2l4Wlq5yxqE ksl6q5WvJ0FQZ4+ukXPHiJavNmlW0bgP2hqpKNsvCfoBDanvZhek52LtMgVCbM3ULL1z eoh5lzIqBuuTBM5DIf6D23GFJahB7Lj8rwUcEIWFs7pruLK9xxmxIxhWsIANL/mUoK21 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM530wU6KZej3Jp3deki1AiAw/vogHU8e12Gl6i/VnpYAtAa4X64Yn e1k7nYrOKfDus6Gy8onqdjo= X-Google-Smtp-Source: ABdhPJzJhrRZX+umoGrJdhvTaXZ3RQxZgsZeabxJZ/gYb5j/jWQYsOcNjLqYDaFcQI+qfCwsuSC0Ig== X-Received: by 2002:a05:600c:1083:: with SMTP id e3mr8426335wmd.167.1638471497540; Thu, 02 Dec 2021 10:58:17 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a1c:416:: with SMTP id 22ls5493784wme.0.canary-gmail; Thu, 02 Dec 2021 10:58:15 -0800 (PST) X-Received: by 2002:a05:600c:1e27:: with SMTP id ay39mr8671369wmb.84.1638471494939; Thu, 02 Dec 2021 10:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638471494; cv=none; d=google.com; s=arc-20160816; b=Yaj+GBXhk4krKhsVwi4p8/0iWtCM21G0J8PIZUez3behOW0jnA8h3IaxdmGXYZM7wT 2lR0us+RHOiWQTP3xZBYpFLamAaz1oKDrsCitUcX+pd0forpGCofGupVRxR5zQO/qTOG yP7tETeHLp8D5rwMsqcKvhc6iiSXAyXCTCrCywCRmtQyj6c7mYJxo70WIpd2ALTGsvhY LylltSd2RVmCrbr3wq3RNsiB3Tbha7Fw2pQva1J7r5kdjdvWrkw2Q4aC+swxpAqaZNpM 2OeaLkrV4fivs/U5Nrli1SdxbFLjeRUhDs9t3Ujb4I+bsM3DfP2ZVZWJYmBZLDpbgdGj aGfg== 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=9v1kNHK9apUUfftYWp8fFyMUSOY+gFSYf/JxBQo60YE=; b=c/tmf0PJPqWisSCvzUEbYbfdAopWq1jYnrqRwrQQ/vUeRPLO1dEsTDRb7OQSlGB9bt sFeuC9S/O/+NOoHA78eBQWbVY5N7rDaCxwyk7IYrCj4J6SunR/IdEf0BQ/zrk+BsruUE HtiDDWikIaYWHP6EHK4dmcXNyfXco4wDO5ybAb6KIh6iVKzrhuVnAHeESFvyOXu6zVG8 ANccWO/chiMtA+sBOGHMCwEzlW4xRI1ueFiX13D60pnM8QyhklOXeBolItJCtQ5gqJq5 apfTmx9oicts32xcPBC+VbG7xrksXZludYJyERvVpiA5r/yOwLQbBS13NY6zxOU/l+j0 9T8Q== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LiTJeZiN; spf=pass (google.com: domain of ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::52d 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-x52d.google.com (mail-ed1-x52d.google.com. [2a00:1450:4864:20::52d]) by gmr-mx.google.com with ESMTPS id o29si127246wms.1.2021.12.02.10.58.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Dec 2021 10:58:14 -0800 (PST) Received-SPF: pass (google.com: domain of ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::52d as permitted sender) client-ip=2a00:1450:4864:20::52d; Original-Received: by mail-ed1-x52d.google.com with SMTP id l25so1772444eda.11 for ; Thu, 02 Dec 2021 10:58:14 -0800 (PST) X-Received: by 2002:a05:6402:1911:: with SMTP id e17mr20256939edz.326.1638471494572; Thu, 02 Dec 2021 10:58:14 -0800 (PST) Original-Received: from smtpclient.apple (host-87-17-52-11.retail.telecomitalia.it. [87.17.52.11]) by smtp.gmail.com with ESMTPSA id hc10sm404874ejc.99.2021.12.02.10.58.13 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Dec 2021 10:58:14 -0800 (PST) In-Reply-To: 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=LiTJeZiN; spf=pass (google.com: domain of ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::52d 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:29661 Archived-At: --Apple-Mail-1CBE3C3E-DA67-4D6E-803C-7D82F69DD09B Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I appreciate this clever solution, and will keep it in mind for the future,= but I hope some simpler way of identifying elements in footnotes will be a= vailable the next time I write a script that needs to know. > On Nov 30, 2021, at 9:50 PM, BPJ wrote: >=20 > =EF=BB=BF > One way is to make several several passes. In the first pass you wrap all= Cite elements in Span elements with a class which does not otherwise occur= . In the second pass you visit Note elements and use `walk_block` to again = unwrap those Span elements inside footnotes. In the third pass you use Inli= nes to find those Span elements elsewhere, unwrap them and adjust punctuati= on around the Cite. >=20 > You make a multi-pass filter script by returning an array table with seve= ral filter map tables from the script. >=20 > ``````lua > local function wrap_cite (cite) > return pandoc.Span({cite}, {class =3D 'is-cite'}) > end >=20 > local function unwrap_cite (span) > if span.classes:includes('is-cite') then > return span.content[1] > return nil > end >=20 > local unwrap_filter =3D { Span =3D unwrap_cite } >=20 > local function unwrap_in_notes (note) > local old_blocks =3D pandoc.Div(note.content) > local new_blocks =3D pandoc.walk_block(old_blocks, unwrap_filter) > return pandoc.Note(new_blocks.content) > end > =20 > end >=20 > local function adjust_punct (inlines) > for i=3D1, #inlines do > if 'Span' =3D=3D inlines[i].tag then > local cite =3D unwrap_cite(inlines[i]) > if cite then > -- move stuff around! > end > end > end > return inlines > end >=20 > return { > { Cite =3D wrap_cite }, > { Note =3D unwrap_in_notes }, > { Inlines =3D adjust_punct }, > } > `````` >=20 >=20 >=20 > Den tors 25 nov. 2021 20:02FI Apps skrev: >> The particular case I=E2=80=99m dealing with is fixing a long and comple= x text that followed an Italian style in placing punctuation after footnote= s, even though the text is in English. The script is a one-off, but since t= here are over 1000 footnotes, fixing it with a script is the easiest soluti= on. Since I=E2=80=99m using BibLaTeX, I could tell it to move punctuation f= or footnotes generated with Cite, but it just swaps the footnote and the pu= nctuation: it doesn=E2=80=99t move periods or commas into quotes that may p= recede the footnote. >>=20 >> The first time I wrote a script that needed to know if it was in a footn= ote, I resorted to the solution you suggest: I wrote a filter function for = Note and used walk_block. But since this is the second script that wants to= know whether or not it=E2=80=99s in a footnote, I thought I should mention= this as a desideratum for the future. >>=20 >> > On 24 Nov 2021, at 18:59, John MacFarlane wrote: >> >=20 >> >=20 >> > 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. >> >=20 >> > 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. >> >=20 >> > (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?) >> >=20 >> > jcr writes: >> >=20 >> >> I find in Lua filters that I sometimes would like to know whether or = not=20 >> >> I'm in a footnote. Currently, I'm trying to move punctuation before= =20 >> >> footnotes. Given my citation style, I know that a Cite in body text w= ill=20 >> >> produce a footnote, while a Cite in a footnote will not. So I want to= move=20 >> >> punctuation before a Cite when it's not in a footnote. Since a filter= =20 >> >> function for Inlines will descend into footnotes as well, there doesn= 't=20 >> >> seem to be any way to tell when the Cite is in a footnote. >> >>=20 >> >> In this particular case, I can work around the limitation because any= Cite=20 >> >> in a footnote will either be the first element or will have a Space b= efore=20 >> >> it. So with that assumption, I can look for the last innermost elemen= t=20 >> >> before the Cite and check its type: if it's a Str, can append the=20 >> >> punctuation to it and delete the punctuation from where it was. if it= 's a=20 >> >> Space, I do nothing, because I must be in a footnote. However, at lea= st in=20 >> >> the long term, I'd like to be able to tell whether or not I'm in a fo= otnote. >> >>=20 >> >> --=20 >> >> You received this message because you are subscribed to the Google Gr= oups "pandoc-discuss" group. >> >> To unsubscribe from this group and stop receiving emails from it, sen= d 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.c= om. >>=20 >> --=20 >> You received this message because you are subscribed to the Google Group= s "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit https://groups.google.com/d/msg= id/pandoc-discuss/F6A8DF67-F34E-4FF9-A7A2-CF451E96D683%40gmail.com. >=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/CADAJKhByRxPwZOqgkfkV6ZoSFfBZhHHX52mpyB36_ShLR40Gyg%40mail= .gmail.com. --=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/EBA1C46A-D0D0-4AA5-B97E-29F1DB97AEEC%40gmail.com. --Apple-Mail-1CBE3C3E-DA67-4D6E-803C-7D82F69DD09B Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I appreciate this clever solution, and will keep it in mind for the future= , but I hope some simpler way of identifying elements in footnotes will be = available the next time I write a script that needs to know.

On Nov 30, 2021, at 9:50 PM, BPJ <= ;melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

=EF=BB=BF
One wa= y is to make several several passes. In the first pass you wrap all Cite el= ements in Span elements with a class which does not otherwise occur. In the= second pass you visit Note elements and use `walk_block` to again unwrap t= hose Span elements inside footnotes. In the third pass you use Inlines to f= ind those Span elements elsewhere, unwrap them and adjust punctuation aroun= d the Cite.

You make a m= ulti-pass filter script by returning an array table with several filter map= tables from the script.

``````lua
local function wrap_cite (cite)
  return pandoc.Span({cite}, {class =3D 'is-cite'})
end

l= ocal function unwrap_cite (span)
  if span.clas= ses:includes('is-cite') then
    return sp= an.content[1]
  return nil
end

local unwrap_filt= er =3D { Span =3D unwrap_cite }

local function unwrap_in_notes (note)
&nbs= p; local old_blocks =3D pandoc.Div(note.content)
&nb= sp; local new_blocks =3D pandoc.walk_block(old_blocks, unwrap_filter)
=
  return pandoc.Note(new_blocks.content)
end
  
= end

local function adjus= t_punct (inlines)
  for i=3D1, #inlines do
    if 'Span' =3D=3D inlines[i].tag then
=
      local cite =3D unwrap_cite(inlines[i= ])
      if cite then
        -- move stuff around!
      end
    end=
  end
  return inl= ines
end

return {
  { Cite =3D wrap_cite },
  { Note =3D unwrap_in_notes },
  { Inlines =3D adjust_punct },
}
``````

<= br>

Den tors 25 nov. 2021 20:02FI Apps <ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
The particular case I=E2=80=99m dealing with is fixing a long= and complex text that followed an Italian style in placing punctuation aft= er footnotes, even though the text is in English. The script is a one-off, = but since there are over 1000 footnotes, fixing it with a script is the eas= iest solution. Since I=E2=80=99m using BibLaTeX, I could tell it to move pu= nctuation for footnotes generated with Cite, but it just swaps the footnote= and the punctuation: it doesn=E2=80=99t move periods or commas into quotes= that may precede the footnote.

The first time I wrote a script that needed to know if it was in a footnote= , I resorted to the solution you suggest: I wrote a filter function for Not= e and used walk_block. But since this is the second script that wants to kn= ow whether or not it=E2=80=99s in a footnote, I thought I should mention th= is as a desideratum for the future.

> On 24 Nov 2021, at 18:59, John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> w= rote:
>
>
> 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 <ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 befor= e
>> footnotes. Given my citation style, I know that a Cite in body tex= t 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 fil= ter
>> function for Inlines will descend into footnotes as well, there do= esn'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 Spac= e before
>> it. So with that assumption, I can look for the last innermost ele= ment
>> before the Cite and check its type: if it's a Str,  can appen= d 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@goog= legroups.com.
>> To view this discussion on the web visit https://g= roups.google.com/d/msgid/pandoc-discuss/111b665a-1b7a-4856-bf37-d96780a07c2= 4n%40googlegroups.com.

--
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@googlegroups.= com.
To view this discussion on the web visit https://groups.google.com/= d/msgid/pandoc-discuss/F6A8DF67-F34E-4FF9-A7A2-CF451E96D683%40gmail.com= .

--
You received this message because you are subscribed to a topic in the Goog= le Groups "pandoc-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 email to pandoc-discuss+unsu= bscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://gro= ups.google.com/d/msgid/pandoc-discuss/CADAJKhByRxPwZOqgkfkV6ZoSFfBZhHHX52mp= yB36_ShLR40Gyg%40mail.gmail.com.

--
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/EBA1C46A-D0D0-4AA5-B97E-29F1DB97AEEC%40gmail.com.
--Apple-Mail-1CBE3C3E-DA67-4D6E-803C-7D82F69DD09B--