From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33379 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lyndon Drake Newsgroups: gmane.text.pandoc Subject: Re: Moving footnotes to just after paragraph with the citation Date: Thu, 23 Nov 2023 08:21:50 -0800 (PST) Message-ID: <94b41d5e-7edd-4176-ba72-1f7f5ab697fcn@googlegroups.com> 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/mixed; boundary="----=_Part_13047_1702120846.1700756510997" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7488"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCKOX6WY7EKBBIPY7WVAMGQEWKYWOHA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Nov 23 17:21:58 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-pf1-f188.google.com ([209.85.210.188]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1r6CSk-0001c7-Bz for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 23 Nov 2023 17:21:58 +0100 Original-Received: by mail-pf1-f188.google.com with SMTP id d2e1a72fcca58-6c4cf33cf73sf1996169b3a.0 for ; Thu, 23 Nov 2023 08:21:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1700756517; x=1701361317; 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-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :sender:from:to:cc:subject:date:message-id:reply-to; bh=cIJT0vNZyDuuuxUEQ2+Cy3Go/4P06Qxb/5ct/egB/GI=; b=Rvso16YmM4sOG5vm/+/cfo8oGbrR/+mjpcxr4TX4FLNRKKwNK8iZ5V8YxWrf3yHnEb bxPj0HAA0ruAEn2+BeiIQQ+Ey8yucvqP1O4ldXEcCGOiNw/OHtIVFbNsCcDjvssBUNcB cHm7JUl89Zk96MmACXYGza3/IF+ztsWfO0KlNkO3TBcjrPgrR/PGdl9WYNDZxU+ixG3b mw0mitl0bc/HmqX1lmZAAlU3meDalQDfDw2j6mkkI/+nbr+EWneZvk5gAJzFtqTnVrzi HC0w9dmHnQrydBI/aHriNTV1zWdPFirMHwn7ntmUkOFolPMflRz6pFyfAb+uSe0AtIMO GCpQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700756517; x=1701361317; 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-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=cIJT0vNZyDuuuxUEQ2+Cy3Go/4P06Qxb/5ct/egB/GI=; b=mFcLmQ62jAmZsU0R3W6uUaXCmg/Rdw9MdnmQNho0Y8a/f7Np6+CheUtnGINlhvUa1z 3TofHgPNTtIUGgf/ZWwgDYoS/FiyAnR8h9cFgaBV/mvlIJafW+H0QWTBnC//4pQ5IC/C 003yYd3lCfEaRGd2EIppQR1Tv3Qgvh9XTRXqr1tckXOoJ5APRd7WsXYaGGLOVuF2eJ49 icYTi1e6t0AL1mkD+klmxKBnPqxUrQRMHHjP4ZSSlSRsf6HAdhkqCHAU5u/W4UbNb12r ODYUl8nS1TyW5CBbZN7ZaUaAS2Zm1jP1I4tvu2obaPeuboh7Sowknd5it4jgAeGPRjsg JjHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700756517; x=1701361317; 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-sender:mime-version:subject:references:in-reply-to :message-id:to:from:date:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=cIJT0vNZyDuuuxUEQ2+Cy3Go/4P06Qxb/5ct/egB/GI=; b=ZP2j0VEtb5AgIz98oiSZAGGKUUeh1OUh/34Bk+PqyfO1QE1SLSuYAtdWTAXxVCjP83 mivJ2h7iVrQFDLoUOGWbGhdXP16mqo+ukTtI6U7CdlontC46W6erqWhXTS2nKallDafF NYE600vYDfWDsqN8vM6XDdVfojTypoZ3IqWzTxQFrl9hjWUlMb+ckUbyzdBlZoTGlShK zTib8z9BTuhu5e70AM5LTgZksqb9ptm0DRk1RqfqUGHht2FZFEkPYGO5AiS188o8mpgu UtFBmvy8qh1uGtlAh9Vpz/rmhIQ/Las12lMDkblpDmxlbnOfjM Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOJu0Yzyh+dsif9N/KNQS3itX06sxQHXUhKMWZ+/UEEsFoDRjsdaRrcx ycih9lo2BGooYsPRfFnlndQ= X-Google-Smtp-Source: AGHT+IHW9cnJtoqJlBjyo8lxX+cRXzhBZlWIQOpbvx8486cMpul4peOCf0/gE8VreDfjSfchq1SQXQ== X-Received: by 2002:a05:6a20:7346:b0:187:4e8c:ac5c with SMTP id v6-20020a056a20734600b001874e8cac5cmr4636788pzc.1.1700756516758; Thu, 23 Nov 2023 08:21:56 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6a00:2185:b0:6b1:b8e3:9558 with SMTP id h5-20020a056a00218500b006b1b8e39558ls785977pfi.1.-pod-prod-09-us; Thu, 23 Nov 2023 08:21:52 -0800 (PST) X-Received: by 2002:a05:6a00:1d19:b0:6c2:bca7:640b with SMTP id a25-20020a056a001d1900b006c2bca7640bmr1524683pfx.3.1700756511995; Thu, 23 Nov 2023 08:21:51 -0800 (PST) In-Reply-To: X-Original-Sender: isenguard-Re5JQEeQqe8AvxtiuMwx3w@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:33379 Archived-At: ------=_Part_13047_1702120846.1700756510997 Content-Type: multipart/alternative; boundary="----=_Part_13048_56905976.1700756510997" ------=_Part_13048_56905976.1700756510997 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I think a custom writer is a bit beyond my capability at the moment. I can= =20 see that you can do some very cool stuff with custom writers though! On Wednesday, 22 November 2023 at 04:54:46 UTC-8 William Lupton wrote: > If --reference-location=3Dblock turns out not to be sufficient, I don't= =20 > think a lua filter will help, but a custom writer could (the writer is=20 > 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=20 >> 'block' the notes are placed at the end of the current **top-level** blo= ck,=20 >> which might not be the paragraph itself. >> >> Examples: >> >> - If the paragraph is an item in a list, the note is placed below the= =20 >> 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= =20 >> the fenced div. >> - A corollary to the above: if a filter uses `make_sections`, the=20 >> 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 w= rote: >> >>> 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=20 >>>> ) >>>> >>>> ``` >>>> --reference-location=3Dblock >>>> ```=20 >>>> >>>> On Tuesday, November 21, 2023 at 4:23:57=E2=80=AFPM UTC-5 Gwern Branwe= n wrote: >>>> >>>>> This seems possibly tricky? I don't know what the Lua filters can or= =20 >>>>> cannot do, but I'm not sure how one could solve this using just the H= askell=20 >>>>> API... Pandoc was not designed as a source-2-source processor so it d= oesn't=20 >>>>> make much effort to support Markdown-to-Markdown passes - like the ob= vious=20 >>>>> roundtrip will potentially change your Markdown formatting to a=20 >>>>> semantically-equivalent but entirely different-looking Markdown doc.= =20 >>>>> (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. >>>>> =20 >>>>> [^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= =20 >>>>> of the doc or elsewhere. >>>>> >>>>> Further, Pandoc will write out the Markdown according to its own=20 >>>>> conventions, which go opposite of what you want, by putting *all* foo= tnote=20 >>>>> bodies at the end, regardless of where they were or whether they coul= d be=20 >>>>> inline footnotes, and the Markdown writer probably takes no options w= hich=20 >>>>> would change that: >>>>> >>>>> Foo[^1]. >>>>> >>>>> Foo bar[^2] >>>>> >>>>> Foo baz[^3] >>>>> >>>>> [^1]: foo. >>>>> >>>>> [^2]: Bar. >>>>> >>>>> [^3]: Baz. >>>>> >>>>> --=20 >>>>> gwern >>>>> https://gwern.net >>>>> >>>> --=20 >> You received this message because you are subscribed to the Google Group= s=20 >> "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n=20 >> email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit=20 >> https://groups.google.com/d/msgid/pandoc-discuss/ff6a6898-e1c0-413f-b6c2= -d81ea2d949d4n%40googlegroups.com=20 >> >> . >> > --=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/94b41d5e-7edd-4176-ba72-1f7f5ab697fcn%40googlegroups.com. ------=_Part_13048_56905976.1700756510997 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I think a custom writer is a bit beyond my capability at the moment. I can = see that you can do some very cool stuff with custom writers though!
<= br />
On W= ednesday, 22 November 2023 at 04:54:46 UTC-8 William Lupton wrote:
If= =C2=A0--reference-location=3Dblock turns out not to be sufficient, I don= 9;t think 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 <ebk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Note there's a cav= eat to this solution: as the guide mentions, with '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 paragraph is within a fenced d= iv, the note is placed after the fenced div.
  • A corollary to the abo= ve: if a filter uses `make_sections`, the notes might end up at end of docu= ment 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 exactly as I'd hoped. Th= ank 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 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-discus...@googleg= roups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/ff6a689= 8-e1c0-413f-b6c2-d81ea2d949d4n%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://groups.google.com/d= /msgid/pandoc-discuss/94b41d5e-7edd-4176-ba72-1f7f5ab697fcn%40googlegroups.= com.
------=_Part_13048_56905976.1700756510997-- ------=_Part_13047_1702120846.1700756510997--