asciidoctor-vscode icon indicating copy to clipboard operation
asciidoctor-vscode copied to clipboard

PDF generation fails when an adoc contains a video reference

Open andgeno opened this issue 4 years ago • 2 comments

When an adoc file contains a video reference like this:

video::rPQoq7ThGAU[youtube]

the PDF export will fail with the following error:

image

The error message looks misleading. It definitely is the video:: tag that makes this process fail.

andgeno avatar Apr 04 '20 01:04 andgeno

Is it possible to simply exclude videos from PDFs? I tried to use ifeval but couldn't find a way to distinguish PDF from HTML, for example.

This will evaluate true for HTML and PDF exports:

ifeval::["{backend}" == "html5"]
video::rPQoq7ThGAU[youtube]
endif::[]

andgeno avatar Apr 04 '20 01:04 andgeno

@andgeno thanks for reporting.

This is possible depending on what you are using. wkhtmltopdf which is bundled with this extension has a range of problems (and may need to be removed or replaced with asciidoctor-pdf.js, see #239 / #252). However we could set backend-pdf for this (although I'm reluctant to put effort into maintaining wkhtmltopdf given the problems).

If you are using asciidoctor-pdf, you could do something like what is shown in the user manual:

ifndef::backend-pdf[]
<script>
//...
</script>
endif::[]

or

ifdef::backend-html5[]
<script>
//...
</script>
endif::[]

danyill avatar May 10 '20 04:05 danyill