1 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
7 class WersWciety(Wers):
8 HTML_CLASS = Wers.HTML_CLASS + ' verse-indent'
12 v = self.attrib.get('typ')
13 return int(v) if v else 1
15 def _txt_build_inner(self, builder):
16 ## Temporary legacy compatibility fix.
17 typ = min(self.typ, 2)
19 builder.push_text(' ' * self.typ, prepared=True)
20 super(WersWciety, self)._txt_build_inner(builder)
22 def get_html_attr(self, builder):
23 attr = super(WersWciety, self).get_html_attr(builder)
24 attr['class'] += f" verse-indent-{self.typ}"
27 def get_epub_attr(self, builder):
28 attr = super(WersWciety, self).get_html_attr(builder)
29 attr['style'] = "margin-left: {}em".format(self.typ)