From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31803 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: Sun, 27 Nov 2022 08:56:56 +0000 Message-ID: References: <2aec84ad-a750-48f2-a0c2-ad7572dcca11n@googlegroups.com> <480d0274-2324-43d7-9f74-1bbfc08fcbd0n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38697"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDCINCES2QJRBW6MRSOAMGQEYPVXARA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Nov 27 09:57:03 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wm1-f60.google.com ([209.85.128.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ozDTD-0009tt-6m for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 27 Nov 2022 09:57:03 +0100 Original-Received: by mail-wm1-f60.google.com with SMTP id j2-20020a05600c1c0200b003cf7397fc9bsf4726972wms.5 for ; Sun, 27 Nov 2022 00:57:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669539422; cv=pass; d=google.com; s=arc-20160816; b=RjrhWYPgOGsZQLUv7Ww3NMlCJhlqrt2WAmTbYNVFMEl4kc6q0TB+CBbbFlXtOzTn2P YXzHCS9/nLxacV6fS2ohC1um88Qi1GNM9gNxNjtZvtUURKTpDIoP8Dfr6yZInLMqXiIF yAZE2OFRsDWedTg1XR9+guQfSptvYqDwrfKkLAikglSuzc1a3sxLpf1tfmJtt7hVLg7U ihs2fB35wk99pGSUBUE9HFs080Q5zWxhA0BB8xvPcGcjj0Er0DFhrYIY8ug7TcLqF7d+ eMuI6pno0aQNGptKa44nJGwZ0Lko90sxiuPVgrdCe/Q4jISr6EsIUc5BXhIEJ7LcVZ70 Ascg== 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=6ifRNeqD5leC07OlbxHAS11kbrgZKdJMlJMkJgxjto0=; b=qgAC1LriuFRDePeMoKGJu9WLG335/rVxoK+BoiNk0nKGEh9Pd38Znus7jCGSXj9u+J PwwcXv/jn1cDmdp8LbkdImKGIvs6iwPsm704Ws0eAzmqpgoHQyN0tVu4AD9Zk2/ho59U zYqudfE8nVM7PuL9cYNIKU1iCYcMQRkdct9p4wFHrgutzOfxAa8li1Ic7zUxze3JdpLA GEvSe5Effa4So5Xm3qcHjLMpMdwIUYB8kuXQ6H3TO13qalBMxj9RRH9lSAzQDYqwEBpj S0ibaByNkhHqD1gf7WiAhrDMV7fm5bArudaZKuf2ILq4pzgLQQ52wesYMB4oY28HPlDp I7Lw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=gqUvifwV; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 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=6ifRNeqD5leC07OlbxHAS11kbrgZKdJMlJMkJgxjto0=; b=gfZS9N7LgmaYfRtFzvzHpMIcmpVL/oPPFmarxjbjqL3fOgF/0krwNmcrCOFKSnLVRC v0iaKTEfzxZmfAO0Cfb4CKRCVO0UQaorIv/eNfPyrFgZnPxK5o8b8wkt4kQbCd1kDadD 8KV7ejiuJoUaK3ctzvvT4fE5DxJxcFBgJCFCXhc7Lt/ojJTNbFr3KnTDsWp7YzZSaa8a 9TSNebJtk3ppKNXLIAuk3flqU9WNm+4lLV8YeT9+3LSMBVw0QEyAck5cSZcvYDY5f3PH KUtNOlo9YiF2FfK7/dFV/ieeRt1VNb10Ap4ZxjciPkJ8H 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=6ifRNeqD5leC07OlbxHAS11kbrgZKdJMlJMkJgxjto0=; b=teyhq4s4ruB+gvMjIx/jWaInBki8VHDtBSF+H+7bl9J/BpQSB0wYdrB/FPlYNxA64h OQVQ10C4+ih4aYh1dW9/WDUXX/tpNVZUkO943GYX1VQcGF8X6rsV/njyZ0DTWVUONs4o oUtFd82WJxKWJoHRFjPX1TcyGZdg4kxJ0zaHPR69syuMll/OpXbAuWiXzUQTnfRNtWZ4 P23INiVZbjig2+rKqEoWqlFKqhIPW//RYHD7B+enofmb3kmfUmuSuN9ByvWwGDd52iCP Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ANoB5pkOa4RAYs0lKuknuxP+oFipk3tgDn8ieErOIIQpjxTUvSqhCK2H kBfs6nKtwPkFSrqli3os4Dc= X-Google-Smtp-Source: AA0mqf53RF02N8+G742mpQEmt3QYvV5AvX4P2Os7NYHry1t3zuYkl8aas5jULuqiBfsoQ06FgoGrSg== X-Received: by 2002:adf:e78d:0:b0:241:d3e4:6544 with SMTP id n13-20020adfe78d000000b00241d3e46544mr3071394wrm.533.1669539422744; Sun, 27 Nov 2022 00:57:02 -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-20020a7bce11000000b003c6efd69cd8ls4807671wmc.0.-pod-control-gmail; Sun, 27 Nov 2022 00:56:58 -0800 (PST) X-Received: by 2002:a05:600c:a382:b0:3c6:bece:49b5 with SMTP id hn2-20020a05600ca38200b003c6bece49b5mr28313538wmb.160.1669539418667; Sun, 27 Nov 2022 00:56:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669539418; cv=none; d=google.com; s=arc-20160816; b=JEFAeXQnw16JX0Bz0j21A7U726w77E7pmZIge31j5wyxZ7s7wZ4tJ022XeNxdxpqGu zCSyToJpn3X14yqC43MjUo5MPcAPeI4rJ3jeb5rQ+zd+xFmMXXdCK1/fRvwYTXwapq6W Kaq8hLXi1fuKC3gDNHgTZyn1yTrtvtWCQq5T4yvsF3h0jzZzFyXk8EIirfbqJgGlrTIl LJuQofvtdCxvHKtMjce617/+AweyxXIVIH3vMIZp8yYNU2DXyUtj+5CHQJ2MESpRYOAo 7Ud2ifXO8r9uVE3e/CxPTBipY1GXsqDOyO/nCvHZpCEjn/uzSa1WXL3OQV45DOoB764x wzDg== 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=VJ0nrOFOVemr4esTeT/hCuQ2vnJ8iIFw4olPt+A0Y6w=; b=QcDeI3SU6WuWicPUm4d7LV08DW56geDo9UqY9yUhfXCDmLAgYHcEduXts3fhy8t5xl YM3XtwbfmcH4dLgRO0tf3TfZQEoeSWsPjnqeUU0wy+L+M07mHHVAOH5x0i0VFDXUM4RN RTJTZXXgGRU+VWbRWdCTeuid9VlEHXXjwJZbjU+hUH1eONipT/e1/+/O+PhAuI4/SpYu bYF27p6ZLAAT1FSiVbSjjEr+6PxLI5R7/fyQs3bFoJotoWGAlZtN8NNB2Vs3hey65M+i 2UpYLBKK4F1NSKSjce6S1E2SKVQk7ngm87+tdP0YihaJeV0WGmWBjtv8sJPNf5jfKOBS 5FTQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=gqUvifwV; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 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 mout01.posteo.de (mout01.posteo.de. [185.67.36.65]) by gmr-mx.google.com with ESMTPS id bu23-20020a056000079700b002367b2e748esi371276wrb.5.2022.11.27.00.56.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Nov 2022 00:56:58 -0800 (PST) Received-SPF: pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) client-ip=185.67.36.65; Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 4023B24002A for ; Sun, 27 Nov 2022 09:56:58 +0100 (CET) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NKjCF5lQHz6tmK for ; Sun, 27 Nov 2022 09:56:57 +0100 (CET) Content-Disposition: inline In-Reply-To: <480d0274-2324-43d7-9f74-1bbfc08fcbd0n-/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=gqUvifwV; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 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:31803 Archived-At: Place the file under `~/.local/share/pandoc/filters`. You don't need the ex= ecutable flag. Le Saturday 26 November 2022 =C3=A0 02:30:58PM, user account a =C3=A9crit : > Thanks I wish that worked. I don't know what I'm doing wrong, here's what= I've > got=E2=80=A6 >=20 > `pandoc --version` says user data dir is `~/.local/share/pandoc` so I pla= ced > this file there as `~/.local/share/pandoc/links-with-page-number.lua` and= did > (just in case) `chmod +x` on it. >=20 > `pandoc -o test.pdf test.html` produces a 2page pdf as expected with no > footnotes. >=20 > `pandoc -L links-with-page-number.lua -o test.pdf test.html` fails to pro= duce > 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) > ``` >=20 > 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 t= hat > same error. >=20 > Any ideas? >=20 > On Saturday, November 26, 2022 at 12:34:15 PM UTC-5 Bastien Dumont wrote: >=20 > Please find attached a basic implementation. As in the attached sampl= e HMTL > file, I suppose that the targets are marked with ids on spans and tha= t you > link to it via empty elements. If you have a LaTeX installation, = simply > do `pandoc -L links-with-page-number.lua -o test.pdf test.html` to se= e the > result. >=20 > Le Saturday 26 November 2022 =C3=A0 05:21:25AM, user account a =C3=A9= crit : > > Thanks! Yeah injecting html in the intermediary document doesn't so= und > very > > promising either (again, because the pages have to be built first b= efore > > 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 differ= ent > pdf > > engine or would a different mechanism be used? > > > > On Saturday, November 26, 2022 at 5:28:31 AM UTC-5 Bastien Dumont w= rote: > > > > The problem is that Pandoc does not produce the PDF document: it pr= oduces > > the intermediary HTML document that is processed by weasyprint to p= roduce > > 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 =C3=A0 04:33:05PM, user account a =C3=A9= crit : > > > Using pandoc with weasyprint pdf engine to turn the markdown file= s from > a > > blog > > > (static site generator does the html conversion) into a pdf for p= rint. > > > > > > Would it be possible, perhaps with a custom lua filter or some ot= her > > mechanism, > > > to add the page number of the linked-to page? The page numbers wo= n't be > > known > > > until pandoc has already created the document, and I don't know w= here > 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://pand= oc.org > / > > > lua-filters.html#module-pandoc.utils ...am I looking in the wrong > place? > > Can > > > anyone tell me anything about this? > > > > > > It's an intimidating rabbit hole for me, particularly because I s= ee no > > mention > > > of "page number" there in the docs, which makes it seem kinda hop= eless > > > actually. But maybe one of you know the way and could point me in= that > > > direction? > > > > > > -- > > > You received this message because you are subscribed to the Googl= e > Groups > > > "pandoc-discuss" group. > > > To unsubscribe from this group and stop receiving emails from it,= send > an > > email > > > to [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To view this discussion on the web visit [2][2][2]https:// > 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_med= ium=3D > email& > > utm_source=3Dfooter > > > > > > -- > > You received this message because you are subscribed to the Google = Groups > > "pandoc-discuss" group. > > To unsubscribe from this group and stop receiving emails from it, s= end an > email > > to [5]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [6][6]https://groups.googl= e.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= =3Demail& > utm_source=3Dfooter > > [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= =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 [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. >=20 > References: >=20 > [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=3Demail& > [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=3Demail&utm_source=3Dfoote= r > [12] https://groups.google.com/d/msgid/pandoc-discuss/2aec84ad-a750-48f2-= a0c2-ad7572dcca11n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfoote= r > [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=3Demail&utm_source=3Dfoote= r --=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/Y4MmWNAvmcqr%2Bgg%2B%40localhost.