Skip to content

Commit

Permalink
Merge pull request #74 from mitchburnett/main
Browse files Browse the repository at this point in the history
Extend sphinxcontrib.video to skip video node in latex generation
  • Loading branch information
mitchburnett committed Oct 6, 2022
2 parents 644f5da + 81a21a1 commit 26fce95
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/conf.py
Expand Up @@ -128,6 +128,26 @@

# -- Options for LaTeX output ------------------------------------------------

# Embedding videos into a PDF is not supported. Extend the Sphinx.writer.latex
# to just skip the node. This will result in nothing being placed in the
# resulting LaTeX and output PDF
from docutils import nodes
from sphinxcontrib.video import video
from sphinx.writers import latex

def visit_video(self, node):
self.builder.warn('using "video" inside a PDF is not supported. This node '
'will be skipped resulting in no output to the LaTeX or PDF document. '
'Consider extending the video node to instead place a still image a '
'frame for the video.')
raise nodes.SkipNode

def depart_video(self, node):
pass

def setup(app):
app.add_node(video, latex=(visit_video, depart_video), override=True)

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
Expand Down

0 comments on commit 26fce95

Please sign in to comment.