X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/bc7e9351bc22788218e988c188defdbdfbe12fd8..af72c4ed58e541d491dafbfe4ecb163662f402b5:/src/librarian/elements/tools/__init__.py diff --git a/src/librarian/elements/tools/__init__.py b/src/librarian/elements/tools/__init__.py index 1e9d53f..ad0ab97 100644 --- a/src/librarian/elements/tools/__init__.py +++ b/src/librarian/elements/tools/__init__.py @@ -4,3 +4,32 @@ from ..base import WLElement class Numeracja(WLElement): pass + +class Rownolegle(WLElement): + def build_epub(self, builder): + for i, block in enumerate(self): + attr = {"class": "rownolegly-blok"} + if not i: + attr['class'] += ' first' + if i == len(self) - 1: + attr['class'] += ' last' + builder.start_element('div', attr) + self.build_epub(block, builder) + builder.end_element() + + +class Tab(WLElement): + EPUB_TAG = HTML_TAG = 'span' + + def get_html_attr(self, builder): + try: + szer = int(self.get('szer', 1)) + except: + szer = 1 + return { + "display": "inline-block", + "width": f"{szer}em", + } + + get_epub_attr = get_html_attr +