Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I merge or even disable footnote links in asciidoc fop

I've got a rather large asciidoc document that I translate dynamically to PDF for our developer guide. Since the doc often refers to Java classes that are documented in our developer guide we converted them into links directly in the docs e.g.:

In this block we create a new 
https://www.codenameone.com/javadoc/com/codename1/ui/Form.html[Form] 
named `hi`. 

This works rather well for the most part and looks great in HTML as every reference to a class leads directly to its JavaDoc making the reference/guide process much simpler.

However when we generate a PDF we end up with something like this on some pages:

Footnote hell

Normally I wouldn't mind a lot of footnotes or even repeats from a previous page. However, in this case the link to Container appears 3 times.

I could remove some of the links but I'd rather not since they make a lot of sense on the web version. Since I also have no idea where the page break will land I'd rather not do it myself.

This looks to me like a bug somewhere, if the link is the same the footnote for the link should only be generated once.

I'm fine with removing all link footnotes in the document if that is the price to pay although I'd rather be able to do this on a case by case basis so some links would remain printable

like image 966
Shai Almog Avatar asked Oct 19 '22 17:10

Shai Almog


2 Answers

Adding these two parameters in fo-pdf.xsl remove footnotes:

<xsl:param name="ulink.footnotes" select="0"></xsl:param>
<xsl:param name="ulink.show" select="0"></xsl:param>

The first parameter disable footnotes, which triggers urls to re-appear inline.
The second parameter removes urls from the text. Links remain active and clickable.

Non-zero values toggle these parameters.

Source:
http://docbook.sourceforge.net/release/xsl/1.78.1/doc/fo/ulink.show.html

like image 123
seinecle Avatar answered Oct 21 '22 23:10

seinecle


We were looking for something similar in a slightly different situation and didn't find a solution. We ended up writing a processor that just stripped away some of the links e.g. every link to the same URL within a section that started with '==='.

Not an ideal situation but as far as I know its the only way.

like image 23
David Cohen Avatar answered Oct 21 '22 23:10

David Cohen