X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/3912237450eea1aa3575751c8ae5a9b696c77334..a1e5a5980a2354b855e79479701c5198884f7d5f:/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