From: Guillaume Pellerin Date: Mon, 15 Jun 2015 19:49:46 +0000 (+0200) Subject: add end image on last page X-Git-Tag: 1.6a~4^2~27 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=51a171118e77fc61eb609dc3bc5c62293de87370;p=telemeta.git add end image on last page --- diff --git a/telemeta/static/telemeta/css/telemeta_epub.css b/telemeta/static/telemeta/css/telemeta_epub.css index e2a9a788..389365c7 100644 --- a/telemeta/static/telemeta/css/telemeta_epub.css +++ b/telemeta/static/telemeta/css/telemeta_epub.css @@ -4,18 +4,24 @@ body { font-family: Cambria, Liberation Serif, Bitstream Vera Serif, Georgia, Times, Times New Roman, serif; } +.title { + padding-top : 18%; + page-break-after:always; +} + h2 { - text-align: left; - font-size: 1.5em; text-transform: uppercase; - font-weight: 200; + font-family : sans-serif; + text-align: left; + font-size:110%; + font-weight: bold; } h3 { text-align: left; - font-size: 1.25em; + font-size: 140%; margin-top: 0px; - font-weight: normal; + font-weight: bold; color: #2B90AB; } @@ -60,3 +66,7 @@ img { width: 50%; height: auto; } + +.last-page { + page-break-before: always; +} \ No newline at end of file diff --git a/telemeta/static/telemeta/images/cul-de-lampe_fin-page.jpg b/telemeta/static/telemeta/images/cul-de-lampe_fin-page.jpg deleted file mode 100644 index b4910f70..00000000 Binary files a/telemeta/static/telemeta/images/cul-de-lampe_fin-page.jpg and /dev/null differ diff --git a/telemeta/templates/telemeta/inc/epub_collection.html b/telemeta/templates/telemeta/inc/epub_collection.html index 19719e0a..b9f9bbac 100644 --- a/telemeta/templates/telemeta/inc/epub_collection.html +++ b/telemeta/templates/telemeta/inc/epub_collection.html @@ -1,9 +1,9 @@ -{% if not mode_single %} -

{{ title }}

-

{{ subtitle }}

-{% endif %} +
+

{{ title }}

+

{{ subtitle }}

+
{% for item in items %}
@@ -30,3 +30,9 @@ {% endif %}
{% endfor %} + +{% if last_collection %} +
+ +
+{% endif %} diff --git a/telemeta/views/epub.py b/telemeta/views/epub.py index 3e6f28ef..f2541622 100644 --- a/telemeta/views/epub.py +++ b/telemeta/views/epub.py @@ -46,6 +46,7 @@ class BaseEpubMixin(TelemetaBaseMixin): local_path = os.path.dirname(__file__) css = os.sep.join([local_path, '..', 'static', 'telemeta', 'css', 'telemeta_epub.css']) default_image = os.sep.join([local_path, '..', 'static', 'telemeta', 'images', 'cul_de_lampe.jpg']) + default_image_end = os.sep.join([local_path, '..', 'static', 'telemeta', 'images', 'cul_de_lampe-fin_page.jpg']) template = os.sep.join([local_path, '..', 'templates', 'telemeta', 'inc', 'epub_collection.html']) template_preamble = os.sep.join([local_path, '..', 'templates', 'telemeta', 'inc', 'epub_preamble.html']) template_cover = os.sep.join([local_path, '..', 'templates', 'telemeta', 'inc', 'epub_cover.html']) @@ -112,6 +113,8 @@ class BaseEpubMixin(TelemetaBaseMixin): default_image_relative_path = '' self.book.add_item(preamble) self.chapters.append(preamble) + default_image_end_relative_path = 'images' + os.sep + os.path.split(self.default_image_end)[-1] + i = 1 for collection in self.collections: items = {} @@ -163,12 +166,18 @@ class BaseEpubMixin(TelemetaBaseMixin): subtitle = '' chapter_title = title + last_collection = False + if i == len(self.collections): + last_collection = True + context = {'collection': collection, 'title': title, 'subtitle': subtitle, 'mode_single': mode_single, - 'site': site, 'items': items, 'default_image': default_image_relative_path} + 'site': site, 'items': items, 'default_image': default_image_relative_path, + 'default_image_end': default_image_end_relative_path, 'last_collection': last_collection} c = epub.EpubHtml(title=chapter_title, file_name=collection.code + '.xhtml', lang='fr') c.content = render_to_string(self.template, context) self.book.add_item(c) self.chapters.append(c) + i += 1 # create table of contents # - add manual link @@ -178,9 +187,11 @@ class BaseEpubMixin(TelemetaBaseMixin): self.book.spine = self.chapters # add navigation files - self.book.add_item(epub.EpubNcx()) + ncx = epub.EpubNcx() + self.book.add_item(ncx) if not mode_single: - self.book.add_item(epub.EpubNav()) + nav = epub.EpubNav() + self.book.add_item(nav) self.book.spine.insert(0,'nav') # create spin, add cover page as first page