X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/1428a9d8f91b754fe7f9fb96cbdd0d6a2536ffc1..dc310ddf91e20a927cd1fc1db72e1c8cd803756d:/librarian/formats/pdf/__init__.py diff --git a/librarian/formats/pdf/__init__.py b/librarian/formats/pdf/__init__.py index fd1fd5e..a994008 100644 --- a/librarian/formats/pdf/__init__.py +++ b/librarian/formats/pdf/__init__.py @@ -52,7 +52,7 @@ class PdfFormat(Format): def add_file(self, ctx, filename, url=None, path=None, image=False): from subprocess import call - if not url or path: + if not url and not path: raise BuildError('No URL or path for image') save_as = os.path.join(ctx.workdir, filename) if path is not None: @@ -73,6 +73,8 @@ class PdfFormat(Format): if url.startswith('/'): url = 'http://milpeer.eu' + url + if '.' not in url: + raise BuildError('Linked file without extension: %s' % url) ext = url.rsplit('.', 1)[-1] if image: urlretrieve(url, save_as + '_.' + ext) @@ -347,6 +349,7 @@ PdfFormat.renderers.register(core.Div, 'video', VideoRenderer('par')) PdfFormat.renderers.register(core.Div, 'defined', CmdRenderer('textbf')) PdfFormat.renderers.register(core.Div, 'item', CmdRenderer('item')) +PdfFormat.renderers.register(core.Span, 'item', CmdRenderer('item')) PdfFormat.renderers.register(core.Div, 'list', EnvRenderer('itemize')) PdfFormat.renderers.register(core.Div, 'list.enum', EnvRenderer('enumerate'))