* converting links to footnotes... including page number in footnote?? @ 2022-11-26 0:33 user account [not found] ` <a93afb43-c939-40c1-868f-1db8eded17d8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 14+ messages in thread From: user account @ 2022-11-26 0:33 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 1427 bytes --] 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? The 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 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 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 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 point me in that direction? -- 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/a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 1798 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <a93afb43-c939-40c1-868f-1db8eded17d8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: converting links to footnotes... including page number in footnote?? [not found] ` <a93afb43-c939-40c1-868f-1db8eded17d8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2022-11-26 10:28 ` Bastien DUMONT 2022-11-26 13:21 ` user account 0 siblings, 1 reply; 14+ messages in thread From: Bastien DUMONT @ 2022-11-26 10:28 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw 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 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 à 04:33:05PM, user account a écrit : > 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? The 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 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 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 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 point me in that > direction? > > -- > 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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [2]https://groups.google.com/d/msgid/ > pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com. > > References: > > [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [2] https://groups.google.com/d/msgid/pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com?utm_medium=email&utm_source=footer -- 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/Y4HqRjQQMmKy8yRw%40localhost. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: converting links to footnotes... including page number in footnote?? 2022-11-26 10:28 ` Bastien DUMONT @ 2022-11-26 13:21 ` user account [not found] ` <2aec84ad-a750-48f2-a0c2-ad7572dcca11n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 14+ messages in thread From: user account @ 2022-11-26 13:21 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 3409 bytes --] 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 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 capable with a 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 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 à 04:33:05PM, user account a écrit : > > 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? The 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 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 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 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 point me in that > > direction? > > > > -- > > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [2] > https://groups.google.com/d/msgid/ > > pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com. > > > > References: > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [2] > https://groups.google.com/d/msgid/pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com?utm_medium=email&utm_source=footer > > -- 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/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 5311 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <2aec84ad-a750-48f2-a0c2-ad7572dcca11n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: converting links to footnotes... including page number in footnote?? [not found] ` <2aec84ad-a750-48f2-a0c2-ad7572dcca11n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2022-11-26 13:52 ` 'Håkon Wium Lie' via pandoc-discuss [not found] ` <25474.6699.105043.345344-4mDQ13Tdud8Jw5R7aSpS0dP8p4LwMBBS@public.gmane.org> 2022-11-26 17:34 ` Bastien DUMONT 1 sibling, 1 reply; 14+ messages in thread From: 'Håkon Wium Lie' via pandoc-discuss @ 2022-11-26 13:52 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw If you use Prince as the PDF generator, you can produce quite advanced footnotes: https://css4.pub/2022/footnotes/ Also, Prince supports sidenotes, aiming for the holy grail of Tufte-like layout: https://css4.pub https://css4.pub/2022/sidenotes/ To add the page number of the linked-to page (which was the original question), Prince supports the "target-counter" feature in CSS. https://www.princexml.com/doc/gen-content/ This is often used to create ToCs: https://css4.pub/2022/toc/ (Prince is a commercial product, but free for non-commercial use. I work for the company.) Håkon Wium Lie haakon-EO96REbE7qRuMpJDpNschA@public.gmane.org www.wiumlie.no/en > 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 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 capable with a > 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 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 à 04:33:05PM, user account a écrit : > > > 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? The 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 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 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 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 point me in that > > > direction? > > > > > > -- > > > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To view this discussion on the web visit [2] > > https://groups.google.com/d/msgid/ > > > pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com. > > > > > > References: > > > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [2] > > https://groups.google.com/d/msgid/pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com?utm_medium=email&utm_source=footer > > > > > > -- > 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/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com. -- 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/25474.6699.105043.345344%40gargle.gargle.HOWL. ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <25474.6699.105043.345344-4mDQ13Tdud8Jw5R7aSpS0dP8p4LwMBBS@public.gmane.org>]
* Re: converting links to footnotes... including page number in footnote?? [not found] ` <25474.6699.105043.345344-4mDQ13Tdud8Jw5R7aSpS0dP8p4LwMBBS@public.gmane.org> @ 2022-11-26 15:35 ` user account 0 siblings, 0 replies; 14+ messages in thread From: user account @ 2022-11-26 15:35 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 5095 bytes --] Prince looks decent, but I'm reluctant to use anything that's not freedom software. On Saturday, November 26, 2022 at 8:52:52 AM UTC-5 Håkon Wium Lie wrote: > If you use Prince as the PDF generator, you can produce quite advanced > footnotes: > > https://css4.pub/2022/footnotes/ > > Also, Prince supports sidenotes, aiming for the holy grail of Tufte-like > layout: > > https://css4.pub > https://css4.pub/2022/sidenotes/ > > To add the page number of the linked-to page (which was the original > question), Prince supports the "target-counter" feature in CSS. > > https://www.princexml.com/doc/gen-content/ > > This is often used to create ToCs: > > https://css4.pub/2022/toc/ > > (Prince is a commercial product, but free for non-commercial use. I work > for the company.) > > Håkon Wium Lie haa...-EO96REbE7qRuMpJDpNschA@public.gmane.org www.wiumlie.no/en > > > 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 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 capable with a > > 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 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 à 04:33:05PM, user account a écrit : > > > > 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? The 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 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 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 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 point me in > that > > > > direction? > > > > > > > > -- > > > > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > To view this discussion on the web visit [2] > > > https://groups.google.com/d/msgid/ > > > > pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n% > 40googlegroups.com. > > > > > > > > References: > > > > > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > > [2] > > > > https://groups.google.com/d/msgid/pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com?utm_medium=email&utm_source=footer > > > > > > > > > > -- > > 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com > . > -- 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/ffe38e06-2703-4e9b-b1ca-48310162c97dn%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 9477 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: converting links to footnotes... including page number in footnote?? [not found] ` <2aec84ad-a750-48f2-a0c2-ad7572dcca11n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-11-26 13:52 ` 'Håkon Wium Lie' via pandoc-discuss @ 2022-11-26 17:34 ` Bastien DUMONT 2022-11-26 22:30 ` user account 1 sibling, 1 reply; 14+ messages in thread From: Bastien DUMONT @ 2022-11-26 17:34 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw [-- Attachment #1: Type: text/plain, Size: 4931 bytes --] 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 à 05:21:25AM, user account a écrit : > 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 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 capable with a 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 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 à 04:33:05PM, user account a écrit : > > 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? The 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 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 the 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 point me in that > > direction? > > > > -- > > 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 [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=email& > utm_source=footer > > > -- > 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-discuss+unsubscribe-/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. > > References: > > [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%40googlegroups.com?utm_medium=email&utm_source=footer > [5] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [6] https://groups.google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com?utm_medium=email&utm_source=footer -- 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/Y4JOEZ759MXeTFiS%40localhost. [-- Attachment #2: links-with-page-number.lua --] [-- Type: text/plain, Size: 389 bytes --] function Link(link) local target = link.target if string.sub(target, 1, 1) == '#' then local label = string.sub(target, 2) link.content=pandoc.RawInline('latex', 'p.~\\pageref{' .. label .. '}') end return link end function Span(span) local id = span.identifier if span.identifier then return { pandoc.RawInline('latex', '\\label{' .. id .. '}'), span } end end [-- Attachment #3: test.html --] [-- Type: text/html, Size: 778 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: converting links to footnotes... including page number in footnote?? 2022-11-26 17:34 ` Bastien DUMONT @ 2022-11-26 22:30 ` user account [not found] ` <480d0274-2324-43d7-9f74-1bbfc08fcbd0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 14+ messages in thread From: user account @ 2022-11-26 22:30 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 5882 bytes --] Thanks I wish that worked. I don't know what I'm doing wrong, here's what I've got… `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 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 file or directory) ``` There's no typo in my script name or command invocation. Using ~/.pandoc instead of ~/.local/share/pandoc doesn't make any difference, still get 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 > 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 à 05:21:25AM, user account a écrit : > > 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 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 capable with a 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 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 à 04:33:05PM, user account a écrit : > > > 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? The 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 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 the 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 point me in that > > > direction? > > > > > > -- > > > 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 [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=email& > > utm_source=footer > > > > > > -- > > 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...-/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. > > > > References: > > > > [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%40googlegroups.com?utm_medium=email&utm_source=footer > > [5] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [6] > https://groups.google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com?utm_medium=email&utm_source=footer > > -- 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/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 10683 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <480d0274-2324-43d7-9f74-1bbfc08fcbd0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: converting links to footnotes... including page number in footnote?? [not found] ` <480d0274-2324-43d7-9f74-1bbfc08fcbd0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2022-11-27 8:56 ` Bastien DUMONT 2022-11-27 14:13 ` user account 0 siblings, 1 reply; 14+ messages in thread From: Bastien DUMONT @ 2022-11-27 8:56 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw Place the file under `~/.local/share/pandoc/filters`. You don't need the executable flag. Le Saturday 26 November 2022 à 02:30:58PM, user account a écrit : > Thanks I wish that worked. I don't know what I'm doing wrong, here's what I've > got… > > `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 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 file or > directory) > ``` > > There's no typo in my script name or command invocation. Using ~/.pandoc > instead of ~/.local/share/pandoc doesn't make any difference, still get 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 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 à 05:21:25AM, user account a écrit : > > 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 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 capable with a 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 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 à 04:33:05PM, user account a écrit : > > > 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? The 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 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]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 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 point me in that > > > direction? > > > > > > -- > > > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To view this discussion on the web visit [2][2][2]https:// > groups.google.com/ > > d/msgid/ > > > pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%[3] > > [3]40googlegroups.com. > > > > > > References: > > > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [2] [4][4]https://groups.google.com/d/msgid/pandoc-discuss/ > > a93afb43-c939-40c1-868f-1db8eded17d8n%[5]40googlegroups.com?utm_medium= > email& > > utm_source=footer > > > > > > -- > > 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [6][6]https://groups.google.com/ > d/msgid/ > > pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%[7] > 40googlegroups.com. > > > > References: > > > > [1] [8]https://pandoc.org/ > > [2] [9]https://groups.google.com/d/msgid/ > > [3] [10]http://40googlegroups.com/ > > [4] [11]https://groups.google.com/d/msgid/pandoc-discuss/ > a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com?utm_medium=email& > utm_source=footer > > [5] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [6] [12]https://groups.google.com/d/msgid/pandoc-discuss/ > 2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com?utm_medium=email& > utm_source=footer > > > -- > 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 [13]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [14]https://groups.google.com/d/msgid/ > pandoc-discuss/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%40googlegroups.com. > > References: > > [1] https://pandoc.org/ > [2] https://groups.google.com/ > [3] http://40googlegroups.com/ > [4] https://groups.google.com/d/msgid/pandoc-discuss/ > [5] http://40googlegroups.com/?utm_medium=email& > [6] https://groups.google.com/d/msgid/ > [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/a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com?utm_medium=email&utm_source=footer > [12] https://groups.google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com?utm_medium=email&utm_source=footer > [13] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [14] https://groups.google.com/d/msgid/pandoc-discuss/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%40googlegroups.com?utm_medium=email&utm_source=footer -- 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/Y4MmWNAvmcqr%2Bgg%2B%40localhost. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: converting links to footnotes... including page number in footnote?? 2022-11-27 8:56 ` Bastien DUMONT @ 2022-11-27 14:13 ` user account [not found] ` <e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 14+ messages in thread From: user account @ 2022-11-27 14:13 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 9281 bytes --] oh a 'filters' subdir! Thanks. So now the pdf gets created w/o error, but there are not footnotes. 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. Something undesireable does happen though... I changed the paragraph with the link to: <p>Here is a link to <a href="#thetarget">important words about the target</a>.</p> ...and the "important words about the target" get removed altogether. Those should not be removed, just the <a> tags around them should be removed. 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 looking 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? I imagine this working example produce footnotes w/ page numbers for you in your environment...? Any idea what I could inspect to try to get it working in mine? On Sunday, November 27, 2022 at 3:57:02 AM UTC-5 Bastien Dumont wrote: > Place the file under `~/.local/share/pandoc/filters`. You don't need the > executable flag. > > Le Saturday 26 November 2022 à 02:30:58PM, user account a écrit : > > Thanks I wish that worked. I don't know what I'm doing wrong, here's > what I've > > got… > > > > `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 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 file > or > > directory) > > ``` > > > > There's no typo in my script name or command invocation. Using ~/.pandoc > > instead of ~/.local/share/pandoc doesn't make any difference, still get > 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 > 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 à 05:21:25AM, user account a écrit : > > > 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 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 capable with a 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 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 à 04:33:05PM, user account a écrit : > > > > 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? The 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 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] > 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 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 point me in > that > > > > direction? > > > > > > > > -- > > > > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > To view this discussion on the web visit [2][2][2]https:// > > groups.google.com/ > > > d/msgid/ > > > > pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%[3] > > > [3]40googlegroups.com. > > > > > > > > References: > > > > > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > > [2] [4][4]https://groups.google.com/d/msgid/pandoc-discuss/ > > > a93afb43-c939-40c1-868f-1db8eded17d8n%[5] > 40googlegroups.com?utm_medium= > > email& > > > utm_source=footer > > > > > > > > > -- > > > 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To view this discussion on the web visit [6][6] > https://groups.google.com/ > > d/msgid/ > > > pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%[7] > > 40googlegroups.com. > > > > > > References: > > > > > > [1] [8]https://pandoc.org/ > > > [2] [9]https://groups.google.com/d/msgid/ > > > [3] [10]http://40googlegroups.com/ > > > [4] [11]https://groups.google.com/d/msgid/pandoc-discuss/ > > a93afb43-c939-40c1-868f-1db8eded17d8n% > 40googlegroups.com?utm_medium=email& > > utm_source=footer > > > [5] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [6] [12]https://groups.google.com/d/msgid/pandoc-discuss/ > > 2aec84ad-a750-48f2-a0c2-ad7572dcca11n% > 40googlegroups.com?utm_medium=email& > > utm_source=footer > > > > > > -- > > 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 [13]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [14] > https://groups.google.com/d/msgid/ > > pandoc-discuss/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%40googlegroups.com. > > > > References: > > > > [1] https://pandoc.org/ > > [2] https://groups.google.com/ > > [3] http://40googlegroups.com/ > > [4] https://groups.google.com/d/msgid/pandoc-discuss/ > > [5] http://40googlegroups.com/?utm_medium=email& > > [6] https://groups.google.com/d/msgid/ > > [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/a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com?utm_medium=email&utm_source=footer > > [12] > https://groups.google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com?utm_medium=email&utm_source=footer > > [13] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [14] > https://groups.google.com/d/msgid/pandoc-discuss/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%40googlegroups.com?utm_medium=email&utm_source=footer > > -- 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/e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 19800 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: converting links to footnotes... including page number in footnote?? [not found] ` <e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2022-11-27 15:50 ` Bastien DUMONT 2022-11-27 16:24 ` user account 0 siblings, 1 reply; 14+ messages in thread From: Bastien DUMONT @ 2022-11-27 15:50 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw My filter only shows how one can inject raw code to get references 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 à 06:13:53AM, user account a écrit : > oh a 'filters' subdir! Thanks. So now the pdf gets created w/o error, but there > are not footnotes. > > 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. > > Something undesireable does happen though... I changed the paragraph with the > link to: > <p>Here is a link to <a href="#thetarget">important words about the target</a>. > </p> > ...and the "important words about the target" get removed altogether. Those > should not be removed, just the <a> tags around them should be removed. > > 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 looking 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? > > I imagine this working example produce footnotes w/ page numbers for you in > your environment...? Any idea what I could inspect to try to get it working in > mine? > On Sunday, November 27, 2022 at 3:57:02 AM UTC-5 Bastien Dumont wrote: > > Place the file under `~/.local/share/pandoc/filters`. You don't need the > executable flag. > > Le Saturday 26 November 2022 à 02:30:58PM, user account a écrit : > > Thanks I wish that worked. I don't know what I'm doing wrong, here's what > I've > > got… > > > > `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 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 file > or > > directory) > > ``` > > > > There's no typo in my script name or command invocation. Using ~/.pandoc > > instead of ~/.local/share/pandoc doesn't make any difference, still get > 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 > 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 à 05:21:25AM, user account a écrit : > > > 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 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 capable with a 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 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 à 04:33:05PM, user account a écrit : > > > > 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? The 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 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 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 point me in > that > > > > direction? > > > > > > > > -- > > > > 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 [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= > > email& > > > utm_source=footer > > > > > > > > > -- > > > 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...-/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= > email& > > utm_source=footer > > > [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= > email& > > utm_source=footer > > > > > > -- > > 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 [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=email& > > [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=email& > utm_source=footer > > [12] [28]https://groups.google.com/d/msgid/pandoc-discuss/ > 2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com?utm_medium=email& > utm_source=footer > > [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=email& > utm_source=footer > > > -- > 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-discuss+unsubscribe-/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. > > References: > > [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= > [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=email& > [13] https://groups.google.com/d/msgid/pandoc-discuss/ > [14] http://40googlegroups.com/?utm_medium=email& > [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=email& > [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://groups.google.com/d/msgid/pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com?utm_medium=email&utm_source=footer > [28] https://groups.google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com?utm_medium=email&utm_source=footer > [29] https://groups.google.com/d/msgid/pandoc-discuss/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%40googlegroups.com?utm_medium=email&utm_source=footer > [30] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [31] https://groups.google.com/d/msgid/pandoc-discuss/e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n%40googlegroups.com?utm_medium=email&utm_source=footer -- 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/Y4OHKqAxAZXbj%2Bvw%40localhost. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: converting links to footnotes... including page number in footnote?? 2022-11-27 15:50 ` Bastien DUMONT @ 2022-11-27 16:24 ` user account [not found] ` <858c5a07-89a0-4daa-803f-e0d9d50ca9c6n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 14+ messages in thread From: user account @ 2022-11-27 16:24 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 13171 bytes --] Ok, gotcha! Could you point me to an example of how that page number could be printed somewhere? My goal is this, HTML: <p>Here's text with <a href="/some-blog-post">anchor 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 <scripted 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 references 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 à 06:13:53AM, user account a écrit : > > oh a 'filters' subdir! Thanks. So now the pdf gets created w/o error, > but there > > are not footnotes. > > > > 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. > > > > Something undesireable does happen though... I changed the paragraph > with the > > link to: > > <p>Here is a link to <a href="#thetarget">important words about the > target</a>. > > </p> > > ...and the "important words about the target" get removed altogether. > Those > > should not be removed, just the <a> tags around them should be removed. > > > > 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 looking 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? > > > > I imagine this working example produce footnotes w/ page numbers for you > in > > your environment...? Any idea what I could inspect to try to get it > working in > > mine? > > On Sunday, November 27, 2022 at 3:57:02 AM UTC-5 Bastien Dumont wrote: > > > > Place the file under `~/.local/share/pandoc/filters`. You don't need the > > executable flag. > > > > Le Saturday 26 November 2022 à 02:30:58PM, user account a écrit : > > > Thanks I wish that worked. I don't know what I'm doing wrong, here's > what > > I've > > > got… > > > > > > `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 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 > file > > or > > > directory) > > > ``` > > > > > > There's no typo in my script name or command invocation. Using > ~/.pandoc > > > instead of ~/.local/share/pandoc doesn't make any difference, still get > > 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 > > 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 à 05:21:25AM, user account a écrit : > > > > 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 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 capable with a > 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 > 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 à 04:33:05PM, user account a écrit : > > > > > 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? The 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 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 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 point me in > > that > > > > > direction? > > > > > > > > > > -- > > > > > 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 [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= > > > email& > > > > utm_source=footer > > > > > > > > > > > > -- > > > > 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...-/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= > > email& > > > utm_source=footer > > > > [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= > > email& > > > utm_source=footer > > > > > > > > > -- > > > 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 [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=email& > > > [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=email& > > utm_source=footer > > > [12] [28]https://groups.google.com/d/msgid/pandoc-discuss/ > > 2aec84ad-a750-48f2-a0c2-ad7572dcca11n% > 40googlegroups.com?utm_medium=email& > > utm_source=footer > > > [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=email& > > utm_source=footer > > > > > > -- > > 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...-/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. > > > > References: > > > > [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= > > [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=email& > > [13] https://groups.google.com/d/msgid/pandoc-discuss/ > > [14] http://40googlegroups.com/?utm_medium=email& > > [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=email& > > [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://groups.google.com/d/msgid/pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com?utm_medium=email&utm_source=footer > > [28] > https://groups.google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com?utm_medium=email&utm_source=footer > > [29] > https://groups.google.com/d/msgid/pandoc-discuss/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%40googlegroups.com?utm_medium=email&utm_source=footer > > [30] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [31] > https://groups.google.com/d/msgid/pandoc-discuss/e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n%40googlegroups.com?utm_medium=email&utm_source=footer > > -- 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/858c5a07-89a0-4daa-803f-e0d9d50ca9c6n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 34809 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <858c5a07-89a0-4daa-803f-e0d9d50ca9c6n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: converting links to footnotes... including page number in footnote?? [not found] ` <858c5a07-89a0-4daa-803f-e0d9d50ca9c6n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2022-11-27 17:01 ` Bastien DUMONT 2022-11-28 4:01 ` user account 0 siblings, 1 reply; 14+ messages in thread From: Bastien DUMONT @ 2022-11-27 17:01 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw [-- Attachment #1: Type: text/plain, Size: 18685 bytes --] Please see the updated filter attached! Le Sunday 27 November 2022 à 08:24:43AM, user account a écrit : > Ok, gotcha! Could you point me to an example of how that page number could be > printed somewhere? > > My goal is this, HTML: > <p>Here's text with <a href="/some-blog-post">anchor 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 <scripted 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 references 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 à 06:13:53AM, user account a écrit : > > oh a 'filters' subdir! Thanks. So now the pdf gets created w/o error, but > there > > are not footnotes. > > > > 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. > > > > Something undesireable does happen though... I changed the paragraph with > the > > link to: > > <p>Here is a link to <a href="#thetarget">important words about the > target</a>. > > </p> > > ...and the "important words about the target" get removed altogether. > Those > > should not be removed, just the <a> tags around them should be removed. > > > > 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 looking for > > functions with particular names like Link and Span? Would you mind > > confirming... this [1]https://pandoc.org/lua-filters.html#type-link is > the proper > > spot in the docs for referencing Link in this context... right? > > > > I imagine this working example produce footnotes w/ page numbers for you > in > > your environment...? Any idea what I could inspect to try to get it > working in > > mine? > > On Sunday, November 27, 2022 at 3:57:02 AM UTC-5 Bastien Dumont wrote: > > > > Place the file under `~/.local/share/pandoc/filters`. You don't need the > > executable flag. > > > > Le Saturday 26 November 2022 à 02:30:58PM, user account a écrit : > > > Thanks I wish that worked. I don't know what I'm doing wrong, here's > what > > I've > > > got… > > > > > > `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 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 > file > > or > > > directory) > > > ``` > > > > > > There's no typo in my script name or command invocation. Using ~ > /.pandoc > > > instead of ~/.local/share/pandoc doesn't make any difference, still get > > 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 > > 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 à 05:21:25AM, user account a écrit : > > > > 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 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 capable with a > 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 > 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 à 04:33:05PM, user account a écrit : > > > > > 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? The 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 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:// > > [2]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 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 point me in > > that > > > > > direction? > > > > > > > > > > -- > > > > > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > To view this discussion on the web visit [2][2][2]https:// > > > [2][3]groups.google.com/ > > > > d/msgid/ > > > > > pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%[3] > > > > [3][3][4]40googlegroups.com. > > > > > > > > > > References: > > > > > > > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > > > [2] [4][4][4][5]https://groups.google.com/d/msgid/pandoc-discuss/ > > > > a93afb43-c939-40c1-868f-1db8eded17d8n%[5][5][6]40googlegroups.com? > > utm_medium= > > > email& > > > > utm_source=footer > > > > > > > > > > > > -- > > > > 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > To view this discussion on the web visit [6][6][6]https:// > > [7]groups.google.com/ > > > d/msgid/ > > > > pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%[7] > > > [7][8]40googlegroups.com. > > > > > > > > References: > > > > > > > > [1] [8][8][9]https://pandoc.org/ > > > > [2] [9][9][10]https://groups.google.com/d/msgid/ > > > > [3] [10][10][11]http://40googlegroups.com/ > > > > [4] [11][11][12]https://groups.google.com/d/msgid/pandoc-discuss/ > > > a93afb43-c939-40c1-868f-1db8eded17d8n%[12][13]40googlegroups.com? > utm_medium= > > email& > > > utm_source=footer > > > > [5] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > > [6] [12][13][14]https://groups.google.com/d/msgid/pandoc-discuss/ > > > 2aec84ad-a750-48f2-a0c2-ad7572dcca11n%[14][15]40googlegroups.com? > utm_medium= > > email& > > > utm_source=footer > > > > > > > > > -- > > > 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 [13]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To view this discussion on the web visit [14][15]https:// > > [16]groups.google.com/d/msgid/ > > > pandoc-discuss/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%[16] > > [17]40googlegroups.com. > > > > > > References: > > > > > > [1] [17][18]https://pandoc.org/ > > > [2] [18][19]https://groups.google.com/ > > > [3] [19][20]http://40googlegroups.com/ > > > [4] [20][21]https://groups.google.com/d/msgid/pandoc-discuss/ > > > [5] [21][22]http://40googlegroups.com/?utm_medium=email& > > > [6] [22][23]https://groups.google.com/d/msgid/ > > > [7] [23][24]http://40googlegroups.com/ > > > [8] [24][25]https://pandoc.org/ > > > [9] [25][26]https://groups.google.com/d/msgid/ > > > [10] [26][27]http://40googlegroups.com/ > > > [11] [27][28]https://groups.google.com/d/msgid/pandoc-discuss/ > > a93afb43-c939-40c1-868f-1db8eded17d8n%[29]40googlegroups.com?utm_medium= > email& > > utm_source=footer > > > [12] [28][30]https://groups.google.com/d/msgid/pandoc-discuss/ > > 2aec84ad-a750-48f2-a0c2-ad7572dcca11n%[31]40googlegroups.com?utm_medium= > email& > > utm_source=footer > > > [13] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [14] [29][32]https://groups.google.com/d/msgid/pandoc-discuss/ > > 480d0274-2324-43d7-9f74-1bbfc08fcbd0n%[33]40googlegroups.com?utm_medium= > email& > > utm_source=footer > > > > > > -- > > 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [31][34]https:// > groups.google.com/d/msgid/ > > pandoc-discuss/e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n%[35] > 40googlegroups.com. > > > > References: > > > > [1] [36]https://pandoc.org/ > > [2] [37]http://groups.google.com/ > > [3] [38]http://40googlegroups.com/ > > [4] [39]https://groups.google.com/d/msgid/pandoc-discuss/ > > [5] [40]http://40googlegroups.com/?utm_medium= > > [6] [41]https://groups.google.com/ > > [7] [42]http://40googlegroups.com/ > > [8] [43]https://pandoc.org/ > > [9] [44]https://groups.google.com/d/msgid/ > > [10] [45]http://40googlegroups.com/ > > [11] [46]https://groups.google.com/d/msgid/pandoc-discuss/ > > [12] [47]http://40googlegroups.com/?utm_medium=email& > > [13] [48]https://groups.google.com/d/msgid/pandoc-discuss/ > > [14] [49]http://40googlegroups.com/?utm_medium=email& > > [15] [50]https://groups.google.com/d/msgid/ > > [16] [51]http://40googlegroups.com/ > > [17] [52]https://pandoc.org/ > > [18] [53]https://groups.google.com/ > > [19] [54]http://40googlegroups.com/ > > [20] [55]https://groups.google.com/d/msgid/pandoc-discuss/ > > [21] [56]http://40googlegroups.com/?utm_medium=email& > > [22] [57]https://groups.google.com/d/msgid/ > > [23] [58]http://40googlegroups.com/ > > [24] [59]https://pandoc.org/ > > [25] [60]https://groups.google.com/d/msgid/ > > [26] [61]http://40googlegroups.com/ > > [27] [62]https://groups.google.com/d/msgid/pandoc-discuss/ > a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com?utm_medium=email& > utm_source=footer > > [28] [63]https://groups.google.com/d/msgid/pandoc-discuss/ > 2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com?utm_medium=email& > utm_source=footer > > [29] [64]https://groups.google.com/d/msgid/pandoc-discuss/ > 480d0274-2324-43d7-9f74-1bbfc08fcbd0n%40googlegroups.com?utm_medium=email& > utm_source=footer > > [30] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [31] [65]https://groups.google.com/d/msgid/pandoc-discuss/ > e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n%40googlegroups.com?utm_medium=email& > utm_source=footer > > > -- > 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 [66]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [67]https://groups.google.com/d/msgid/ > pandoc-discuss/858c5a07-89a0-4daa-803f-e0d9d50ca9c6n%40googlegroups.com. > > References: > > [1] https://pandoc.org/lua-filters.html#type-link > [2] http://pandoc.org/ > [3] http://groups.google.com/ > [4] http://40googlegroups.com/ > [5] https://groups.google.com/d/msgid/pandoc-discuss/ > [6] http://40googlegroups.com/ > [7] http://groups.google.com/ > [8] http://40googlegroups.com/ > [9] https://pandoc.org/ > [10] https://groups.google.com/d/msgid/ > [11] http://40googlegroups.com/ > [12] https://groups.google.com/d/msgid/pandoc-discuss/ > [13] http://40googlegroups.com/?utm_medium= > [14] https://groups.google.com/d/msgid/pandoc-discuss/ > [15] http://40googlegroups.com/?utm_medium= > [16] http://groups.google.com/d/msgid/ > [17] http://40googlegroups.com/ > [18] https://pandoc.org/ > [19] https://groups.google.com/ > [20] http://40googlegroups.com/ > [21] https://groups.google.com/d/msgid/pandoc-discuss/ > [22] http://40googlegroups.com/?utm_medium=email& > [23] https://groups.google.com/d/msgid/ > [24] http://40googlegroups.com/ > [25] https://pandoc.org/ > [26] https://groups.google.com/d/msgid/ > [27] http://40googlegroups.com/ > [28] https://groups.google.com/d/msgid/pandoc-discuss/ > [29] http://40googlegroups.com/?utm_medium=email& > [30] https://groups.google.com/d/msgid/pandoc-discuss/ > [31] http://40googlegroups.com/?utm_medium=email& > [32] https://groups.google.com/d/msgid/pandoc-discuss/ > [33] http://40googlegroups.com/?utm_medium=email& > [34] https://groups.google.com/d/msgid/ > [35] http://40googlegroups.com/ > [36] https://pandoc.org/ > [37] http://groups.google.com/ > [38] http://40googlegroups.com/ > [39] https://groups.google.com/d/msgid/pandoc-discuss/ > [40] http://40googlegroups.com/?utm_medium= > [41] https://groups.google.com/ > [42] http://40googlegroups.com/ > [43] https://pandoc.org/ > [44] https://groups.google.com/d/msgid/ > [45] http://40googlegroups.com/ > [46] https://groups.google.com/d/msgid/pandoc-discuss/ > [47] http://40googlegroups.com/?utm_medium=email& > [48] https://groups.google.com/d/msgid/pandoc-discuss/ > [49] http://40googlegroups.com/?utm_medium=email& > [50] https://groups.google.com/d/msgid/ > [51] http://40googlegroups.com/ > [52] https://pandoc.org/ > [53] https://groups.google.com/ > [54] http://40googlegroups.com/ > [55] https://groups.google.com/d/msgid/pandoc-discuss/ > [56] http://40googlegroups.com/?utm_medium=email& > [57] https://groups.google.com/d/msgid/ > [58] http://40googlegroups.com/ > [59] https://pandoc.org/ > [60] https://groups.google.com/d/msgid/ > [61] http://40googlegroups.com/ > [62] https://groups.google.com/d/msgid/pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com?utm_medium=email&utm_source=footer > [63] https://groups.google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com?utm_medium=email&utm_source=footer > [64] https://groups.google.com/d/msgid/pandoc-discuss/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%40googlegroups.com?utm_medium=email&utm_source=footer > [65] https://groups.google.com/d/msgid/pandoc-discuss/e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n%40googlegroups.com?utm_medium=email&utm_source=footer > [66] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [67] https://groups.google.com/d/msgid/pandoc-discuss/858c5a07-89a0-4daa-803f-e0d9d50ca9c6n%40googlegroups.com?utm_medium=email&utm_source=footer -- 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/Y4OX64EZ264ZQOhq%40localhost. [-- Attachment #2: links-with-page-number.lua --] [-- Type: text/plain, Size: 584 bytes --] function Link(link) local target = link.target if string.sub(target, 1, 1) == '#' then local label = string.sub(target, 2) local ref_by_page = pandoc.RawInline('latex', 'page \\#\\pageref{' .. label .. '}') local note_content = pandoc.Para({pandoc.Str('See on '), ref_by_page, pandoc.Str('.')}) local footnote = pandoc.Note(note_content) link.content:insert(footnote) return link.content end end function Span(span) local id = span.identifier if span.identifier then return { pandoc.RawInline('latex', '\\label{' .. id .. '}'), span } end end ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: converting links to footnotes... including page number in footnote?? 2022-11-27 17:01 ` Bastien DUMONT @ 2022-11-28 4:01 ` user account [not found] ` <80adcd1d-bc18-4b38-b3a9-0265d0922790n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 14+ messages in thread From: user account @ 2022-11-28 4:01 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 18818 bytes --] That is AWESOME - thank you!!! I see that the function `function Span(span)` turns 1 See on page #??. in to 1 See on page #2. but I can't for the life of me figure out how. Would you mind explaining that? I've been digging through the docs, but got a lot of headscratching going on, many more questions than answers. On Sunday, November 27, 2022 at 12:01:44 PM UTC-5 Bastien Dumont wrote: > Please see the updated filter attached! > > Le Sunday 27 November 2022 à 08:24:43AM, user account a écrit : > > Ok, gotcha! Could you point me to an example of how that page number > could be > > printed somewhere? > > > > My goal is this, HTML: > > <p>Here's text with <a href="/some-blog-post">anchor 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 <scripted 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 references 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 à 06:13:53AM, user account a écrit : > > > oh a 'filters' subdir! Thanks. So now the pdf gets created w/o error, > but > > there > > > are not footnotes. > > > > > > 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. > > > > > > Something undesireable does happen though... I changed the paragraph > with > > the > > > link to: > > > <p>Here is a link to <a href="#thetarget">important words about the > > target</a>. > > > </p> > > > ...and the "important words about the target" get removed altogether. > > Those > > > should not be removed, just the <a> tags around them should be removed. > > > > > > 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 looking > for > > > functions with particular names like Link and Span? Would you mind > > > confirming... this [1]https://pandoc.org/lua-filters.html#type-link is > > the proper > > > spot in the docs for referencing Link in this context... right? > > > > > > I imagine this working example produce footnotes w/ page numbers for > you > > in > > > your environment...? Any idea what I could inspect to try to get it > > working in > > > mine? > > > On Sunday, November 27, 2022 at 3:57:02 AM UTC-5 Bastien Dumont wrote: > > > > > > Place the file under `~/.local/share/pandoc/filters`. You don't need > the > > > executable flag. > > > > > > Le Saturday 26 November 2022 à 02:30:58PM, user account a écrit : > > > > Thanks I wish that worked. I don't know what I'm doing wrong, here's > > what > > > I've > > > > got… > > > > > > > > `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 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 > > file > > > or > > > > directory) > > > > ``` > > > > > > > > There's no typo in my script name or command invocation. Using ~ > > /.pandoc > > > > instead of ~/.local/share/pandoc doesn't make any difference, still > get > > > 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 > > > 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 à 05:21:25AM, user account a écrit : > > > > > 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 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 capable with a > > 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 > > 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 à 04:33:05PM, user account a écrit : > > > > > > 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? The 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 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:// > > > [2]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 > 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 point me in > > > that > > > > > > direction? > > > > > > > > > > > > -- > > > > > > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > > To view this discussion on the web visit [2][2][2]https:// > > > > [2][3]groups.google.com/ > > > > > d/msgid/ > > > > > > pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%[3] > > > > > [3][3][4]40googlegroups.com. > > > > > > > > > > > > References: > > > > > > > > > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > > > > [2] [4][4][4][5] > https://groups.google.com/d/msgid/pandoc-discuss/ > > > > > a93afb43-c939-40c1-868f-1db8eded17d8n%[5][5][6]40googlegroups.com? > > > utm_medium= > > > > email& > > > > > utm_source=footer > > > > > > > > > > > > > > > -- > > > > > 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > To view this discussion on the web visit [6][6][6]https:// > > > [7]groups.google.com/ > > > > d/msgid/ > > > > > pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%[7] > > > > [7][8]40googlegroups.com. > > > > > > > > > > References: > > > > > > > > > > [1] [8][8][9]https://pandoc.org/ > > > > > [2] [9][9][10]https://groups.google.com/d/msgid/ > > > > > [3] [10][10][11]http://40googlegroups.com/ > > > > > [4] [11][11][12]https://groups.google.com/d/msgid/pandoc-discuss/ > > > > a93afb43-c939-40c1-868f-1db8eded17d8n%[12][13]40googlegroups.com? > > utm_medium= > > > email& > > > > utm_source=footer > > > > > [5] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > > > [6] [12][13][14]https://groups.google.com/d/msgid/pandoc-discuss/ > > > > 2aec84ad-a750-48f2-a0c2-ad7572dcca11n%[14][15]40googlegroups.com? > > utm_medium= > > > email& > > > > utm_source=footer > > > > > > > > > > > > -- > > > > 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 [13]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > To view this discussion on the web visit [14][15]https:// > > > [16]groups.google.com/d/msgid/ > > > > pandoc-discuss/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%[16] > > > [17]40googlegroups.com. > > > > > > > > References: > > > > > > > > [1] [17][18]https://pandoc.org/ > > > > [2] [18][19]https://groups.google.com/ > > > > [3] [19][20]http://40googlegroups.com/ > > > > [4] [20][21]https://groups.google.com/d/msgid/pandoc-discuss/ > > > > [5] [21][22]http://40googlegroups.com/?utm_medium=email& > > > > [6] [22][23]https://groups.google.com/d/msgid/ > > > > [7] [23][24]http://40googlegroups.com/ > > > > [8] [24][25]https://pandoc.org/ > > > > [9] [25][26]https://groups.google.com/d/msgid/ > > > > [10] [26][27]http://40googlegroups.com/ > > > > [11] [27][28]https://groups.google.com/d/msgid/pandoc-discuss/ > > > a93afb43-c939-40c1-868f-1db8eded17d8n%[29] > 40googlegroups.com?utm_medium= > > email& > > > utm_source=footer > > > > [12] [28][30]https://groups.google.com/d/msgid/pandoc-discuss/ > > > 2aec84ad-a750-48f2-a0c2-ad7572dcca11n%[31] > 40googlegroups.com?utm_medium= > > email& > > > utm_source=footer > > > > [13] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > > [14] [29][32]https://groups.google.com/d/msgid/pandoc-discuss/ > > > 480d0274-2324-43d7-9f74-1bbfc08fcbd0n%[33] > 40googlegroups.com?utm_medium= > > email& > > > utm_source=footer > > > > > > > > > -- > > > 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To view this discussion on the web visit [31][34]https:// > > groups.google.com/d/msgid/ > > > pandoc-discuss/e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n%[35] > > 40googlegroups.com. > > > > > > References: > > > > > > [1] [36]https://pandoc.org/ > > > [2] [37]http://groups.google.com/ > > > [3] [38]http://40googlegroups.com/ > > > [4] [39]https://groups.google.com/d/msgid/pandoc-discuss/ > > > [5] [40]http://40googlegroups.com/?utm_medium= > > > [6] [41]https://groups.google.com/ > > > [7] [42]http://40googlegroups.com/ > > > [8] [43]https://pandoc.org/ > > > [9] [44]https://groups.google.com/d/msgid/ > > > [10] [45]http://40googlegroups.com/ > > > [11] [46]https://groups.google.com/d/msgid/pandoc-discuss/ > > > [12] [47]http://40googlegroups.com/?utm_medium=email& > > > [13] [48]https://groups.google.com/d/msgid/pandoc-discuss/ > > > [14] [49]http://40googlegroups.com/?utm_medium=email& > > > [15] [50]https://groups.google.com/d/msgid/ > > > [16] [51]http://40googlegroups.com/ > > > [17] [52]https://pandoc.org/ > > > [18] [53]https://groups.google.com/ > > > [19] [54]http://40googlegroups.com/ > > > [20] [55]https://groups.google.com/d/msgid/pandoc-discuss/ > > > [21] [56]http://40googlegroups.com/?utm_medium=email& > > > [22] [57]https://groups.google.com/d/msgid/ > > > [23] [58]http://40googlegroups.com/ > > > [24] [59]https://pandoc.org/ > > > [25] [60]https://groups.google.com/d/msgid/ > > > [26] [61]http://40googlegroups.com/ > > > [27] [62]https://groups.google.com/d/msgid/pandoc-discuss/ > > a93afb43-c939-40c1-868f-1db8eded17d8n% > 40googlegroups.com?utm_medium=email& > > utm_source=footer > > > [28] [63]https://groups.google.com/d/msgid/pandoc-discuss/ > > 2aec84ad-a750-48f2-a0c2-ad7572dcca11n% > 40googlegroups.com?utm_medium=email& > > utm_source=footer > > > [29] [64]https://groups.google.com/d/msgid/pandoc-discuss/ > > 480d0274-2324-43d7-9f74-1bbfc08fcbd0n% > 40googlegroups.com?utm_medium=email& > > utm_source=footer > > > [30] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [31] [65]https://groups.google.com/d/msgid/pandoc-discuss/ > > e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n% > 40googlegroups.com?utm_medium=email& > > utm_source=footer > > > > > > -- > > 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 [66]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [67] > https://groups.google.com/d/msgid/ > > pandoc-discuss/858c5a07-89a0-4daa-803f-e0d9d50ca9c6n%40googlegroups.com. > > > > References: > > > > [1] https://pandoc.org/lua-filters.html#type-link > > [2] http://pandoc.org/ > > [3] http://groups.google.com/ > > [4] http://40googlegroups.com/ > > [5] https://groups.google.com/d/msgid/pandoc-discuss/ > > [6] http://40googlegroups.com/ > > [7] http://groups.google.com/ > > [8] http://40googlegroups.com/ > > [9] https://pandoc.org/ > > [10] https://groups.google.com/d/msgid/ > > [11] http://40googlegroups.com/ > > [12] https://groups.google.com/d/msgid/pandoc-discuss/ > > [13] http://40googlegroups.com/?utm_medium= > > [14] https://groups.google.com/d/msgid/pandoc-discuss/ > > [15] http://40googlegroups.com/?utm_medium= > > [16] http://groups.google.com/d/msgid/ > > [17] http://40googlegroups.com/ > > [18] https://pandoc.org/ > > [19] https://groups.google.com/ > > [20] http://40googlegroups.com/ > > [21] https://groups.google.com/d/msgid/pandoc-discuss/ > > [22] http://40googlegroups.com/?utm_medium=email& > > [23] https://groups.google.com/d/msgid/ > > [24] http://40googlegroups.com/ > > [25] https://pandoc.org/ > > [26] https://groups.google.com/d/msgid/ > > [27] http://40googlegroups.com/ > > [28] https://groups.google.com/d/msgid/pandoc-discuss/ > > [29] http://40googlegroups.com/?utm_medium=email& > > [30] https://groups.google.com/d/msgid/pandoc-discuss/ > > [31] http://40googlegroups.com/?utm_medium=email& > > [32] https://groups.google.com/d/msgid/pandoc-discuss/ > > [33] http://40googlegroups.com/?utm_medium=email& > > [34] https://groups.google.com/d/msgid/ > > [35] http://40googlegroups.com/ > > [36] https://pandoc.org/ > > [37] http://groups.google.com/ > > [38] http://40googlegroups.com/ > > [39] https://groups.google.com/d/msgid/pandoc-discuss/ > > [40] http://40googlegroups.com/?utm_medium= > > [41] https://groups.google.com/ > > [42] http://40googlegroups.com/ > > [43] https://pandoc.org/ > > [44] https://groups.google.com/d/msgid/ > > [45] http://40googlegroups.com/ > > [46] https://groups.google.com/d/msgid/pandoc-discuss/ > > [47] http://40googlegroups.com/?utm_medium=email& > > [48] https://groups.google.com/d/msgid/pandoc-discuss/ > > [49] http://40googlegroups.com/?utm_medium=email& > > [50] https://groups.google.com/d/msgid/ > > [51] http://40googlegroups.com/ > > [52] https://pandoc.org/ > > [53] https://groups.google.com/ > > [54] http://40googlegroups.com/ > > [55] https://groups.google.com/d/msgid/pandoc-discuss/ > > [56] http://40googlegroups.com/?utm_medium=email& > > [57] https://groups.google.com/d/msgid/ > > [58] http://40googlegroups.com/ > > [59] https://pandoc.org/ > > [60] https://groups.google.com/d/msgid/ > > [61] http://40googlegroups.com/ > > [62] > https://groups.google.com/d/msgid/pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com?utm_medium=email&utm_source=footer > > [63] > https://groups.google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com?utm_medium=email&utm_source=footer > > [64] > https://groups.google.com/d/msgid/pandoc-discuss/480d0274-2324-43d7-9f74-1bbfc08fcbd0n%40googlegroups.com?utm_medium=email&utm_source=footer > > [65] > https://groups.google.com/d/msgid/pandoc-discuss/e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n%40googlegroups.com?utm_medium=email&utm_source=footer > > [66] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [67] > https://groups.google.com/d/msgid/pandoc-discuss/858c5a07-89a0-4daa-803f-e0d9d50ca9c6n%40googlegroups.com?utm_medium=email&utm_source=footer > > -- 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/80adcd1d-bc18-4b38-b3a9-0265d0922790n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 61357 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <80adcd1d-bc18-4b38-b3a9-0265d0922790n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: converting links to footnotes... including page number in footnote?? [not found] ` <80adcd1d-bc18-4b38-b3a9-0265d0922790n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2022-11-28 17:04 ` Pablo Rodríguez 0 siblings, 0 replies; 14+ messages in thread From: Pablo Rodríguez @ 2022-11-28 17:04 UTC (permalink / raw) To: pandoc-discuss On 11/28/22 05:01, user account wrote: > That is AWESOME - thank you!!! > > I see that the function `function Span(span)` turns > 1 See on page #??. > in to > 1 See on page #2. > but I can't for the life of me figure out how. > > Would you mind explaining that? [Sending again to the list, since this replies by default to sender.] TeX (LaTeX or ConTeXt) has no information about pages and their contents in its first execution (run). So it displays ??. After the first run, all unresolved references (??) display the right (page, in this case) number. I hope it is clear now. Cheers, Pablo -- 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/004a688c-2fb6-fd80-e9e1-e302564a2480%40web.de. ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-11-28 17:04 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-11-26 0:33 converting links to footnotes... including page number in footnote?? user account [not found] ` <a93afb43-c939-40c1-868f-1db8eded17d8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-11-26 10:28 ` Bastien DUMONT 2022-11-26 13:21 ` user account [not found] ` <2aec84ad-a750-48f2-a0c2-ad7572dcca11n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-11-26 13:52 ` 'Håkon Wium Lie' via pandoc-discuss [not found] ` <25474.6699.105043.345344-4mDQ13Tdud8Jw5R7aSpS0dP8p4LwMBBS@public.gmane.org> 2022-11-26 15:35 ` user account 2022-11-26 17:34 ` Bastien DUMONT 2022-11-26 22:30 ` user account [not found] ` <480d0274-2324-43d7-9f74-1bbfc08fcbd0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-11-27 8:56 ` Bastien DUMONT 2022-11-27 14:13 ` user account [not found] ` <e969f1ca-c6bf-4a5e-b53f-86aa0a444db2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-11-27 15:50 ` Bastien DUMONT 2022-11-27 16:24 ` user account [not found] ` <858c5a07-89a0-4daa-803f-e0d9d50ca9c6n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-11-27 17:01 ` Bastien DUMONT 2022-11-28 4:01 ` user account [not found] ` <80adcd1d-bc18-4b38-b3a9-0265d0922790n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-11-28 17:04 ` Pablo Rodríguez
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).