public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Detectiing footnotes in Lua scripts
@ 2021-11-24  9:49 jcr
       [not found] ` <111b665a-1b7a-4856-bf37-d96780a07c24n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: jcr @ 2021-11-24  9:49 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1428 bytes --]

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.

[-- Attachment #1.2: Type: text/html, Size: 1745 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-12-13 20:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24  9:49 Detectiing footnotes in Lua scripts jcr
     [not found] ` <111b665a-1b7a-4856-bf37-d96780a07c24n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-11-24 17:59   ` John MacFarlane
     [not found]     ` <m2y25dtoxb.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-11-25 19:02       ` FI Apps
     [not found]         ` <F6A8DF67-F34E-4FF9-A7A2-CF451E96D683-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2021-11-30 20:50           ` BPJ
     [not found]             ` <CADAJKhByRxPwZOqgkfkV6ZoSFfBZhHHX52mpyB36_ShLR40Gyg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-12-02 18:58               ` ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w
2021-12-13 17:15   ` Albert Krewinkel
     [not found]     ` <87fsqwo28w.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2021-12-13 19:08       ` ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w
     [not found]         ` <F8CB6356-E282-40D0-BCB6-36D0C8FAAF1C-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2021-12-13 20:20           ` Albert Krewinkel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).