X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/5135e076096ce04b1dbbb2f6210512d1a44fa237..8722e4d3cfe77bd6945b8617b484fb9db6c4c9ca:/librarian/formats/html/__init__.py?ds=inline diff --git a/librarian/formats/html/__init__.py b/librarian/formats/html/__init__.py index 01dcbde..271fac9 100644 --- a/librarian/formats/html/__init__.py +++ b/librarian/formats/html/__init__.py @@ -9,7 +9,7 @@ from librarian.formats import Format from librarian.output import OutputFile from librarian.renderers import Register, TreeRenderer from librarian.utils import Context, get_resource -from librarian import core +from librarian import core, get_provider class HtmlFormat(Format): @@ -191,11 +191,12 @@ HtmlFormat.renderers.register(core.Div, 'img', DivImage('img')) class DivVideo(NaturalText): def render(self, element, ctx): output = super(DivVideo, self).render(element, ctx) + provider = get_provider(element.attrib.get('provider')) video_id = element.attrib.get('videoid', '') attribs = { 'width': '854', 'height': '480', - 'src': '//www.youtube.com/embed/%s?controls=2&rel=0&showinfo=0&theme=light' % video_id, + 'src': provider['embed'] % video_id, 'frameborder': '0', 'allowfullscreen': '', } @@ -206,6 +207,7 @@ class DivVideo(NaturalText): HtmlFormat.renderers.register(core.Div, 'video', DivVideo('iframe')) HtmlFormat.renderers.register(core.Div, 'item', NaturalText('li')) +HtmlFormat.renderers.register(core.Span, 'item', NaturalText('li')) HtmlFormat.renderers.register(core.Div, 'list', NaturalText('ul')) HtmlFormat.renderers.register(core.Div, 'list.enum', NaturalText('ol'))