From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31800 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bastien DUMONT Newsgroups: gmane.text.pandoc Subject: Re: converting links to footnotes... including page number in footnote?? Date: Sat, 26 Nov 2022 17:34:09 +0000 Message-ID: References: <2aec84ad-a750-48f2-a0c2-ad7572dcca11n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="WLcmnls+rqa3F+0C" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32086"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDCINCES2QJRBE44RGOAMGQEY3BV54Q-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Nov 26 18:34:15 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wm1-f55.google.com ([209.85.128.55]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oyz4B-00087V-He for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 26 Nov 2022 18:34:15 +0100 Original-Received: by mail-wm1-f55.google.com with SMTP id h4-20020a1c2104000000b003d01b66fe65sf5975735wmh.2 for ; Sat, 26 Nov 2022 09:34:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669484055; cv=pass; d=google.com; s=arc-20160816; b=0GzIJfTmqdZDlAH0XbZ5stX5yAO6sqlSZwv/48hKNLfTBSH1W5Qa7ftbbAmgfba8Pq qzycQei51crBFCt6Z+ZNkUZVPv82eWFu+9rMFeSFZb9aJCz12dkF5f/nvc4WV7njMnqK yA2w0SjzMY7BqZX7SDylKPPNBs6GAVXXQMqDapygDExxlxkh1umlYzyb2lwlgsP2onOW D32no+qoZZTuAT2jYY+mN9jUakjdD/qjcRUIzIAtXOH74QTEtAPLODmR7UW5kwyxgM0W 4FEKQkrFvQwuB9fB7JdIIxpU2dS5zH/t4mLMYzCpwyLKfrB0H/Kv1BGT726qEjGn3TJX Lyrw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:dkim-signature; bh=8sTVLzEKktbDOkGrdeRftAY+/qJk2IUJsAzHBAaBS+o=; b=oJH5D0pbWfZF+ogacUD7wlncogwxj/nFBZU2te8pcjqNb1t3oVR853JFMst48V/6Hd 3L3xE/+3ZoLcaozjlKu8I0xnWvYLtZvNJdoV9SnjWKPvtzy86X++8VyDbwWAYCRMJmOu HHJFm/Pb2L8btrBsmrTphvR8qgjbC3e3ONfBsOuNPfCjLrWABjPVYZJRmJrYXUIDfLII OI+IWkqXx2nkXcRGhwxSyk3oXJME+BtUjQXmjYWMY3PC/vf1lT7eQ8kcW6ZRX+icss0C qO9OYQzNp3VbxO/favJVsM47n9sb+gkjnKLo4hnnKTQHPNc0q58n6uP8UYDYZqZXDJOx b72g== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=qubatbZt; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:from:to:cc :subject:date:message-id:reply-to; bh=8sTVLzEKktbDOkGrdeRftAY+/qJk2IUJsAzHBAaBS+o=; b=mvif9fn70x1U9fEUy+jKGHkuezrBRUp0jZoI7OVMZ+JsIG+L6er7vW/YWrwcyyiGI9 Us47H78toXIF5zlIfsANSbXY9ch1IQITpbq39q3U57b8rbyr+qb3+nRKupzku+uoiffG WUrTqpNBp8CeC5nABsAq/VdxuvMwF4HFk3XUx9E195QwFbt7OQGY0xQ2oWzwyDgUHrQP 11ZYmlgJdliisHStooIxlw0keBhDPQPh2pML9+/jqcftQjvZD4ohNB526zk79wiQY8nB RmZDJGIDK9TX3DWVuCuwALyA+ctbHkk1qHg1YGYL+YZAv X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=8sTVLzEKktbDOkGrdeRftAY+/qJk2IUJsAzHBAaBS+o=; b=8RQbkKP3uMXZ/5xBHSTD9v96MNY0DYt6/1G74n9ft7eYE85h2BLnuEEdV8FCb24KT1 R7D6+jXLmdrao63t/2/gT/WomjDggL8J22w0Jtfwl+jH0/vDbtcSlz+dxwC5YhGceIne wSlvTpSQPFGmtMWNqrnwTK66c0Cc3VfoTsHO6FnrXdj3ZQGRrowSwIvDvbOyJb1Ej+Xe jHwYfQanXHnAovUFuuI4Va2hRGrTNDdXBNBShkMwPoCMv1Yu30IQPWhFW8CgJ8SYNm60 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ANoB5pk0mx5Hs/TmyPVGyE3Q/umxW3JmPY4DPhH1KF5Nk+iWXBgpzad1 +yBCYILhbturLzKn6vIf5A8= X-Google-Smtp-Source: AA0mqf4hVZ2u/+kybfiB4kWLUFfQib6ymm1d8haTRa0WRKO47e7Mm/Jp7ZJQuKXgYO6MT3erDKb1xQ== X-Received: by 2002:adf:f944:0:b0:236:8f54:f1f4 with SMTP id q4-20020adff944000000b002368f54f1f4mr27252254wrr.654.1669484055153; Sat, 26 Nov 2022 09:34:15 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a7b:ce11:0:b0:3c6:efd6:9cd8 with SMTP id m17-20020a7bce11000000b003c6efd69cd8ls4223086wmc.0.-pod-control-gmail; Sat, 26 Nov 2022 09:34:11 -0800 (PST) X-Received: by 2002:a05:600c:3795:b0:3cf:cfcd:1e0 with SMTP id o21-20020a05600c379500b003cfcfcd01e0mr24989206wmr.166.1669484050882; Sat, 26 Nov 2022 09:34:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669484050; cv=none; d=google.com; s=arc-20160816; b=olf2WfJP3D88G/MviSeYUZkySus5AYoG2TDzbjSE7LKIeHKnGwn2r5E/wlNZLJR7Zi Xca04PqSEc0T0KRm0qJarRkoJ5am/edga2xi001lddxUtbFEN9Qbbjg7xnQBlPfMbCZj oCnIhViN9SHxKZNmbe/VbSRbN51A+pNxZS+wpSyiXRQjt0qA9fGM8FO5/MdsgOfsHPIL fDaf77Wnz2uan4KWFCTxwBX8tH4Qq6AUwOKUf6/37B8ux/CA1ayI70CunFlOjK/C+AYL 0A5icl9vE1wpTRXLU7YNpk82z/uoT4jI80bJ92Wihf93AiM1bDzJFvQ0a098thOPPzG+ NF4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:to:from:date :dkim-signature; bh=usf8//hd3v5/4YOUjh9bFaY2w6qZ+VttcQhIZgW3ZEc=; b=a0sJybtCc2va/DWHaZeKuUQw8ZfT6XQr/TMFGKbcDXzvJTLatPXvnDRLPd7bldd++0 FrJyjd6VfrZsylsI5X3xM6dZzOQgREQrdNteDDXg9pb6/c7NG5MdM7ZJ4tY5hdKMBPa8 3zI6TsJe4+7fqV9GOF7z6LHqjHBpoGsnRVEV17Yjm3i2gSyEVwZUhOmV8KdlohnIk+c+ eEb4UczayaLWI6NaFz6FTFwslv64HGrJgdmBUpneAsl5UBfa88xpAWg+PSUf2OT8E3hk jB1Nqf2o/HMszFuSf0Oc5Lee6mnmqnlnBL4b5MaF3kqrx8ZJhipqKuUhUhMfAqGyWjRK aiZA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=qubatbZt; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Original-Received: from mout02.posteo.de (mout02.posteo.de. [185.67.36.66]) by gmr-mx.google.com with ESMTPS id bj2-20020a0560001e0200b0023677081f0esi357845wrb.7.2022.11.26.09.34.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Nov 2022 09:34:10 -0800 (PST) Received-SPF: pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) client-ip=185.67.36.66; Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 89195240101 for ; Sat, 26 Nov 2022 18:34:10 +0100 (CET) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NKJkT73XXz6tmm for ; Sat, 26 Nov 2022 18:34:09 +0100 (CET) Content-Disposition: inline In-Reply-To: <2aec84ad-a750-48f2-a0c2-ad7572dcca11n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=qubatbZt; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:31800 Archived-At: --WLcmnls+rqa3F+0C Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 elements. If you have a LaTeX installation, simpl= y do `pandoc -L links-with-page-number.lua -o test.pdf test.html` to see th= e result. Le Saturday 26 November 2022 =C3=A0 05:21:25AM, user account a =C3=A9crit : > Thanks! Yeah injecting html in the intermediary document doesn't sound ve= ry > 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 w= ould > one go about this? Would a lua filter be more capable with a different pd= f > engine or would a different mechanism be used? >=20 > On Saturday, November 26, 2022 at 5:28:31 AM UTC-5 Bastien Dumont wrote: >=20 > The problem is that Pandoc does not produce the PDF document: it prod= uces > the intermediary HTML document that is processed by weasyprint to pro= duce > the PDF. So you cannot get page numbers in a Lua filter. >=20 > However, you can inject raw HTML code in the intermediary file (or in= your > CSS) that will make weasyprint print the page numbers. The question i= s > whether such HTML code exists. It certainly would be possible to do t= his if > you converted to PDF via LaTeX, ConTeXt or groff, but I don't know if= it is > possible via weasyprint. >=20 > Le Friday 25 November 2022 =C3=A0 04:33:05PM, user account a =C3=A9cr= it : > > 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 pri= nt. > > > > Would it be possible, perhaps with a custom lua filter or some othe= r > 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 whe= re in > 'the > > pipeline' the lua filter intervenes compared to when the pages exis= t...? > And > > If the pages exist with their numbers earlier enough, is there an o= bject > or > > something from which lua can get the page number? > > > > I haven't found anything about page numbers in [1]https://pandoc.or= g/ > > lua-filters.html#module-pandoc.utils ...am I looking in the wrong p= lace? > 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 hopel= ess > > actually. But maybe one of you know the way and could point me in t= hat > > 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, s= end an > email > > to [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [2][2]https://groups.googl= e.com/ > d/msgid/ > > pandoc-discuss/a93afb43-c939-40c1-868f-1db8eded17d8n%[3] > 40googlegroups.com. > > > > References: > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [2] [4]https://groups.google.com/d/msgid/pandoc-discuss/ > a93afb43-c939-40c1-868f-1db8eded17d8n%40googlegroups.com?utm_medium= =3Demail& > utm_source=3Dfooter >=20 >=20 > -- > You received this message because you are subscribed to the Google 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/m= sgid/ > pandoc-discuss/2aec84ad-a750-48f2-a0c2-ad7572dcca11n%40googlegroups.com. >=20 > References: >=20 > [1] https://pandoc.org/ > [2] https://groups.google.com/d/msgid/ > [3] http://40googlegroups.com/ > [4] https://groups.google.com/d/msgid/pandoc-discuss/a93afb43-c939-40c1-8= 68f-1db8eded17d8n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter > [5] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [6] https://groups.google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-a= 0c2-ad7572dcca11n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter --=20 You received this message because you are subscribed to the Google Groups "= pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/Y4JOEZ759MXeTFiS%40localhost. --WLcmnls+rqa3F+0C Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="links-with-page-number.lua" 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 --WLcmnls+rqa3F+0C Content-Type: text/html; charset=utf-8 Content-Disposition: attachment; filename="test.html" test

Here is a link to .

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Some text.

Here is the target.

--WLcmnls+rqa3F+0C--