From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33367 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "'William Lupton' via pandoc-discuss" Newsgroups: gmane.text.pandoc Subject: Re: Moving footnotes to just after paragraph with the citation Date: Wed, 22 Nov 2023 12:54:29 +0000 Message-ID: References: <868187f2-1fd4-4009-b48e-2a948749b518n@googlegroups.com> <3b95f72e-34ba-486b-9b5d-2b0d01a49088n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000e8b874060abd385d" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8923"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCS4HJ6WSAHBBEXU66VAMGQEU55CAQA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Nov 22 13:54:48 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lf1-f58.google.com ([209.85.167.58]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1r5mkh-0001vs-Op for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 22 Nov 2023 13:54:47 +0100 Original-Received: by mail-lf1-f58.google.com with SMTP id 2adb3069b0e04-507e110795asf1277478e87.0 for ; Wed, 22 Nov 2023 04:54:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700657687; cv=pass; d=google.com; s=arc-20160816; b=0shrjlQlHkEDHx1+5HcIuXXlacBSUWr4mXAZZDpsKTsSxsCIlMyZ07IYSZHuXqENUK u7AiibEARv0neskt1wVxwAp/gkrBsDATgkSJeqkNY0gVakHrKZ8GnkkEsXFuqtk5iVdB 18YbDs0qH+cOz01M1IA1Y9YyFGunobKhgdGOOHNyxI8krNeslLmqbuoGP09EHwQHBCo8 qK+M1N68wbzV+KBCm4NPde/O/OGX/uefvBWZblU5C2cdo0so79EYTbzEee5FfpoUlXbt 8jryLluyeqOkH6NqyK1ZS5oejHUO1Kqzg2tucGqzBLc9w3wP6wKNOKS0mqmGGGvUU0QD WDtw== 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:subject:message-id:date :from:in-reply-to:references:mime-version:dkim-signature; bh=dLY2HjGgvUoLG1QHXEvHTc+UwBQVMjPB3Oo9uy5qRj4=; fh=m01AhCNo7xUywHldCVYouaJypLlN7JgtNYbImzBf4N4=; b=KBv8BUbXos2kmHoY/K8mFLJjKj/+JiZ71h9J2lrtkxkMqNqDytON5hnuGhfW6wa95N QxWjoCy/egDn0w6PGrrtRge8eywKgBOZBDSLvfFLzV2lHM6MwCaKqHCLbbNi0A9S1CkO YLcTjcz/js8bjYxOEZgAJWHHI4ONaF9+CuPrbuq2DZrX66gLTe4rX6fgUShJ+AU2dKBu bp/8+24yuY8gd1RzJmppF+iZ6ytC+IX1IJE7UUzVkMk2Yb0z16HxLO/IJybdg4p3saMy XbrINPi4zgtLV9WuLl3wQ5Cc2qC1TpjKRk+0hrqI7+D483lEQ2DvLnJmKalIKvm9RBD5 p2mA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@broadband-forum.org header.s=google header.b=b2dQ4TCF; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::633 as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadband-forum.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1700657687; x=1701262487; darn=m.gmane-mx.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version:from:to:cc :subject:date:message-id:reply-to; bh=dLY2HjGgvUoLG1QHXEvHTc+UwBQVMjPB3Oo9uy5qRj4=; b=MJG3YVLApMsxC1LxDq+jKrnslDPDriJSuLoCZa1sM/crk0/lk9NTQQmX7iteQaQTl7 4K9sGEqQ8ZdGRphbr4whai28NaCWX2otKxRg2P8/63UOnQIlHSEEIRuhyT4Em9cw8pqv 2xXbnV/LOR3tVOFvD+wY5kxiDeP/RzlON2wpj1hQzVxYEs6rX9GWRN1Zs7bx05HazUqz JMEp8SnJ3oBSEL3/+BJM/hn/jcICaeC7UYwe7weWDANSGaSoz07Z3u79cCdUnNyBJgoL NjmT4s9RQscXnTA6GPDXfeyK2qufcKb50izcBuzZ0QFYPl9va8kYy/GMj5H X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700657687; x=1701262487; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dLY2HjGgvUoLG1QHXEvHTc+UwBQVMjPB3Oo9uy5qRj4=; b=lUTHsT2MRL8GK8HkQWVPG2v3tDW34mCpmGVpbPOhc7eDyuTUs3Y3BAlhG8RlLP05yC d4GQ9HvD/9mWdINa5ehTOxeErbEIRukZDntho8n9C3IfjU3g2QqjBwrq/E0l0ALrRxlt 5S8IqnW7Q6GuZS9RbhCDqwboNmRJGleWZo99xDZ2KMP9E/+uWGLxNant97La8iuSg+Mh Xn0aZbDoGkLAAhVCSLVgwKNk1bxr0asxCDEbAXR41tTFzgY1ohceBxftVFewn6bHArbR lEsqJ+Z0/cTWO X-Gm-Message-State: AOJu0YzvYXu5YQ3or9c8FRnqMXExrpWdisiqMlAn4AkqncCIriOE0eOD ys7dKeThEGyObDMbNBx6CBc= X-Google-Smtp-Source: AGHT+IF25Co1F+34vPUIi/nCg7UlFC+iczQZqcYC/DG3vsSK6kqom0XlA6WMUsaxwvcTim9nCpHweg== X-Received: by 2002:a05:6512:3d1d:b0:50a:6fa4:a267 with SMTP id d29-20020a0565123d1d00b0050a6fa4a267mr1595511lfv.5.1700657686309; Wed, 22 Nov 2023 04:54:46 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6512:23a7:b0:50a:a6b2:1d1e with SMTP id c39-20020a05651223a700b0050aa6b21d1els905236lfv.2.-pod-prod-01-eu; Wed, 22 Nov 2023 04:54:41 -0800 (PST) X-Received: by 2002:a05:651c:205:b0:2c6:eea4:3cfb with SMTP id y5-20020a05651c020500b002c6eea43cfbmr1492493ljn.50.1700657680931; Wed, 22 Nov 2023 04:54:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700657680; cv=none; d=google.com; s=arc-20160816; b=zmnJJZt7PP6MA+JvL54LYXjWOL2lC/9MrxZflz9ALQtYxvK7nn4VSJKyeF8JocQCvJ jT3vJXdXCjNY8HQN4iw5RFaym7YUDpKMPGjBQGQTNphiavpOBkgQ5ZlPzTPb4PbDLt/Y nXs1RzmBbC1HfpNAKIFAcgBnpcX5pDHujiNnT4GQDBZ2SJI5uIOhsYs22bc6ziEw0FED RE51KELAtUziBTBehnF+B0HuF9VUBBP5K1o2q7QIN4qqzJN1fdwh9HoAe00or3+Usete IknOyTJcAaefP8i64+yBh+b2nBwuZV5BTpThRvG3WCelfiOlvSc0RmgmXKyn2qGKYVZq M1+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dGHlZlHZ/VfZ1SZjfuhLCY391IYzISeNE87pRWlpopQ=; fh=m01AhCNo7xUywHldCVYouaJypLlN7JgtNYbImzBf4N4=; b=SPiU8wwPxvF7qjIxb5jI1AU+jrFRcR807NhN83yZ3jcnfYmzSSiAJ80O9/Z5j3vx8i KmCv0lCkQQ9mCVD0xbxMKS6LLl2E/4nVEgUrUD7zPNLHHo5j2n0JrA5NchZqveuAH3Qp zrKaSvEsli6GQtSfMTSDY0PUvARur20m8OLzRI6RcCa0jZvZYricqkGfO3+yqzvmvBRC NTav2Z3NzN7EZ4yVeS+I92IQlY2EUS0E+fjNfzYDlmDV2pBYhDARxorlVbSFaBWfEBoe 9bWEuVeDoN6bPbfX4MKTaGWXuClQDO8MdA2V8szcmbli858caiCY/1Do6NzMjWEMN7Q0 czvg== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@broadband-forum.org header.s=google header.b=b2dQ4TCF; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::633 as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadband-forum.org Original-Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com. [2a00:1450:4864:20::633]) by gmr-mx.google.com with ESMTPS id v19-20020a05600c215300b0040b347fc761si1088wml.0.2023.11.22.04.54.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Nov 2023 04:54:40 -0800 (PST) Received-SPF: pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::633 as permitted sender) client-ip=2a00:1450:4864:20::633; Original-Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-9fa45e75ed9so604932466b.1 for ; Wed, 22 Nov 2023 04:54:40 -0800 (PST) X-Received: by 2002:a17:906:308a:b0:9fe:5d39:41c6 with SMTP id 10-20020a170906308a00b009fe5d3941c6mr1575364ejv.51.1700657680128; Wed, 22 Nov 2023 04:54:40 -0800 (PST) In-Reply-To: X-Original-Sender: wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@broadband-forum.org header.s=google header.b=b2dQ4TCF; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::633 as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadband-forum.org X-Original-From: William Lupton 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:33367 Archived-At: --000000000000e8b874060abd385d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable If --reference-location=3Dblock turns out not to be sufficient, I don't thi= nk a lua filter will help, but a custom writer could (the writer is responsible for handling footnotes). On Wed, 22 Nov 2023 at 12:23, EBkysko wrote: > Note there's a caveat to this solution: as the guide mentions, with > 'block' the notes are placed at the end of the current **top-level** bloc= k, > which might not be the paragraph itself. > > Examples: > > - If the paragraph is an item in a list, the note is placed below the > list, not the item (and below main list if a nested list). > - If the paragraph is within a fenced div, the note is placed after > the fenced div. > - A corollary to the above: if a filter uses `make_sections`, the > notes might end up at end of document after all. > > > On Tuesday, November 21, 2023 at 9:55:26=E2=80=AFPM UTC-5 Lyndon Drake wr= ote: > >> Brilliant @EBkysko =E2=80=94 that works exactly as I'd hoped. Thank you! >> >> On Tuesday, 21 November 2023 at 19:11:24 UTC-6 EBkysko wrote: >> >>> try (with markdown output >>> ) >>> >>> ``` >>> --reference-location=3Dblock >>> ``` >>> >>> On Tuesday, November 21, 2023 at 4:23:57=E2=80=AFPM UTC-5 Gwern Branwen= wrote: >>> >>>> This seems possibly tricky? I don't know what the Lua filters can or >>>> cannot do, but I'm not sure how one could solve this using just the Ha= skell >>>> API... Pandoc was not designed as a source-2-source processor so it do= esn't >>>> make much effort to support Markdown-to-Markdown passes - like the obv= ious >>>> roundtrip will potentially change your Markdown formatting to a >>>> semantically-equivalent but entirely different-looking Markdown doc. >>>> (Macfarlane has said repeatedly that this will not be changed.) >>>> >>>> In your case, footnotes throw away the positioning information. >>>> Consider the 3 possibilities: >>>> >>>> Foo[^foo]. >>>> >>>> Foo bar^[Bar.] >>>> >>>> Foo baz[^baz] >>>> >>>> [^baz]: Baz. >>>> >>>> [^foo]: foo. >>>> >>>> This parses into: >>>> >>>> [ Para >>>> [ Str "Foo" , Note [ Para [ Str "foo." ] ] , Str "." ] >>>> , Para >>>> [ Str "Foo" >>>> , Space >>>> , Str "bar" >>>> , Note [ Para [ Str "Bar." ] ] >>>> ] >>>> , Para >>>> [ Str "Foo" >>>> , Space >>>> , Str "baz" >>>> , Note [ Para [ Str "Baz." ] ] >>>> ] >>>> ] >>>> >>>> So you can't know 'where' a footnote body was put, whether at the end >>>> of the doc or elsewhere. >>>> >>>> Further, Pandoc will write out the Markdown according to its own >>>> conventions, which go opposite of what you want, by putting *all* foot= note >>>> bodies at the end, regardless of where they were or whether they could= be >>>> inline footnotes, and the Markdown writer probably takes no options wh= ich >>>> would change that: >>>> >>>> Foo[^1]. >>>> >>>> Foo bar[^2] >>>> >>>> Foo baz[^3] >>>> >>>> [^1]: foo. >>>> >>>> [^2]: Bar. >>>> >>>> [^3]: Baz. >>>> >>>> -- >>>> gwern >>>> https://gwern.net >>>> >>> -- > 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/ff6a6898-e1c0-413f-b6c2-= d81ea2d949d4n%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/CAEe_xxh74qC5fLmzhoMjS1gyWwyo%3DrSKVmbXTs--fH8me-EAeg%40mail= .gmail.com. --000000000000e8b874060abd385d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
If=C2=A0--reference-location=3Dblock turns out not to be s= ufficient, I don't think a lua filter will help, but a custom writer co= uld (the writer is responsible for handling footnotes).

On Wed, 22 Nov 2023 = at 12:23, EBkysko <ebkysko-Re5JQEeQqe8@public.gmane.org= m> wrote:
Note there's a caveat to this solution: as the guide mentions, with &#= 39;block' the notes are placed at the end of the current **top-level** = block, which might not be the paragraph itself.

Examples:
    If the paragraph is an item in a list, the note is placed below the list, = not the item (and below main list if a nested list).
  • If the paragra= ph is within a fenced div, the note is placed after the fenced div.
  • A corollary to the above: if a filter uses `make_sections`, the notes migh= t end up at end of document after all.

On Tuesday, November 21, 2023 at= 9:55:26=E2=80=AFPM UTC-5 Lyndon Drake wrote:
Brilliant @EBkysko =E2=80=94 that works exact= ly as I'd hoped. Thank you!

On Tuesday, 21 November 2023 at 19:11:24 UTC= -6 EBkysko wrote:
markdown output)=

```
--reference-location=3Dblock
```

On Tuesday, November 21, 2023 at 4:23:57=E2=80=AFPM UTC-5 Gwern Branwen wr= ote:
This seems possibly tricky? I don't know what the Lua filter= s can or cannot do, but I'm not sure how one could solve this using jus= t the Haskell API... Pandoc was not designed as a source-2-source processor= so it doesn't make much effort to support Markdown-to-Markdown passes = - like the obvious roundtrip will potentially change your Markdown formatti= ng to a semantically-equivalent but entirely different-looking Markdown doc= . (Macfarlane has said repeatedly that this will not be changed.)
=

In your case, footnotes throw away the positioning info= rmation.
Consider the 3 possibilities:

= =C2=A0=C2=A0=C2=A0 Foo[^foo].

=C2=A0=C2=A0=C2=A0 Foo bar^[Bar.]
<= br>=C2=A0=C2=A0=C2=A0 Foo baz[^baz]

=C2=A0=C2=A0=C2=A0 [^baz]: Baz.<= br>=C2=A0
=C2=A0=C2=A0=C2=A0 [^foo]: foo.

This = parses into:

[ Para
=C2=A0 =C2=A0 [ Str "F= oo" , Note [ Para [ Str "foo." ] ] , Str "." ]
= , Para
=C2=A0 =C2=A0 [ Str "Foo"
=C2=A0 =C2=A0 , Space
= =C2=A0 =C2=A0 , Str "bar"
=C2=A0 =C2=A0 , Note [ Para [ Str &q= uot;Bar." ] ]
=C2=A0 =C2=A0 ]
, Para
=C2=A0 =C2=A0 [ Str &quo= t;Foo"
=C2=A0 =C2=A0 , Space
=C2=A0 =C2=A0 , Str "baz"=
=C2=A0 =C2=A0 , Note [ Para [ Str "Baz." ] ]
=C2=A0 =C2=A0= ]
]

So you can't know 'where' = a footnote body was put, whether at the end of the doc or elsewhere.
<= div>
Further, Pandoc will write out the Markdown according to= its own conventions, which go opposite of what you want, by putting *all* = footnote bodies at the end, regardless of where they were or whether they c= ould be inline footnotes, and the Markdown writer probably takes no options= which would change that:

Foo[^1].

Foo = bar[^2]

Foo baz[^3]

[^1]: foo.

[^2]: Bar.

[^3]:= Baz.

--

--
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 pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https= ://groups.google.com/d/msgid/pandoc-discuss/ff6a6898-e1c0-413f-b6c2-d81ea2d= 949d4n%40googlegroups.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://group= s.google.com/d/msgid/pandoc-discuss/CAEe_xxh74qC5fLmzhoMjS1gyWwyo%3DrSKVmbX= Ts--fH8me-EAeg%40mail.gmail.com.
--000000000000e8b874060abd385d--