From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31806 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: user account Newsgroups: gmane.text.pandoc Subject: Re: converting links to footnotes... including page number in footnote?? Date: Sun, 27 Nov 2022 08:24:43 -0800 (PST) Message-ID: <858c5a07-89a0-4daa-803f-e0d9d50ca9c6n@googlegroups.com> References: <2aec84ad-a750-48f2-a0c2-ad7572dcca11n@googlegroups.com> <480d0274-2324-43d7-9f74-1bbfc08fcbd0n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_10553_430593528.1669566283547" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10001"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBD2NNN6DBIIM3HUOTQDBUBGSALMGU-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Nov 27 17:24:49 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f58.google.com ([209.85.210.58]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ozKSW-0002No-Qw for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 27 Nov 2022 17:24:49 +0100 Original-Received: by mail-ot1-f58.google.com with SMTP id n19-20020a0568301e9300b0066c3b6f5dd0sf3484437otr.19 for ; Sun, 27 Nov 2022 08:24:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; 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=8uK47S/a6EA52IeDglb0EFZ3VODYHpmNdmAI2136jZM=; b=eIdUcZTUQFqnGLV2JcdRbu5k8CNlgeR/6rojBFSyRr788/O3EakoiGds/FTjJXvNWq yL8Os3QSFWP8/C7mGfmlBDOXpT6uhZqm+04iQqqiHw0+KJBaxmvwvA+R+6NToZjPQPXY o6l8JWdU2TkzCxLqmtVhZk0PeE72WuvEs+LOI7/vJJvMJQSDw7/BXAKpiIwIMmeIPyKM aXNBzk1079HKqsCdr0IvttEzGhcjghZFdBKuI90mrWpDkFojh/A03UYs9LkQMuO/SWT1 eDwpO33aveS+J+Xw4wmNQn2VLprXUnE3jWoRXiCPNS0VAyVD5+ru7Vn4u6ErbYezFoEJ URKg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=8uK47S/a6EA52IeDglb0EFZ3VODYHpmNdmAI2136jZM=; b=cVjMMVHC8FVpGWQ/PyPMDOweR9N9q5xVZW3lFjihlQnQpTnlsatknp3bC2NGM++o+d g1JsNrzcZupViTW/rMRUX4mJXOqtV8NdOMjbokBdd88vQFPNiCXEbBNCqFgVQYfUq81Z gilO2vcMtLBfan6aMh2fxn1E5hsyp0j33kWsjX2Vhr+nNWNaKQhNKwaU7t4V1CCjuaQP MHTgA4ug/18YfyDZfZUE8Sve/8sEi2w1ZCwQjUGmfo0oD+k4cbaCha8sErTDP3yQKOBN 2N08lMvtrKKvdRn1bvXnLkhpg2pfgfQ+fUqHvs7KcwuRrLMNFXdU8R0FCH2FMbgEiPg1 uJRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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-gm-message-state:sender:from:to:cc :subject:date:message-id:reply-to; bh=8uK47S/a6EA52IeDglb0EFZ3VODYHpmNdmAI2136jZM=; b=jMwqetFm2oGY1uQuWLpgAux+Q3VmHc4qtjV/Xlrt3Gkbbj29bIKv4HuzXLDtU2GBlJ C1jODETazaHwgBQW2EQZm/2EX2Zc0QedDyjQs32tOxm5+AxNA8Xdl5d4gRFmlMInHRj5 PW9+j6wkq6DjP3SLhfhEofPtNH+L2+CQcjk/VSSWdcyekbZeMNXNof09yLaa5NHvmXzF C69yJV2pl+cWx7FjqTBa/0SQWUjQPROdDacdIFNBIpZgb4Ljm7l2870Npt33jimM2ZPm 6Fl2EVkNEqGnq9bKNPeo+AAi8pcBcHAbd8Pu88Wf8zX2vp8+vGCXE2PG7StB+W8rw5e/ /Gcw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ANoB5plIHBvC5YsJEJKROauWNrR9P6y0pA63QXic6DPZZHB3bU7UrCHi joxoKUtjEcexFMIARCg4RWs= X-Google-Smtp-Source: AA0mqf5iWBGYrA1aaiwvPzVEY+jC28UVHSSyxHdle32Mcx+LE+Bpc064FIK5KModuB7Jofc4Z2cMFw== X-Received: by 2002:a05:6870:b602:b0:13b:d693:2ee1 with SMTP id cm2-20020a056870b60200b0013bd6932ee1mr25666776oab.77.1669566287659; Sun, 27 Nov 2022 08:24:47 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6870:3a0f:b0:13d:21ad:3b97 with SMTP id du15-20020a0568703a0f00b0013d21ad3b97ls2935908oab.4.-pod-prod-gmail; Sun, 27 Nov 2022 08:24:44 -0800 (PST) X-Received: by 2002:a05:6870:b19:b0:142:78d9:d216 with SMTP id lh25-20020a0568700b1900b0014278d9d216mr15663380oab.207.1669566284460; Sun, 27 Nov 2022 08:24:44 -0800 (PST) In-Reply-To: X-Original-Sender: mail.user.sadf-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:31806 Archived-At: ------=_Part_10553_430593528.1669566283547 Content-Type: multipart/alternative; boundary="----=_Part_10554_1703632761.1669566283547" ------=_Part_10554_1703632761.1669566283547 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ok, gotcha! Could you point me to an example of how that page number could= =20 be printed somewhere? My goal is this, HTML:

Here's text with anchor text.

Becomes a paragraph in the pdf document: Here's text with anchor text[1]. And then in the footer, is a footnote: 1) See one page #7. ...where page 7 is the where the /some-blog-post is now located in this pdf= . Does that make sense? On Sunday, November 27, 2022 at 10:50:14 AM UTC-5 Bastien Dumont wrote: > My filter only shows how one can inject raw code to get references by pag= e=20 > number in LaTeX. Without any example, I don't really understand what you= =20 > say about footnotes and so on, but the basic mechanism is here, now you c= an=20 > adapt the filter to your needs. > > Le Sunday 27 November 2022 =C3=A0 06:13:53AM, user account a =C3=A9crit : > > oh a 'filters' subdir! Thanks. So now the pdf gets created w/o error,= =20 > but there > > are not footnotes. > >=20 > > neither of these: > > pandoc -L links-with-page-number.lua -o test.pdf test.html > > pandoc -V links-as-notes -L links-with-page-number.lua -o test.pdf > > test.html > > ...creates pdf w/ footnotes, so there's no footnote to contain the page= =20 > number > > of the linked-to page. > >=20 > > Something undesireable does happen though... I changed the paragraph=20 > with the > > link to: > >

Here is a link to important words about the= =20 > target. > >

> > ...and the "important words about the target" get removed altogether.= =20 > Those > > should not be removed, just the tags around them should be removed. > >=20 > > Thanks for the help so far. I'm excited to see a lua filter in action= =20 > for my > > first time. Very curious about the api... I presume pandoc is looking f= or > > functions with particular names like Link and Span? Would you mind > > confirming... this https://pandoc.org/lua-filters.html#type-link is the= =20 > proper > > spot in the docs for referencing Link in this context... right? > >=20 > > I imagine this working example produce footnotes w/ page numbers for yo= u=20 > in > > your environment...? Any idea what I could inspect to try to get it=20 > working in > > mine? > > On Sunday, November 27, 2022 at 3:57:02 AM UTC-5 Bastien Dumont wrote: > >=20 > > Place the file under `~/.local/share/pandoc/filters`. You don't need th= e > > executable flag. > >=20 > > Le Saturday 26 November 2022 =C3=A0 02:30:58PM, user account a =C3=A9cr= it : > > > Thanks I wish that worked. I don't know what I'm doing wrong, here's= =20 > what > > I've > > > got=E2=80=A6 > > > > > > `pandoc --version` says user data dir is `~/.local/share/pandoc` so I > > placed > > > this file there as `~/.local/share/pandoc/links-with-page-number.lua`= =20 > and > > did > > > (just in case) `chmod +x` on it. > > > > > > `pandoc -o test.pdf test.html` produces a 2page pdf as expected with = no > > > footnotes. > > > > > > `pandoc -L links-with-page-number.lua -o test.pdf test.html` fails to > > produce > > > pdf file with: > > > ``` > > > Error running filter links-with-page-number.lua: > > > links-with-page-number.lua: openBinaryFile: does not exist (No such= =20 > file > > or > > > directory) > > > ``` > > > > > > There's no typo in my script name or command invocation. Using=20 > ~/.pandoc > > > instead of ~/.local/share/pandoc doesn't make any difference, still g= et > > that > > > same error. > > > > > > Any ideas? > > > > > > On Saturday, November 26, 2022 at 12:34:15 PM UTC-5 Bastien Dumont=20 > wrote: > > > > > > Please find attached a basic implementation. As in the attached sampl= e > > HMTL > > > file, I suppose that the targets are marked with ids on spans and tha= t > > you > > > link to it via empty elements. If you have a LaTeX installation, > > simply > > > do `pandoc -L links-with-page-number.lua -o test.pdf test.html` to se= e > > the > > > result. > > > > > > Le Saturday 26 November 2022 =C3=A0 05:21:25AM, user account a =C3=A9= crit : > > > > Thanks! Yeah injecting html in the intermediary document doesn't=20 > sound > > > very > > > > promising either (again, because the pages have to be built first > > before > > > > footnotes updated with page #s) so maybe I'll abandon weasyprint in > > this > > > case, > > > > if this would be easy to do with a *Tex pdf engine. In that case...= =20 > how > > > would > > > > one go about this? Would a lua filter be more capable with a=20 > different > > > pdf > > > > engine or would a different mechanism be used? > > > > > > > > On Saturday, November 26, 2022 at 5:28:31 AM UTC-5 Bastien Dumont > > wrote: > > > > > > > > The problem is that Pandoc does not produce the PDF document: it > > produces > > > > the intermediary HTML document that is processed by weasyprint to > > produce > > > > the PDF. So you cannot get page numbers in a Lua filter. > > > > > > > > However, you can inject raw HTML code in the intermediary file (or = in > > > your > > > > CSS) that will make weasyprint print the page numbers. The question= =20 > is > > > > whether such HTML code exists. It certainly would be possible to do > > this > > > if > > > > you converted to PDF via LaTeX, ConTeXt or groff, but I don't know = if > > it > > > is > > > > possible via weasyprint. > > > > > > > > Le Friday 25 November 2022 =C3=A0 04:33:05PM, user account a =C3=A9= crit : > > > > > Using pandoc with weasyprint pdf engine to turn the markdown file= s > > from > > > a > > > > blog > > > > > (static site generator does the html conversion) into a pdf for > > print. > > > > > > > > > > Would it be possible, perhaps with a custom lua filter or some=20 > other > > > > mechanism, > > > > > to add the page number of the linked-to page? The page numbers=20 > won't > > be > > > > known > > > > > until pandoc has already created the document, and I don't know= =20 > where > > > in > > > > 'the > > > > > pipeline' the lua filter intervenes compared to when the pages > > > exist...? > > > > And > > > > > If the pages exist with their numbers earlier enough, is there an > > > object > > > > or > > > > > something from which lua can get the page number? > > > > > > > > > > I haven't found anything about page numbers in [1][1][1]https:// > > pandoc.org > > > / > > > > > lua-filters.html#module-pandoc.utils ...am I looking in the wrong > > > place? > > > > Can > > > > > anyone tell me anything about this? > > > > > > > > > > It's an intimidating rabbit hole for me, particularly because I s= ee > > no > > > > mention > > > > > of "page number" there in the docs, which makes it seem kinda > > hopeless > > > > > actually. But maybe one of you know the way and could point me in > > that > > > > > direction? > > > > > > > > > > -- > > > > > You received this message because you are subscribed to the Googl= e > > > Groups > > > > > "pandoc-discuss" group. > > > > > To unsubscribe from this group and stop receiving emails from it, > > send > > > an > > > > email > > > > > to [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > To view this discussion on the web visit [2][2][2]https:// > > > [2]groups.google.com/ > > > > d/msgid/ > > > > > pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%[3] > > > > [3][3]40googlegroups.com. > > > > > > > > > > References: > > > > > > > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > > > [2] [4][4][4]https://groups.google.com/d/msgid/pandoc-discuss/ > > > > a93afb43-c939-40c1-868f-1db8eded17d8n%[5][5]40googlegroups.com? > > utm_medium=3D > > > email& > > > > utm_source=3Dfooter > > > > > > > > > > > > -- > > > > 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,= =20 > send > > an > > > email > > > > to [5]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > To view this discussion on the web visit [6][6][6]https:// > > groups.google.com/ > > > d/msgid/ > > > > pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%[7] > > > [7]40googlegroups.com. > > > > > > > > References: > > > > > > > > [1] [8][8]https://pandoc.org/ > > > > [2] [9][9]https://groups.google.com/d/msgid/ > > > > [3] [10][10]http://40googlegroups.com/ > > > > [4] [11][11]https://groups.google.com/d/msgid/pandoc-discuss/ > > > a93afb43-c939-40c1-868f-1db8eded17d8n%[12] > 40googlegroups.com?utm_medium=3D > > email& > > > utm_source=3Dfooter > > > > [5] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > > [6] [12][13]https://groups.google.com/d/msgid/pandoc-discuss/ > > > 2aec84ad-a750-48f2-a0c2-ad7572dcca11n%[14] > 40googlegroups.com?utm_medium=3D > > email& > > > utm_source=3Dfooter > > > > > > > > > -- > > > You received this message because you are subscribed to the Google=20 > Groups > > > "pandoc-discuss" group. > > > To unsubscribe from this group and stop receiving emails from it, sen= d=20 > an > > email > > > to [13]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To view this discussion on the web visit [14][15]https:// > > groups.google.com/d/msgid/ > > > pandoc-discuss/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%[16] > > 40googlegroups.com. > > > > > > References: > > > > > > [1] [17]https://pandoc.org/ > > > [2] [18]https://groups.google.com/ > > > [3] [19]http://40googlegroups.com/ > > > [4] [20]https://groups.google.com/d/msgid/pandoc-discuss/ > > > [5] [21]http://40googlegroups.com/?utm_medium=3Demail& > > > [6] [22]https://groups.google.com/d/msgid/ > > > [7] [23]http://40googlegroups.com/ > > > [8] [24]https://pandoc.org/ > > > [9] [25]https://groups.google.com/d/msgid/ > > > [10] [26]http://40googlegroups.com/ > > > [11] [27]https://groups.google.com/d/msgid/pandoc-discuss/ > > a93afb43-c939-40c1-868f-1db8eded17d8n% > 40googlegroups.com?utm_medium=3Demail& > > utm_source=3Dfooter > > > [12] [28]https://groups.google.com/d/msgid/pandoc-discuss/ > > 2aec84ad-a750-48f2-a0c2-ad7572dcca11n% > 40googlegroups.com?utm_medium=3Demail& > > utm_source=3Dfooter > > > [13] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [14] [29]https://groups.google.com/d/msgid/pandoc-discuss/ > > 480d0274-2324-43d7-9f74-1bbfc08fcbd0n% > 40googlegroups.com?utm_medium=3Demail& > > utm_source=3Dfooter > >=20 > >=20 > > -- > > You received this message because you are subscribed to the Google Grou= ps > > "pandoc-discuss" group. > > To unsubscribe from this group and stop receiving emails from it, send= =20 > an email > > to [30]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [31] > https://groups.google.com/d/msgid/ > > pandoc-discuss/e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n%40googlegroups.com= . > >=20 > > References: > >=20 > > [1] https://pandoc.org/ > > [2] http://groups.google.com/ > > [3] http://40googlegroups.com/ > > [4] https://groups.google.com/d/msgid/pandoc-discuss/ > > [5] http://40googlegroups.com/?utm_medium=3D > > [6] https://groups.google.com/ > > [7] http://40googlegroups.com/ > > [8] https://pandoc.org/ > > [9] https://groups.google.com/d/msgid/ > > [10] http://40googlegroups.com/ > > [11] https://groups.google.com/d/msgid/pandoc-discuss/ > > [12] http://40googlegroups.com/?utm_medium=3Demail& > > [13] https://groups.google.com/d/msgid/pandoc-discuss/ > > [14] http://40googlegroups.com/?utm_medium=3Demail& > > [15] https://groups.google.com/d/msgid/ > > [16] http://40googlegroups.com/ > > [17] https://pandoc.org/ > > [18] https://groups.google.com/ > > [19] http://40googlegroups.com/ > > [20] https://groups.google.com/d/msgid/pandoc-discuss/ > > [21] http://40googlegroups.com/?utm_medium=3Demail& > > [22] https://groups.google.com/d/msgid/ > > [23] http://40googlegroups.com/ > > [24] https://pandoc.org/ > > [25] https://groups.google.com/d/msgid/ > > [26] http://40googlegroups.com/ > > [27]=20 > https://groups.google.com/d/msgid/pandoc-discuss/a93afb43-c939-40c1-868f-= 1db8eded17d8n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter > > [28]=20 > https://groups.google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-a0c2-= ad7572dcca11n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter > > [29]=20 > https://groups.google.com/d/msgid/pandoc-discuss/480d0274-2324-43d7-9f74-= 1bbfc08fcbd0n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter > > [30] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [31]=20 > https://groups.google.com/d/msgid/pandoc-discuss/e969f1ca-c6bf-4a5e-b53f-= 86aa0a444db2n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter > > --=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/858c5a07-89a0-4daa-803f-e0d9d50ca9c6n%40googlegroups.com. ------=_Part_10554_1703632761.1669566283547 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ok, gotcha! Could you point me to an example of how that page number c= ould be printed somewhere?

My goal is this, HTML:<= /div>
<p>Here's text with <a href=3D"/some-blog-post">ancho= r text</a>.</p>

Becomes a paragraph in= the pdf document:
Here's text with anchor text[1].
And then in the footer, is a footnote:
1) See <scr= ipted caption> one page #7.

...where page 7 is = the where the /some-blog-post is now located in this pdf.

Does that make sense?

On Sunday, November 27, 2022 at 10:50:14 = AM UTC-5 Bastien Dumont wrote:
My filter only shows how one can inject raw code to get r= eferences by page number in LaTeX. Without any example, I don't really = understand what you say about footnotes and so on, but the basic mechanism = is here, now you can adapt the filter to your needs.

Le Sunday 27 November 2022 =C3=A0 06:13:53AM, user account a =C3=A9crit= :
> oh a 'filters' subdir! Thanks. So now the pdf gets created= w/o error, but there
> are not footnotes.
>=20
> neither of these:
> pandoc -L links-with-page-number.lua -o test.pdf test.html
> pandoc -V links-as-notes -L links-with-page-number.lua -o test= .pdf
> test.html
> ...creates pdf w/ footnotes, so there's no footnote to contain= the page number
> of the linked-to page.
>=20
> Something undesireable does happen though... I changed the paragra= ph with the
> link to:
> <p>Here is a link to <a href=3D"#thetarget">= important words about the target</a>.
> </p>
> ...and the "important words about the target" get remove= d altogether. Those
> should not be removed, just the <a> tags around them should = be removed.
>=20
> Thanks for the help so far. I'm excited to see a lua filter in= action for my
> first time. Very curious about the api... I presume pandoc is look= ing for
> functions with particular names like Link and Span? Would you mind
> confirming... this
https://pandoc.org/lua-filters.html#type-link is = the proper
> spot in the docs for referencing Link in this context... right?
>=20
> I imagine this working example produce footnotes w/ page numbers f= or you in
> your environment...? Any idea what I could inspect to try to get i= t working in
> mine?
> On Sunday, November 27, 2022 at 3:57:02 AM UTC-5 Bastien Dumont wr= ote:
>=20
> Place the file under `~/.local/share/pandoc/filters`. You don&= #39;t need the
> executable flag.
>=20
> Le Saturday 26 November 2022 =C3=A0 02:30:58PM, user account a= =C3=A9crit :
> > Thanks I wish that worked. I don't know what I'm = doing wrong, here's what
> I've
> > got=E2=80=A6
> >
> > `pandoc --version` says user data dir is `~/.local/share/= pandoc` so I
> placed
> > this file there as `~/.local/share/pandoc/links-with-page= -number.lua` and
> did
> > (just in case) `chmod +x` on it.
> >
> > `pandoc -o test.pdf test.html` produces a 2page pdf as ex= pected with no
> > footnotes.
> >
> > `pandoc -L links-with-page-number.lua -o test.pdf test.ht= ml` fails to
> produce
> > pdf file with:
> > ```
> > Error running filter links-with-page-number.lua:
> > links-with-page-number.lua: openBinaryFile: does not exis= t (No such file
> or
> > directory)
> > ```
> >
> > There's no typo in my script name or command invocati= on. Using ~/.pandoc
> > instead of ~/.local/share/pandoc doesn't make any dif= ference, still get
> that
> > same error.
> >
> > Any ideas?
> >
> > On Saturday, November 26, 2022 at 12:34:15 PM UTC-5 Basti= en Dumont wrote:
> >
> > Please find attached a basic implementation. As in the at= tached sample
> HMTL
> > file, I suppose that the targets are marked with ids on s= pans and that
> you
> > link to it via empty <a> elements. If you have a La= TeX installation,
> simply
> > do `pandoc -L links-with-page-number.lua -o test.pdf test= .html` to see
> the
> > result.
> >
> > Le Saturday 26 November 2022 =C3=A0 05:21:25AM, user acco= unt a =C3=A9crit :
> > > Thanks! Yeah injecting html in the intermediary docu= ment doesn't sound
> > very
> > > promising either (again, because the pages have to b= e built first
> before
> > > footnotes updated with page #s) so maybe I'll ab= andon weasyprint in
> this
> > case,
> > > if this would be easy to do with a *Tex pdf engine. = In that case... how
> > would
> > > one go about this? Would a lua filter be more capabl= e with a different
> > pdf
> > > engine or would a different mechanism be used?
> > >
> > > On Saturday, November 26, 2022 at 5:28:31 AM UTC-5 B= astien Dumont
> wrote:
> > >
> > > The problem is that Pandoc does not produce the PDF = document: it
> produces
> > > the intermediary HTML document that is processed by = weasyprint to
> produce
> > > the PDF. So you cannot get page numbers in a Lua fil= ter.
> > >
> > > However, you can inject raw HTML code in the interme= diary file (or in
> > your
> > > CSS) that will make weasyprint print the page number= s. The question is
> > > whether such HTML code exists. It certainly would be= possible to do
> this
> > if
> > > you converted to PDF via LaTeX, ConTeXt or groff, bu= t I don't know if
> it
> > is
> > > possible via weasyprint.
> > >
> > > Le Friday 25 November 2022 =C3=A0 04:33:05PM, user a= ccount a =C3=A9crit :
> > > > Using pandoc with weasyprint pdf engine to turn= the markdown files
> from
> > a
> > > blog
> > > > (static site generator does the html conversion= ) into a pdf for
> print.
> > > >
> > > > Would it be possible, perhaps with a custom lua= filter or some other
> > > mechanism,
> > > > to add the page number of the linked-to page? T= he page numbers won't
> be
> > > known
> > > > until pandoc has already created the document, = and I don't know where
> > in
> > > 'the
> > > > pipeline' the lua filter intervenes compare= d to when the pages
> > exist...?
> > > And
> > > > If the pages exist with their numbers earlier e= nough, is there an
> > object
> > > or
> > > > something from which lua can get the page numbe= r?
> > > >
> > > > I haven't found anything about page numbers= in [1][1][1]https://
> pandoc.org
> > /
> > > > lua-filters.html#module-pandoc.utils ...am I lo= oking in the wrong
> > place?
> > > Can
> > > > anyone tell me anything about this?
> > > >
> > > > It's an intimidating rabbit hole for me, pa= rticularly because I see
> no
> > > mention
> > > > of "page number" there in the docs, w= hich makes it seem kinda
> hopeless
> > > > actually. But maybe one of you know the way and= could point me in
> that
> > > > direction?
> > > >
> > > > --
> > > > You received this message because you are subsc= ribed to the Google
> > Groups
> > > > "pandoc-discuss" group.
> > > > To unsubscribe from this group and stop receivi= ng emails from it,
> send
> > an
> > > email
> > > > to [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> > > > To view this discussion on the web visit [2][2]= [2]https://
> > [2]groups.google.com/
> > > d/msgid/
> > > > pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded= 17d8n%[3]
> > > [3][3]40googlegroups.= com.
> > > >
> > > > References:
> > > >
> > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > > > [2] [4][4][4]https://groups.google.com/d/msgid/= pandoc-discuss/
> > > a93afb43-c939-40c1-868f-1db8eded17d8n%[5][5]40googlegroups.com?
> utm_medium=3D
> > email&
> > > utm_source=3Dfooter
> > >
> > >
> > > --
> > > You received this message because you are subscribed= to the Google
> Groups
> > > "pandoc-discuss" group.
> > > To unsubscribe from this group and stop receiving em= ails from it, send
> an
> > email
> > > to [5]pan= doc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> > > To view this discussion on the web visit [6][6][6]ht= tps://
> groups.google.com/
> > d/msgid/
> > > pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n= %[7]
> > [7]40googlegroups.com.
> > >
> > > References:
> > >
> > > [1] [8][8]https://pandoc.org/
> > > [2] [9][9]https://groups.google.com/d/msgid/
> > > [3] [10][10]http://40go= oglegroups.com/
> > > [4] [11][11]https://groups.google.com/d/msgid/pandoc= -discuss/
> > a93afb43-c939-40c1-868f-1db8eded17d8n%[12]40googlegroups.com?utm_medium=3D
> email&
> > utm_source=3Dfooter
> > > [5] mailto:
pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > > [6] [12][13]https://groups.google.com/d/msgid/pandoc= -discuss/
> > 2aec84ad-a750-48f2-a0c2-ad7572dcca11n%[14]40googlegroups.com?utm_medium=3D
> email&
> > utm_source=3Dfooter
> >
> >
> > --
> > You received this message because you are subscribed to t= he Google Groups
> > "pandoc-discuss" group.
> > To unsubscribe from this group and stop receiving emails = from it, send an
> email
> > to [13]
pandoc-= discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> > To view this discussion on the web visit [14][15]https://
> groups.google.com/d= /msgid/
> > pandoc-discuss/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%[16]
> 40googlegroups.com.
> >
> > References:
> >
> > [1] [17]https://pandoc.org/
> > [2] [18]https://groups.googl= e.com/
> > [3] [19]http://40googlegroup= s.com/
> > [4] [20]https://groups.google.com/d/msgid/pandoc-discuss/=
> > [5] [21]http://40googlegroups.com/?utm_medium=3Demail&am= p;
> > [6] [22]http= s://groups.google.com/d/msgid/
> > [7] [23]http://40googlegroup= s.com/
> > [8] [24]https://pandoc.org/
> > [9] [25]http= s://groups.google.com/d/msgid/
> > [10] [26]http://40googlegrou= ps.com/
> > [11] [27]https://groups.google.com/d/msgid/pandoc-discuss= /
> a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com?utm_med= ium=3Demail&
> utm_source=3Dfooter
> > [12] [28]https://groups.google.com/d/msgid/pandoc-discuss= /
> 2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com?utm_med= ium=3Demail&
> utm_source=3Dfooter
> > [13] mailto:pa= ndoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > [14] [29]https://groups.google.com/d/msgid/pandoc-discuss= /
> 480d0274-2324-43d7-9f74-1bbfc08fcbd0n%40googlegroups.com?utm_med= ium=3Demail&
> utm_source=3Dfooter
>=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 email
> to [30]pandoc-discus...= @googlegroups.com.
> To view this discussion on the web visit [31]https://groups.google.com/d/msgid/
> pandoc-discuss/e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n%40googlegroups.com.
>=20
> References:
>=20
> [1] https://pandoc.org/
> [2] http://groups.google.com/
> [3] http://40googlegroups.com/
> [4] https://groups.google.com/d/msgid/pandoc-discuss/
> [5] http:= //40googlegroups.com/?utm_medium=3D
> [6] https://groups.google.com/
> [7] http://40googlegroups.com/
> [8] https://pandoc.org/
> [9] https://groups.= google.com/d/msgid/
> [10] http://40googlegroups.com/
> [11] https://groups.google.com/d/msgid/pandoc-discuss/
> [12] http://40googlegroups.com/?utm_medium=3Demail&
> [13] https://groups.google.com/d/msgid/pandoc-discuss/
> [14] http://40googlegroups.com/?utm_medium=3Demail&
> [15] https://groups.= google.com/d/msgid/
> [16] http://40googlegroups.com/
> [17] https://pandoc.org/
> [18] https://groups.google.com/
> [19] http://40googlegroups.com/
> [20] https://groups.google.com/d/msgid/pandoc-discuss/
> [21] http://40googlegroups.com/?utm_medium=3Demail&
> [22] https://groups.= google.com/d/msgid/
> [23] http://40googlegroups.com/
> [24] https://pandoc.org/
> [25] https://groups.= google.com/d/msgid/
> [26] http://40googlegroups.com/
> [27] https://group= s.google.com/d/msgid/pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%4= 0googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter
> [28] https://group= s.google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%4= 0googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter
> [29] https://group= s.google.com/d/msgid/pandoc-discuss/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%4= 0googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter
> [30] mailto:pandoc-disc= us...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [31] https://group= s.google.com/d/msgid/pandoc-discuss/e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n%4= 0googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter

--
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/858c5a07-89a0-4daa-803f-e0d9d50ca9c6n%40googlegroups.= com.
------=_Part_10554_1703632761.1669566283547-- ------=_Part_10553_430593528.1669566283547--