From d8393802a7cb8d84a3b3c989ea30b4ba21d9a8da Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Tue, 27 Dec 2016 17:01:04 +0100 Subject: [PATCH] report images without extensions, allow span.item --- librarian/formats/epub/__init__.py | 1 + librarian/formats/html/__init__.py | 1 + librarian/formats/pdf/__init__.py | 3 +++ 3 files changed, 5 insertions(+) diff --git a/librarian/formats/epub/__init__.py b/librarian/formats/epub/__init__.py index 4787a74..4b6cf13 100644 --- a/librarian/formats/epub/__init__.py +++ b/librarian/formats/epub/__init__.py @@ -334,6 +334,7 @@ EpubFormat.renderers.register(core.Div, 'p', NaturalText('p')) EpubFormat.renderers.register(core.Div, 'list', NaturalText('ul')) EpubFormat.renderers.register(core.Div, 'list.enum', NaturalText('ol')) EpubFormat.renderers.register(core.Div, 'item', NaturalText('li')) +EpubFormat.renderers.register(core.Span, 'item', NaturalText('li')) class DivImageR(EpubRenderer): diff --git a/librarian/formats/html/__init__.py b/librarian/formats/html/__init__.py index 01dcbde..e1825a5 100644 --- a/librarian/formats/html/__init__.py +++ b/librarian/formats/html/__init__.py @@ -206,6 +206,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')) diff --git a/librarian/formats/pdf/__init__.py b/librarian/formats/pdf/__init__.py index 7d170b9..a994008 100644 --- a/librarian/formats/pdf/__init__.py +++ b/librarian/formats/pdf/__init__.py @@ -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')) -- 2.20.1