From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29631 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: FI Apps Newsgroups: gmane.text.pandoc Subject: Re: Detectiing footnotes in Lua scripts Date: Thu, 25 Nov 2021 20:02:04 +0100 Message-ID: References: <111b665a-1b7a-4856-bf37-d96780a07c24n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13132"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDQLFNXWVILBBMF376GAMGQE7QVKB4A-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Nov 25 20:02:11 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lj1-f188.google.com ([209.85.208.188]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mqK0Z-0003En-5V for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 25 Nov 2021 20:02:11 +0100 Original-Received: by mail-lj1-f188.google.com with SMTP id g19-20020a2eb5d3000000b00219f21cb32bsf2102157ljn.7 for ; Thu, 25 Nov 2021 11:02:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637866930; cv=pass; d=google.com; s=arc-20160816; b=IFLrSc7khrr2tHLoQvnI4yBkwVimVAjMGSQF+GZ0Oj5N7YBGSGi4efqbb9d+62dwoh gyZ4S5SHw1gT7w0i1LfxxRG4nlr6FtYSfZEp6D2o6/xY69fcaKtKstvf/MPrwxbxeL40 Eg3fZgL/kX6JgLdFDKuBnaZ2ZZipc+iMMqAwwsbmDWJj2ypaAIBwTv34exjtTDqzR5qq rBWpInIpN8BMMl93hfB476ddIo/FoP+B0aam4jLjxWau4s6H5i5DME5o7PUUj4eL/CxS k4Mx71SgOzZeGrSkr7f0vpqsmmu/UQRFwqXeDKgs5Xe4qRiCXsipSyJ/kVjZMOVN4n20 4A6Q== 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:message-id:in-reply-to:to :references:date:subject:mime-version:content-transfer-encoding:from :sender:dkim-signature:dkim-signature; bh=uqZTO2voKDMl+cMPo4dufDLZ9y5B7H9lonw1sx8GUHo=; b=tCuvPIZLJX6ljZ3MCJpT8f1dMi0TD99BQTpHyDsk9X2MR0GlS9hGu7sO//ttZuUibh fS6Lpult6snZRwmHoiQgsl4/0GXn7G5y24VamEd0P8T4J0b2XyC8eO7Rbz36gt4Qm5iq da2pJFgY3ibf7HD0HSYj1I8tNL+t7RfdEy7Oijv9QKQKHtZOdWOrh4ZcJTXMtRYaQ+kW 9gSmvMml1pJGyv1r5eexdSr2FXQRzulUNyEFweHkzxpYAPUNC0Xdq35IVZYxlPGFvI2g +rhRg4flrbu/vH1IF/f5tyD+fZ5XmSpx6Kb4KSn9zlgTu6NWGqwTRUBM0VZbj6eZxVcD Mr1A== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=E1iiC4jp; spf=pass (google.com: domain of ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::529 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:from:content-transfer-encoding:mime-version:subject:date :references:to:in-reply-to:message-id: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=uqZTO2voKDMl+cMPo4dufDLZ9y5B7H9lonw1sx8GUHo=; b=OSrDsG1eamAocZjspCvqImhtxHe5Fn9K06WeM3DFLSVhqcJg49bfEvr1CgNSm2t7QZ xaUrSu5dMs8mJUGkrn0uHj+A1+nKjRemq0quabTzvA8Y2G17GDM9i6RAZ2rd52s2cpxt 21P+Dr2TNRZV/bHbk8HBo01kIask0gq7ohTC5cjOjsFitDyfEzU5sx5vmoPJViSzRJ1a ZXDUa4vCx99aTRNdCLwZXdBBpnfNWNcztmuRsNf6d+ju3FGlJzkO7Ck5P3ykcaetGFu1 3B1Kwe843lGhWYcs8w85VRzPPpSLAcb4HOVUiFG/rtVdJFEtbkPfBOpWUmvxH6AC07Vp C1eg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id: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=uqZTO2voKDMl+cMPo4dufDLZ9y5B7H9lonw1sx8GUHo=; b=PeQ8SS1xPaRcdRf+0lNLgNjMzYrnzDqEoTvSOobJyGK2r1d6PdPyItuylGRpuFpOSA Ua0p1YhpeOgAuHjB6/oIRZR9SpFgIPH1iUc43GhkHVmOVi42edewMAhrmcnSmx7OJOEB E7A1KohlDKBGsCQLUKGNvRlHsUjQKi/vRVhlBdyk7mdtUvpY1t+qsGS1ISp2oEMOxk6H neLiluBipu+lkA997WRs0zNbME7qtgXfX/jyYzTUffozzmZMffqlwZMBfOPwkTYO6NUL +DdFK6KGdFrC/ieoDp2MTP93lUHJZ55Qk6AoYZHR3c4IY++/cUEx3QvufN2+cONmtJnp RjbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:content-transfer-encoding :mime-version:subject:date:references:to:in-reply-to:message-id :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=uqZTO2voKDMl+cMPo4dufDLZ9y5B7H9lonw1sx8GUHo=; b=u3/20AryuCce8XlzRO553kdge4XGerS1tvY3vWGWkM7t+brb9wyuiOX+TbKH+2YRzr PiK+MBK/IEphjmGEv1eeuW26nOXacbpL7mZ9GvaVCdXbi3U3mkFGB7SU2+ersRPB25Tw DqZpmgPj8QzNvU2LPd6C27j24Kx1jUkstusWx/RVSKlWOcSzO0IPfkBDPlNtcyQuMlgl nj6gpDFNODJlzWZFo9q7wfiFJesg7ztkDkuvWLYPvHbGwgx5DHZf13BJN7SCNSGvQgeh qJXb6L+xgzPnaHtt5skefDwxZ/v97tzNSIOr+PyV8byZBs7XP5F+xQ7vFGKZryd+y1W2 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM533+MBy8foxDjdsJsM2lKDCKbPgsOeQzwD+cnZSRTg55cEZ1nwmE +sP0iCHa8iRjL/B4Qvsxvno= X-Google-Smtp-Source: ABdhPJzo6lJMqAEUIT1YWcOPxvUff0D78i0LvovH17uC3D8dPQqMcFnmD2S2Kzm6oD5mrMlN8AiKsg== X-Received: by 2002:a05:651c:503:: with SMTP id o3mr26096480ljp.249.1637866929967; Thu, 25 Nov 2021 11:02:09 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6512:3e10:: with SMTP id i16ls674634lfv.3.gmail; Thu, 25 Nov 2021 11:02:07 -0800 (PST) X-Received: by 2002:a05:6512:33c4:: with SMTP id d4mr23640492lfg.182.1637866927450; Thu, 25 Nov 2021 11:02:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637866927; cv=none; d=google.com; s=arc-20160816; b=gktoeGWVD745vjr5fNJMApmNXOtuMswL03oz2Hdq/feKWIPJtylRXcMU1a+GchK2jB T7CMLfbUxBKhRXlrWfXFeKFolLgkoisZdFhZ/TbDlO+ZyJtzh44KmQpe3rNuC1mpR+PF ZH6WWV+PekgHzBWle/c8T1D1zjyxNL5Nbm7tVvktN9gNjYti6D+J4UQMx+AjQ/sbU/nG l0KLfcKCc/2/A7fEl65dx+b2lwPU4d+wqbooQVzXDBMbw819yvigfSOIqOWelPsfYwSz DGggKiDM/LRj4LA2AfU//FMW0tpGzAliMe7xjvn4mahZwldQu0/tZ8b0NCaY0EqvZYfh fnvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:in-reply-to:to:references:date:subject:mime-version :content-transfer-encoding:from:dkim-signature; bh=qInYe16JesR58fwBxuUGrp7/b4BZt4fLjj7/VzdocOM=; b=i0/Eirm4lNg02yfWGa/q3tAjwKphajiLDS4h+rTXuy+gXL38kNtJo4HsrO6VJUliPb 5SRFhxBlaPC0d22i2Q33El68fvUaupT2m8dD4i+1OjYpY2DlEiiV6pdJxcXHALnKSgqz 1Sl+XZGdMxfG5VINGCXBhtvOkM4Q+jTZLboHoZa++2oR9hq9/jIEuBnqcB2S3PelVp+8 nEeAuRhOv+uFsadXmB8GFF23G01l1FX+1gIlRST7lTw5gmf/drN4QqTsFKiwfHW68UR3 McawQFS4TNVQ63flYgvBReW/TzswYHxOCVMxV5W6n37Tr6jxmewaAeOJC/D+3Q5K8BcX l1Zw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=E1iiC4jp; spf=pass (google.com: domain of ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::529 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-x529.google.com (mail-ed1-x529.google.com. [2a00:1450:4864:20::529]) by gmr-mx.google.com with ESMTPS id j13si327759lfu.5.2021.11.25.11.02.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Nov 2021 11:02:07 -0800 (PST) Received-SPF: pass (google.com: domain of ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::529 as permitted sender) client-ip=2a00:1450:4864:20::529; Original-Received: by mail-ed1-x529.google.com with SMTP id z5so29461903edd.3 for ; Thu, 25 Nov 2021 11:02:07 -0800 (PST) X-Received: by 2002:a17:907:7f1a:: with SMTP id qf26mr33498013ejc.543.1637866926823; Thu, 25 Nov 2021 11:02:06 -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 nb4sm2157289ejc.21.2021.11.25.11.02.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Nov 2021 11:02:06 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3654.120.0.1.13) 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=E1iiC4jp; spf=pass (google.com: domain of ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::529 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:29631 Archived-At: The particular case I=E2=80=99m dealing with is fixing a long and complex t= ext that followed an Italian style in placing punctuation after footnotes, = even though the text is in English. The script is a one-off, but since ther= e are over 1000 footnotes, fixing it with a script is the easiest solution.= Since I=E2=80=99m using BibLaTeX, I could tell it to move punctuation for = footnotes generated with Cite, but it just swaps the footnote and the punct= uation: it doesn=E2=80=99t move periods or commas into quotes that may prec= ede 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 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 will= =20 >> produce a footnote, while a Cite in a footnote will not. So I want to mo= ve=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 Ci= te=20 >> in a footnote will either be the first element or will have a Space befo= re=20 >> it. So with that assumption, I can look for the last innermost element= =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 least = in=20 >> the long term, I'd like to be able to tell whether or not I'm in a footn= ote. >>=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/111b665a-1b7a-4856-bf37-d96780a07c24n%40googlegroups.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/F6A8DF67-F34E-4FF9-A7A2-CF451E96D683%40gmail.com.