From: Radek Czajka Date: Mon, 20 Dec 2021 14:17:09 +0000 (+0100) Subject: fixes X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/cb3eefff46f3ae0b331f7babbd111a3735e22652?ds=inline;hp=530238f609ba71ea112307ea66f0bc486ae11e33 fixes --- diff --git a/src/depot/models.py b/src/depot/models.py index 12bd9c2a..c654d1b9 100644 --- a/src/depot/models.py +++ b/src/depot/models.py @@ -45,8 +45,10 @@ class Package(models.Model): def build(self): f = tempfile.NamedTemporaryFile(prefix='depot-', suffix='.zip', mode='wb', delete=False) + book_count = self.books.all().count() with zipfile.ZipFile(f, 'w') as z: - for book in self.books.all(): + for i, book in enumerate(self.books.all()): + print(f'{i}/{book_count} {book.slug}') self.build_for(book, z) f.close() with open(f.name, 'rb') as ff: @@ -94,16 +96,20 @@ class Package(models.Model): output = EpubBuilder( cover=cover, base_url=base_url, -# fundraising=[] + fundraising=item.get('fundraising', []), ).build(wldoc2) elif item['type'] == 'mobi': output = MobiBuilder( cover=cover, base_url=base_url, + fundraising=item.get('fundraising', []), ).build(wldoc2) - fname = f'{slug}/{slug}.{ext}' + fname = f'{slug}/{slug}.' + if 'slug' in item: + fname += item['slug'] + '.' + fname += ext z.writestr( fname, diff --git a/src/documents/models/book.py b/src/documents/models/book.py index 0e696e40..d5724a24 100644 --- a/src/documents/models/book.py +++ b/src/documents/models/book.py @@ -413,7 +413,7 @@ class Book(models.Model): from librarian.parser import WLDocument from librarian.document import WLDocument as WLDocument2 - provider = RedakcjaDocProvider(publishable=publishable), + provider = RedakcjaDocProvider(publishable=publishable) xml = self.materialize(publishable=publishable, changes=changes).encode('utf-8') if librarian2: diff --git a/src/documents/templates/documents/book_detail.html b/src/documents/templates/documents/book_detail.html index 85da536e..55da2253 100644 --- a/src/documents/templates/documents/book_detail.html +++ b/src/documents/templates/documents/book_detail.html @@ -145,8 +145,8 @@ Okładka w rozmiarze {% trans "book" %} {% trans "characters" %} - {% trans "words" %} {% trans "characters (with footnotes)" %} + {% trans "words" %} {% trans "words (with footnotes)" %} diff --git a/src/documents/templates/documents/book_stats.html b/src/documents/templates/documents/book_stats.html index 084627f0..793eaa2a 100644 --- a/src/documents/templates/documents/book_stats.html +++ b/src/documents/templates/documents/book_stats.html @@ -1,19 +1,19 @@ {{ book.book_info.title|default:"???" }} - {{ stats.self.chars|default_if_none:"?" }} - {{ stats.self.words|default_if_none:"?" }} {{ stats.self.chars_with_fn|default_if_none:"?" }} + {{ stats.self.chars|default_if_none:"?" }} {{ stats.self.words_with_fn|default_if_none:"?" }} + {{ stats.self.words|default_if_none:"?" }} {% if stats.parts %} {% for part, partstats in stats.parts %} {% include 'documents/book_stats.html' with book=part stats=partstats depth=depth|add:1 %} {% endfor %} - Σ - {{ stats.total.chars }} - {{ stats.total.words }} + Σ {{ stats.total.chars_with_fn }} + {{ stats.total.chars }} {{ stats.total.words_with_fn }} + {{ stats.total.words }} {% endif %}