1.2.14. template_extras
¶
This module provides functionality for Jinja functions used to generate server page content.
1.2.14.2. Functions¶
-
embed_youtube_video
(video_id, autoplay=True, enable_js=False, start=0, end=None)[source]¶ A Jinja function to embed a video into a web page using YouTube’s iframe API. In order to enable a training button after the video has ended the youtube.js file needs to be included and enable_js just be set to True. If start or end are specified as strings, the must be in a format suitable to be parsed by
parse_timespan()
.Parameters: - video_id (str) – The id of the YouTube video to embed.
- autoplay (bool) – Start playing the video as soon as the page loads.
- enable_js (bool) – Enable the Javascript API.
- start (int, str) – The time offset at which the video should begin playing.
- end (int, str) – The time offset at which the video should stop playing.
-
export_function
(function)[source]¶ A decorator to “export” a function by placing it in
functions
.Parameters: function (function) – The function to export.