public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: William Lupton
	<wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org>,
	pandoc-discuss
	<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: epub : footnote backlink character not rendered by Kobo fonts
Date: Wed, 22 Sep 2021 09:39:59 -0700	[thread overview]
Message-ID: <m2r1dg36ow.fsf@Johns-Air.hsd1.ca.comcast.net> (raw)
In-Reply-To: <CAEe_xxiSZbwmOYcdd5nKSqySuF8L4tvPbrD+-kXDcONXu3n4hQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>


A custom writer is probably overkill. It would be easier to write
a small script that unzips the epub, does search and replace
on the xhtml files, and then zips it back up again.  This could
be 3 lines of shell script.

That said, this is a long standing issue and we might consider
using a different character or making it configurable:

https://github.com/jgm/pandoc/issues/3149


William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> writes:

> This probably won't be the answer that you wanted, but you could use a
> custom writer, e.g., based on the provided sample.lua. See
> https://pandoc.org/MANUAL.html#custom-writers.
>
> Here's the relevant code (this isn't all the code relating to footnotes,
> but it's the bit that has the special character!):
>
> function Note(s)
>     local num = #notes + 1
>     -- insert the back reference right before the final closing tag.
>     s = string.gsub(
>         s, '(.*)</', '%1 <a href="#fnref' .. num ..  '">&#8617;</a></')
>     -- add a list item with the note to the note table.
>     table.insert(notes, '<li id="fn' .. num .. '">' .. s .. '</li>')
>     -- return the footnote reference, linked to the note.
>     return '<a id="fnref' .. num .. '" href="#fn' .. num ..
>         '"><sup>' .. num .. '</sup></a>'
> end
>
> On Tue, 21 Sept 2021 at 13:23, Vin Cent <irakay17-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>> Ok, after some more reading, I'm still unsure how to proceed ; and I
>> actually don't see how I could to that with a filter.
>> I have dumped pandoc's native output format ; and the character I need to
>> replace is not part of it. I guess it is added at the time of pandoc's
>> writing the output document.
>> I don't know how how I can replace that character. Hopefully there is a
>> pandoc setting I can tune so that I won't need to replace it at some late
>> stage.
>>
>>
>>
>> On Tuesday, September 21, 2021 at 10:42:14 AM UTC+2 Vin Cent wrote:
>>
>>> Sorry for answering myself. I have RTFMed a bit in the while.
>>> I actually hint this can be simply done with a LUA filter.
>>> I will try to implement it as a self-exercice and report the result here.
>>>
>>> On Tuesday, September 21, 2021 at 9:34:26 AM UTC+2 Vin Cent wrote:
>>>
>>>> Hi,
>>>>
>>>> I am generating epub3 from latex source.
>>>> I was wondering why footnotes show a backlink to the original text when
>>>> I display the document in calibre, and why they do not when I display the
>>>> document on a kobo reader...
>>>>
>>>> ... until I found the backlink is indeed well present. It is "just" not
>>>> displayed by kobo because the character set (by pandoc, I think) has no
>>>> rendering on their font.
>>>>
>>>> The backlink character, copied and pasted from the .epub document
>>>> itself, seems to be "↩︎".
>>>>
>>>> I see two possible tricks here so that the link will appear on kobo :
>>>> 1. Change the character to another one that would be rendered by kobo.
>>>> 2. Change the default font of the document to one that has rendering for
>>>> that character.
>>>>
>>>> I have tried all available fonts on my device. There are actually three
>>>> classes of them.
>>>> (Listing them all below, this might be of interest to somebody in the
>>>> future)
>>>>
>>>> Avenir Next ; Georgia ; Kobo Nickel : these fonts render absolutely
>>>> nothing for that character, leading the human to believe the backlink does
>>>> not exist. It is present, clickable, just not rendered.
>>>>
>>>> Amasis ; Caecilia ; Gill Sans ; Malabar ; OpenDislexic : these fonts
>>>> render "__" for that character. I find it "better" than the first family,
>>>> but still not great. It is not obvious for a non-tehnical human that this
>>>> is a backlink to the text.
>>>>
>>>> AR UDJingxihei ; Kobo UD Kakugo ; Kobo Tsukishi Mincho : display
>>>> oriental character (I think this is chinese / japanese depending on font)
>>>> for the backlink character.
>>>>
>>>>
>>>> Therefore, I tend to favor the first solution. Do you guys know of a way
>>>> to customize the "backlink ↩︎" character set by pandoc in epub ?
>>>> Or is there a third approach ?
>>>>
>>>> Thanks,
>>>>
>>>> Vincent
>>>>
>>> --
>> 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/68257f93-0fd1-46a1-9e99-46d6045dc4b9n%40googlegroups.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/68257f93-0fd1-46a1-9e99-46d6045dc4b9n%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/CAEe_xxiSZbwmOYcdd5nKSqySuF8L4tvPbrD%2B-kXDcONXu3n4hQ%40mail.gmail.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/m2r1dg36ow.fsf%40Johns-Air.hsd1.ca.comcast.net.


  parent reply	other threads:[~2021-09-22 16:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21  7:34 Vin Cent
     [not found] ` <349480b0-92cd-450f-abc0-f3d65140d23cn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-09-21  8:42   ` Vin Cent
     [not found]     ` <23e0bec1-2642-49d7-b6d5-d440caf74fdcn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-09-21 12:23       ` Vin Cent
     [not found]         ` <68257f93-0fd1-46a1-9e99-46d6045dc4b9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-09-21 14:09           ` William Lupton
     [not found]             ` <CAEe_xxiSZbwmOYcdd5nKSqySuF8L4tvPbrD+-kXDcONXu3n4hQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-09-22 16:39               ` John MacFarlane [this message]
     [not found]                 ` <m2r1dg36ow.fsf-d8241O7hbXoP5tpWdHSM3tPlBySK3R6THiGdP5j34PU@public.gmane.org>
2021-09-22 20:08                   ` Vin Cent
     [not found]                     ` <e216efa7-009b-469a-add1-ae8c93d0ffc3n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-09-27  1:36                       ` John MacFarlane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2r1dg36ow.fsf@Johns-Air.hsd1.ca.comcast.net \
    --to=jgm-tvlzxgkolnx2fbvcvol8/a@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).