class Numeracja(WLElement):
- pass
+ NUMBERING = True
+ def assign_id(self, builder):
+ builder.counters['_visible'] = int(self.get('start', 1))
class Rownolegle(WLElement):
- def build_epub(self, builder):
+ def epub_build(self, builder):
for i, block in enumerate(self):
attr = {"class": "rownolegly-blok"}
if not i:
if i == len(self) - 1:
attr['class'] += ' last'
builder.start_element('div', attr)
- self.build_epub(block, builder)
+ block.epub_build(builder)
+ builder.end_element()
+
+ def html_build(self, builder):
+ for i, block in enumerate(self):
+ attr = {"class": "paralell-block"}
+ if not i:
+ attr['class'] += ' paralell-block-first'
+ if i == len(self) - 1:
+ attr['class'] += ' paralell-block-last'
+ builder.start_element('div', attr)
+ block.html_build(builder)
builder.end_element()
+
class Tab(WLElement):
EPUB_TAG = HTML_TAG = 'span'
+ def html_build(self, builder):
+ szer = self.get('szer', '1')
+ if szer == '*':
+ reopen = []
+ from lxml import etree
+ p = builder.cursor
+ while 'verse' not in p.attrib.get('class', ''):
+ reopen.append(p)
+ p = p.getparent()
+ builder.end_element()
+ builder.start_element('span', {'class': 'verse-stretched-space'})
+ builder.end_element()
+ while reopen:
+ p = reopen.pop()
+ builder.start_element(p.tag, p.attrib)
+ else:
+ super().html_build(builder)
+
def get_html_attr(self, builder):
+ szer = self.get('szer', '1').strip()
+ if szer.endswith('em'):
+ szer = szer[:-2]
try:
- szer = int(self.get('szer', 1))
+ szer = int(szer)
except:
szer = 1
return {
get_epub_attr = get_html_attr
+ def txt_build(self, builder):
+ szer = self.get('szer', '1').strip()
+ if szer.endswith('em'):
+ szer = szer[:-2]
+ try:
+ szer = int(szer)
+ except:
+ szer = 1
+ builder.push_text(' ' * 4 * szer)