X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/3912237450eea1aa3575751c8ae5a9b696c77334..640e6f5c1e85d05d728cd29a129df9ea8aa8f31f:/apps/catalogue/fields.py?ds=sidebyside diff --git a/apps/catalogue/fields.py b/apps/catalogue/fields.py index 0e02ff90f..bb9f26efe 100644 --- a/apps/catalogue/fields.py +++ b/apps/catalogue/fields.py @@ -105,19 +105,28 @@ class BuildTxt(BuildEbook): class BuildPdf(BuildEbook): @staticmethod def transform(wldoc, fieldfile): - return wldoc.as_pdf(morefloats=settings.LIBRARIAN_PDF_MOREFLOATS) + return wldoc.as_pdf(morefloats=settings.LIBRARIAN_PDF_MOREFLOATS, + cover=True) def build(self, fieldfile): BuildEbook.build(self, fieldfile) clear_cache(fieldfile.instance.slug) +@BuildEbook.register('epub') +@task(ignore_result=True) +class BuildEpub(BuildEbook): + @staticmethod + def transform(wldoc, fieldfile): + return wldoc.as_epub(cover=True) + + @BuildEbook.register('html') @task(ignore_result=True) class BuildHtml(BuildEbook): def build(self, fieldfile): from django.core.files.base import ContentFile - from slughifi import slughifi + from fnpdjango.utils.text.slughifi import slughifi from sortify import sortify from librarian import html from catalogue.models import Fragment, Tag