fixes
authorRadek Czajka <rczajka@rczajka.pl>
Tue, 17 Sep 2024 14:08:51 +0000 (16:08 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Tue, 17 Sep 2024 14:08:51 +0000 (16:08 +0200)
src/librarian/builders/html.py
src/librarian/builders/txt.py
src/librarian/elements/comments/abstrakt.py

index f2177ae..ac6b0a7 100644 (file)
@@ -240,6 +240,8 @@ class AbstraktHtmlBuilder(HtmlBuilder):
     def build(self, document, element=None, **kwargs):
         if element is None:
             element = document.tree.find('//abstrakt')
     def build(self, document, element=None, **kwargs):
         if element is None:
             element = document.tree.find('//abstrakt')
+        if element is None:
+            return OutputFile.from_bytes(b'')
         element.attrib['_force'] = '1'
         return super().build(document, element, **kwargs)
 
         element.attrib['_force'] = '1'
         return super().build(document, element, **kwargs)
 
index 28fe709..92ddb46 100644 (file)
@@ -115,7 +115,7 @@ class TxtBuilder:
                     for translator in meta.translators
                 )
             )
                     for translator in meta.translators
                 )
             )
-            builder.push_margin(2)
+            self.push_margin(2)
 
         if meta.isbn_txt:
             self.push_margin(2)
 
         if meta.isbn_txt:
             self.push_margin(2)
index f54a455..b5bf8d6 100644 (file)
@@ -9,7 +9,7 @@ class Abstrakt(WLElement):
         pass
 
     def html_build(self, builder):
         pass
 
     def html_build(self, builder):
-        if not self.attrib['_force']:
+        if not self.attrib.get('_force', False):
             return
         return super().html_build(builder)
 
             return
         return super().html_build(builder)