From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31802 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: Sat, 26 Nov 2022 14:30:58 -0800 (PST) Message-ID: <480d0274-2324-43d7-9f74-1bbfc08fcbd0n@googlegroups.com> References: <2aec84ad-a750-48f2-a0c2-ad7572dcca11n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_8466_88733325.1669501858250" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16336"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBD2NNN6DBIIKHJ4KTQDBUBFEVGAFK-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Nov 26 23:31:04 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oa1-f58.google.com ([209.85.160.58]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oz3hP-00046V-Ac for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 26 Nov 2022 23:31:03 +0100 Original-Received: by mail-oa1-f58.google.com with SMTP id 586e51a60fabf-13bb98bb80fsf4289990fac.23 for ; Sat, 26 Nov 2022 14:31:03 -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=1LGefqH0WVLGhzLwyFAMsN8FdOLa/KktbJMG1wZWYog=; b=Q9RYPXH/Zf7FrfRydzqTfpaN2K5AuRzWKbbJy6+xDURxoS0VGt+4e4lCsX9SJywfiG HaKZlNL6OXjBof1fv9t6boYIgbLBMO2nN5eK7/bbGLMLl1mBINOB2RzZxszJYYFBV4tb OWJqOkmdE62crMPtp7bec8HrBdMKyVhytswQqBky0TSBKtxt88B3Er644tyczvoPDP3g OcYgNJasDYU5d8K0fswK1wD8inIO9uWbJzLE5uuAz4/Iv84MVp7vG9rfYnoukBsaNNMr 1vlB91sL1ELU4vDdwpi8er6jii+tE84AgYtXPRAPZg25/jJJ3+YTopy6i8TR44vnk2GI YuIQ== 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=1LGefqH0WVLGhzLwyFAMsN8FdOLa/KktbJMG1wZWYog=; b=XCQPhTamiP4IGEsxqjJStkBre2plN6g34QcOQznOm6BlDVMdUPFC55p2DsOCnvE0Ff 9vbMDOgqtm2lwzRmBFscrEEqhz5Zz27PIO6Xt13u+u/N1FfLMzposRLQm/MylnPv7vvG 4q3iqSlOlWBFEO6UOTfj2JSuFOoZR7nkxwYgS/yMN9BrCJmp5JPfbVc/OlIdbpVCbIlE H/wUa/DsNoHCJ/fZ/STrtpejdMQ/MNREHgWwTVcJNqkENuePCKCR2cBdv2UOE6izVyQ3 nXS7/+wS+zeR7GxaG7OCs4r/89I34ZzQq5Ahi/YSbiQkINYoT5MvxBxfRlB46SkG1wF9 IkLA== 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=1LGefqH0WVLGhzLwyFAMsN8FdOLa/KktbJMG1wZWYog=; b=67qkxphqBQ4CQi0TCjJDU8OEMQHGrOPiF1IcyRiAqF+aI5LcSXDX3i93EQ9rWrQ/B3 W32zN4PNRFft2F/zQLic4ZsGkZwk/UFkhnjdmW6q7a5pzpkigWHjMB+6ekiZbyhMQzgh rv8BU3C9KpcIFpMKybps++AwKwpQVHGhkt2rbXzoKmLD6KsuFFjwIkHDrUlRagHwcIqA oJcCk0T94TxaD+hDYFLBnHzoTVQ91bUYN13mfQTgH7F036ogd/04eKjRO39hP9su9X8e io1+qYRBIeIX4tETkALgfMDrjuDeOEOXu+Lur6Z9H2bh4WmvIAm4SeTxZf3A4vadWp57 82AA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ANoB5pnv/p/H/v/4VsIWAtLrUyBPtpS8KN4IFjI2WkTQev6EcYKAkict oxfqNssKExtLvddOqpNz2xU= X-Google-Smtp-Source: AA0mqf4KUzIKhq4m8EaZa2JIGYSPbI1pljVTu7ytTdx3ZXYkT0CseoFXIJgnovJx4bHHUoYKUunuXQ== X-Received: by 2002:a05:6808:348:b0:35a:26c6:395e with SMTP id j8-20020a056808034800b0035a26c6395emr24035636oie.266.1669501862175; Sat, 26 Nov 2022 14:31:02 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6870:a898:b0:143:1d71:23f2 with SMTP id eb24-20020a056870a89800b001431d7123f2ls2547528oab.9.-pod-prod-gmail; Sat, 26 Nov 2022 14:30:59 -0800 (PST) X-Received: by 2002:a05:6871:4191:b0:143:e11:c9a6 with SMTP id lc17-20020a056871419100b001430e11c9a6mr13564497oab.10.1669501859078; Sat, 26 Nov 2022 14:30:59 -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:31802 Archived-At: ------=_Part_8466_88733325.1669501858250 Content-Type: multipart/alternative; boundary="----=_Part_8467_1605444412.1669501858250" ------=_Part_8467_1605444412.1669501858250 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks I wish that worked. I don't know what I'm doing wrong, here's what= =20 I've got=E2=80=A6 `pandoc --version` says user data dir is `~/.local/share/pandoc` so I=20 placed this file there as=20 `~/.local/share/pandoc/links-with-page-number.lua` and did (just in case)= =20 `chmod +x` on it. `pandoc -o test.pdf test.html` produces a 2page pdf as expected with no=20 footnotes. `pandoc -L links-with-page-number.lua -o test.pdf test.html` fails to=20 produce pdf file with: ``` Error running filter links-with-page-number.lua: links-with-page-number.lua: openBinaryFile: does not exist (No such file or= =20 directory) ``` There's no typo in my script name or command invocation. Using ~/.pandoc=20 instead of ~/.local/share/pandoc doesn't make any difference, still get=20 that same error. Any ideas? On Saturday, November 26, 2022 at 12:34:15 PM UTC-5 Bastien Dumont wrote: > Please find attached a basic implementation. As in the attached sample=20 > HMTL file, I suppose that the targets are marked with ids on spans and th= at=20 > you link to it via empty elements. If you have a LaTeX installation,= =20 > simply do `pandoc -L links-with-page-number.lua -o test.pdf test.html` to= =20 > see the result. > > Le Saturday 26 November 2022 =C3=A0 05:21:25AM, user account a =C3=A9crit= : > > Thanks! Yeah injecting html in the intermediary document doesn't sound= =20 > very > > promising either (again, because the pages have to be built first befor= e > > footnotes updated with page #s) so maybe I'll abandon weasyprint in thi= s=20 > case, > > if this would be easy to do with a *Tex pdf engine. In that case... how= =20 > would > > one go about this? Would a lua filter be more capable with a different= =20 > pdf > > engine or would a different mechanism be used? > >=20 > > On Saturday, November 26, 2022 at 5:28:31 AM UTC-5 Bastien Dumont wrote= : > >=20 > > The problem is that Pandoc does not produce the PDF document: it produc= es > > the intermediary HTML document that is processed by weasyprint to produ= ce > > the PDF. So you cannot get page numbers in a Lua filter. > >=20 > > However, you can inject raw HTML code in the intermediary file (or in= =20 > your > > CSS) that will make weasyprint print the page numbers. The question is > > whether such HTML code exists. It certainly would be possible to do thi= s=20 > if > > you converted to PDF via LaTeX, ConTeXt or groff, but I don't know if i= t=20 > is > > possible via weasyprint. > >=20 > > Le Friday 25 November 2022 =C3=A0 04:33:05PM, user account a =C3=A9crit= : > > > Using pandoc with weasyprint pdf engine to turn the markdown files=20 > 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? The page numbers won't = be > > known > > > until pandoc has already created the document, and I don't know where= =20 > in > > 'the > > > pipeline' the lua filter intervenes compared to when the pages=20 > exist...? > > And > > > If the pages exist with their numbers earlier enough, is there an=20 > object > > or > > > something from which lua can get the page number? > > > > > > I haven't found anything about page numbers in [1]https://pandoc.org/ > > > lua-filters.html#module-pandoc.utils ...am I looking in the wrong=20 > place? > > Can > > > anyone tell me anything about this? > > > > > > It's an intimidating rabbit hole for me, particularly because I see n= o > > mention > > > of "page number" there in the docs, which makes it seem kinda hopeles= s > > > actually. But maybe one of you know the way and could point me in tha= t > > > direction? > > > > > > -- > > > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To view this discussion on the web visit [2][2] > https://groups.google.com/ > > d/msgid/ > > > pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%[3] > > 40googlegroups.com. > > > > > > References: > > > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [2] [4]https://groups.google.com/d/msgid/pandoc-discuss/ > > a93afb43-c939-40c1-868f-1db8eded17d8n% > 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 [5]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [6] > https://groups.google.com/d/msgid/ > > pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com= . > >=20 > > References: > >=20 > > [1] https://pandoc.org/ > > [2] https://groups.google.com/d/msgid/ > > [3] http://40googlegroups.com/ > > [4]=20 > https://groups.google.com/d/msgid/pandoc-discuss/a93afb43-c939-40c1-868f-= 1db8eded17d8n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter > > [5] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [6]=20 > https://groups.google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-a0c2-= ad7572dcca11n%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/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%40googlegroups.com. ------=_Part_8467_1605444412.1669501858250 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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-w= ith-page-number.lua` and did (just in case) `chmod +x` on it.

`pando= c -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-n= umber.lua:
links-with-page-number.lua: openBinaryFile: does not exist (N= o such file or directory)
```

There's no typo in my script name o= r command invocation. Using ~/.pandoc instead of ~/.local/share/pandoc does= n't make any difference, still get that same error.

Any ideas?
On Satu= rday, November 26, 2022 at 12:34:15 PM UTC-5 Bastien Dumont wrote:
Please find attached = a basic implementation. As in the attached sample HMTL file, I suppose that= the targets are marked with ids on spans and that you link to it via empty= <a> elements. If you have a LaTeX 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 account a =C3=A9cr= it :
> Thanks! Yeah injecting html in the intermediary document doesn'= ;t sound very
> promising either (again, because the pages have to be built first = before
> footnotes updated with page #s) so maybe I'll abandon weasypri= nt 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 capable with a diffe= rent pdf
> engine or would a different mechanism be used?
>=20
> On Saturday, November 26, 2022 at 5:28:31 AM UTC-5 Bastien Dumont = wrote:
>=20
> 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.
>=20
> However, you can inject raw HTML code in the intermediary file= (or in your
> CSS) that will make weasyprint print the page numbers. The que= stion 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= 9;t know if it is
> possible via weasyprint.
>=20
> Le Friday 25 November 2022 =C3=A0 04:33:05PM, user account a = =C3=A9crit :
> > Using pandoc with weasyprint pdf engine to turn the markd= own files from a
> blog
> > (static site generator does the html conversion) into a p= df 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? The page nu= mbers won't be
> known
> > until pandoc has already created the document, and I don&= #39;t know 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]
https://pandoc.org/
> > lua-filters.html#module-pandoc.utils ...am I looking in t= he wrong place?
> Can
> > anyone tell me anything about this?
> >
> > It's an intimidating rabbit hole for me, particularly= because I see 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 poi= nt me in that
> > direction?
> >
> > --
> > 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 [1]pandoc-d= iscus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> > To view this discussion on the web visit [2][2]https://groups.google.com/
> d/msgid/
> > pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%[3]
> 40googlegroups.com.
> >
> > References:
> >
> > [1] mailto:pan= doc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > [2] [4]https://groups.google.com/d/msgid/pandoc-discuss/<= /a>
> a93afb43-c939-40c1-868f-1db8eded17d8n%
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 [5]pandoc-discus...@= googlegroups.com.
> To view this discussion on the web visit [6]https://groups.google.com/d/msgid/
> pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com.
>=20
> References:
>=20
> [1] https://pandoc.org/
> [2] https://groups.= google.com/d/msgid/
> [3] http://40googlegroups.com/
> [4] https://groups= .google.com/d/msgid/pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%40= googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter
> [5] mailto:pandoc-discu= s...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [6] https://groups= .google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40= googlegroups.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/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%40googlegroups.= com.
------=_Part_8467_1605444412.1669501858250-- ------=_Part_8466_88733325.1669501858250--