Thanks. Shell script written ; works like a charm. If that counts, I vote for the #3149 change/configure character approach :) If that can ease anybody's life, here is my shell script (more than 3 lines, but should be safe and leave no trace in case of failure) : #!/bin/sh FN="ebook.epub" ZIPNAME="ebook.zip" CWD=`pwd` if [ ! -f $FN ]; then exit 1 fi if [ ! -d $MYDIR ]; then exit 2 fi MYDIR=`mktemp -d` cleanup() { cd $CWD rm -rf $MYDIR exit $1 } mv $FN ${MYDIR}/${ZIPNAME} || cleanup 3 cd $MYDIR || cleanup 4 unzip $ZIPNAME || cleanup 5 rm -f $ZIPNAME || cleanup 6 cd EPUB/text || cleanup 7 sed -i -e 's/>↩︎<\/a>/>‡<\/a>/g' *html || cleanup 8 rm -f $ZIPNAME || cleanup 9 cd ../.. || cleanup 10 zip -8 -r ${CWD}/${ZIPNAME} * || cleanup 11 cd $CWD || cleanup 12 mv $ZIPNAME $FN || cleanup 13 rm -rf $MYDIR On Wednesday, September 22, 2021 at 6:40:14 PM UTC+2 John MacFarlane wrote: > > 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 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, '(.*) > -- add a list item with the note to the note table. > > table.insert(notes, '
  • ' .. s .. '
  • ') > > -- return the footnote reference, linked to the note. > > return '' .. num .. '' > > end > > > > On Tue, 21 Sept 2021 at 13:23, Vin Cent 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-discus...-/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-discus...-/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/e216efa7-009b-469a-add1-ae8c93d0ffc3n%40googlegroups.com.