New version with the new EPUB converter.
[librarian.git] / src / librarian / elements / poetry / wers_wciety.py
1 from .wers import Wers
2
3
4 class WersWciety(Wers):
5     @property
6     def typ(self):
7         v = self.attrib.get('typ')
8         return int(v) if v else 1
9
10     def _txt_build_inner(self, builder):
11         ## Temporary legacy compatibility fix.
12         typ = min(self.typ, 2)
13
14         builder.push_text('  ' * self.typ, prepared=True)
15         super(WersWciety, self)._txt_build_inner(builder)
16
17     def get_html_attr(self, builder):
18         attr = super(WersWciety, self).get_html_attr(builder)
19         attr['style'] = "padding-left: {}em".format(self.typ)
20         return attr
21
22     def get_epub_attr(self, builder):
23         attr = super(WersWciety, self).get_html_attr(builder)
24         attr['style'] = "margin-left: {}em".format(self.typ)
25         return attr