diff options
| author | 2022-08-05 01:00:19 -0400 | |
|---|---|---|
| committer | 2022-08-05 01:00:19 -0400 | |
| commit | 393aa58f2c5afd51f92fd9bd4b6dfd0dc90cea41 (patch) | |
| tree | a61de275324558358abc0c85f85827649a159512 /nikola/plugins/compile/rest/youtube.py | |
| parent | 942e313727d1ad886a1024c24fe4a9e8e2e0bb3e (diff) | |
New upstream version 8.2.3.upstream/8.2.3
Diffstat (limited to 'nikola/plugins/compile/rest/youtube.py')
| -rw-r--r-- | nikola/plugins/compile/rest/youtube.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/nikola/plugins/compile/rest/youtube.py b/nikola/plugins/compile/rest/youtube.py index 24220e5..de3f2fa 100644 --- a/nikola/plugins/compile/rest/youtube.py +++ b/nikola/plugins/compile/rest/youtube.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright © 2012-2021 Roberto Alsina and others. +# Copyright © 2012-2022 Roberto Alsina and others. # Permission is hereby granted, free of charge, to any # person obtaining a copy of this software and associated @@ -48,7 +48,7 @@ class Plugin(RestExtension): CODE = """\ <div class="youtube-video{align}"> <iframe width="{width}" height="{height}" -src="https://www.youtube-nocookie.com/embed/{yid}?rel=0&wmode=transparent" +src="https://www.youtube-nocookie.com/embed/{yid}?rel=0&wmode=transparent{start_at}" frameborder="0" allow="encrypted-media" allowfullscreen ></iframe> </div>""" @@ -69,7 +69,8 @@ class Youtube(Directive): option_spec = { "width": directives.unchanged, "height": directives.unchanged, - "align": _align_choice + "align": _align_choice, + "start_at": directives.unchanged } def run(self): @@ -85,6 +86,14 @@ class Youtube(Directive): options['align'] = ' align-' + self.options['align'] else: options['align'] = '' + + start_at = options.get('start_at') + + if start_at: + options['start_at'] = '&start=' + start_at + else: + options['start_at'] = '' + return [nodes.raw('', CODE.format(**options), format='html')] def check_content(self): |
