Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit d966e86

Browse files
committed
Convert videos to pretext
1 parent 100acfd commit d966e86

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

runestone/video/video.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def setup(app):
3030
app.add_directive("video", Video)
3131
app.add_directive("youtube", Youtube)
3232
app.add_directive("vimeo", Vimeo)
33-
app.add_node(VideoNode, html=(visit_video_html, depart_video_html))
33+
app.add_node(VideoNode, html=(visit_video_html, depart_video_html),
34+
xml=(visit_video_xml, depart_video_xml))
3435

3536

3637
CODE = """\
@@ -84,6 +85,11 @@ def setup(app):
8485
SOURCE = """<source src="%s" type="video/%s"></source>"""
8586

8687

88+
XML_OUTPUT = """
89+
<video xml:id="{divid}" youtube="{video_id}" width="{width}" />
90+
"""
91+
92+
8793
class VideoNode(nodes.General, nodes.Element, RunestoneIdNode):
8894
pass
8995

@@ -96,6 +102,15 @@ def visit_video_html(self, node):
96102
)
97103

98104

105+
def visit_video_xml(self, node):
106+
xml = XML_OUTPUT.format(**node["runestone_options"])
107+
self.output.append(xml)
108+
109+
110+
def depart_video_xml(self, node):
111+
pass
112+
113+
99114
def depart_video_html(self, node):
100115
pass
101116

0 commit comments

Comments
 (0)