Some layout experiments.
[wolnelektury.git] / apps / catalogue / fields.py
index 0e02ff9..bb9f26e 100644 (file)
@@ -105,19 +105,28 @@ class BuildTxt(BuildEbook):
 class BuildPdf(BuildEbook):
     @staticmethod
     def transform(wldoc, fieldfile):
 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)
 
 
 
     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
 @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
         from sortify import sortify
         from librarian import html
         from catalogue.models import Fragment, Tag