Make sure Pillow uses ImageFont.LAYOUT_BASIC because of https://github.com/python...
[librarian.git] / src / librarian / elements / poetry / wers_wciety.py
index 3e9bb6f..8ac2bb3 100644 (file)
@@ -4,13 +4,17 @@ from .wers import Wers
 class WersWciety(Wers):
     @property
     def typ(self):
 class WersWciety(Wers):
     @property
     def typ(self):
-        ## Temporary legacy compatibility fix.
-        return 2 if 'typ' in self.attrib else 1
-
         v = self.attrib.get('typ')
         return int(v) if v else 1
 
     def _txt_build_inner(self, builder):
         v = self.attrib.get('typ')
         return int(v) if v else 1
 
     def _txt_build_inner(self, builder):
+        ## Temporary legacy compatibility fix.
+        typ = min(self.typ, 2)
+
         builder.push_text('  ' * self.typ, prepared=True)
         super(WersWciety, self)._txt_build_inner(builder)
 
         builder.push_text('  ' * self.typ, prepared=True)
         super(WersWciety, self)._txt_build_inner(builder)
 
+    def get_html_attr(self, builder):
+        attr = super(WersWciety, self).get_html_attr(builder)
+        attr['style'] = "padding-left: {}em".format(self.typ)
+        return attr