From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33366 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: EBkysko Newsgroups: gmane.text.pandoc Subject: Re: Moving footnotes to just after paragraph with the citation Date: Wed, 22 Nov 2023 04:23:55 -0800 (PST) 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/mixed; boundary="----=_Part_2430_109149905.1700655835625" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5394"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDW4B3GJ2UFBBXHF66VAMGQEVYE6NBA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Nov 22 13:24:01 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f60.google.com ([209.85.161.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1r5mGu-0001Af-Mp for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 22 Nov 2023 13:24:00 +0100 Original-Received: by mail-oo1-f60.google.com with SMTP id 006d021491bc7-58a1131ef74sf7857080eaf.2 for ; Wed, 22 Nov 2023 04:24:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1700655839; x=1701260639; 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=HUI6uYt+NpFSAfAm66Sjn1Y/hnGhglgiXHt9pdpJwLo=; b=rd24lhGTLiDJvgiQn6dpGxebIc8WiEnxNqpZjXX14T06EorrZoFdN9cKK1MSvWn5hb lPO9vsAAkSNB1Lqj5Go0dxoT0ZhV959rvbYGLvpLdCoPHTB+8Kc/OrhDV/WkJ5VrPbw2 yIasyrf8v27VMH37UYXVzAUrbzjql4InrJjhAjXBtMCqIEaChBE3QrFSvVCnVia2XkWQ I15mL6r0MaiPlp4lbh9FVVIOQJWFRZj131DS/o5831Zoza0F/u/HjZ3qkdH7bHYaWmCz ZlbQVfSoWAX8QcH6YVAZ5E2oWqgB2NvnKpQ4Nf2og//BmnGRgALQjrbpSnJAronfIRMv jKLg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700655839; x=1701260639; 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=HUI6uYt+NpFSAfAm66Sjn1Y/hnGhglgiXHt9pdpJwLo=; b=Q/5+7KWBvIWzqRdHADl3+LAS1TaDcisV7bCscd48HRafYhsrAMyFre8Fd1H9IuH9X5 kmth05L8zA3d3ERO2Y1OXR2eSGEnOX+GIYnQnF/k+0U/2Wci7az1NZ84VqcwQAjpeoYX 2V9AeMGD6iuvyNjBWv/RapDv20x7+6GftkBbiNthAqmF0MDHKtqKCaT9+1h+l42I+zCm 1z5GVdVKfVjb6sbF3bA5HhKpcsNmO5G9e2aupibBrqOFZ14vIF/ZKllwCQZUbJu7/jYL uflt6VeVQq59/m6eWPapvHoK/kW/Yyy+L72TNQxXVaXI0hQYTX1TFbBuOEvkHsPwH9JY yKJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700655839; x=1701260639; 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=HUI6uYt+NpFSAfAm66Sjn1Y/hnGhglgiXHt9pdpJwLo=; b=usnVapQWOe6B0nsoUEYCBzEwIRuf8mtZDM8MyvEJhy9dXq9FG2g10pTqJ7h+W6rV5V 1QH1tCCUDoHvAgRYwdK6tEziWmk97EWdjfy4QsnCKdsM6hblmEO4SqtHqjIEIJIbmguA LyYaY+I85Qxfaqy1zy90L6kvflwJarDBbdeACRXi0/6khCILHXz+vIJTR+4UFh+SS/QC 8grudi0ymfpbPOoMHvJqgF6kFOknNzfmliFvvOFEzFXvcoftGpr0NLRbKbgOJwRt9yW1 sqywR7zK+8DLfXXck7SPO6u3l0+vcGnzglnzb7EPSCySuk2m/a Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOJu0YxL05KPe88fPb8s2fTsGwbnqqopUZcbNQOHGPAm3OOYoauA2CQb t4ziA+ucrs1En4MiwmwkqZA= X-Google-Smtp-Source: AGHT+IE34zf+jmfAb0DNcU4BEWfwL25Ao5vdx2iRj6gQLNgtAghHjQ9aDuNz4Ka6f/NNZ0+lPTMGjg== X-Received: by 2002:a05:6820:822:b0:581:eef8:131f with SMTP id bg34-20020a056820082200b00581eef8131fmr2551636oob.1.1700655839439; Wed, 22 Nov 2023 04:23:59 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a4a:b001:0:b0:587:5ec5:2b63 with SMTP id f1-20020a4ab001000000b005875ec52b63ls399274oon.2.-pod-prod-00-us; Wed, 22 Nov 2023 04:23:56 -0800 (PST) X-Received: by 2002:a05:6830:4596:b0:6c4:58bd:290d with SMTP id az22-20020a056830459600b006c458bd290dmr181339otb.3.1700655836136; Wed, 22 Nov 2023 04:23:56 -0800 (PST) In-Reply-To: <3b95f72e-34ba-486b-9b5d-2b0d01a49088n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: ebkysko-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:33366 Archived-At: ------=_Part_2430_109149905.1700655835625 Content-Type: multipart/alternative; boundary="----=_Part_2431_799117763.1700655835625" ------=_Part_2431_799117763.1700655835625 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Note there's a caveat to this solution: as the guide mentions, with 'block'= =20 the notes are placed at the end of the current **top-level** block, which= =20 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 the= =20 fenced div. - A corollary to the above: if a filter uses `make_sections`, the notes= =20 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 wrot= e: > 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 Branwen = 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 Has= kell=20 >>> API... Pandoc was not designed as a source-2-source processor so it doe= sn't=20 >>> make much effort to support Markdown-to-Markdown passes - like the obvi= ous=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 o= f=20 >>> 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* footn= ote=20 >>> bodies at the end, regardless of where they were or whether they could = be=20 >>> inline footnotes, and the Markdown writer probably takes no options whi= ch=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 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/ff6a6898-e1c0-413f-b6c2-d81ea2d949d4n%40googlegroups.com. ------=_Part_2431_799117763.1700655835625 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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** 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 w= ithin a fenced div, the note is placed after the fenced div.
  • A coro= llary to the above: if a filter uses `make_sections`, the notes might end u= p at end of document after all.

<= div dir=3D"auto" class=3D"gmail_attr">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. Thank you!

On Tuesday, 21 November 2023 at 19:11:24 UTC-6 = EBkysko wrote:
tr= y (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 filters can = or cannot do, but I'm not sure how one could solve this using just 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 formatting to = a semantically-equivalent but entirely different-looking Markdown doc. (Mac= farlane has said repeatedly that this will not be changed.)
<= br>
In your case, footnotes throw away the positioning informatio= n.
Consider the 3 possibilities:

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

=C2=A0=C2=A0=C2=A0 Foo bar^[Bar.]

=C2= =A0=C2=A0=C2=A0 Foo baz[^baz]

=C2=A0=C2=A0=C2=A0 [^baz]: Baz.
=C2= =A0
=C2=A0=C2=A0=C2=A0 [^foo]: foo.

This parses= into:

[ Para
=C2=A0 =C2=A0 [ Str "Foo&quo= t; , 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 "Bar= ." ] ]
=C2=A0 =C2=A0 ]
, Para
=C2=A0 =C2=A0 [ Str "Foo&q= uot;
=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 footn= ote body was put, whether at the end of the doc or elsewhere.
Further, Pandoc will write out the Markdown according to its ow= n conventions, which go opposite of what you want, by putting *all* footnot= e bodies at the end, regardless of where they were or whether they could 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 pand= oc-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-d81ea2d949d4n%40googlegroups.= com.
------=_Part_2431_799117763.1700655835625-- ------=_Part_2430_109149905.1700655835625--