2 from ..base import WLElement
6 class Strofa(WLElement):
9 TXT_LEGACY_TOP_MARGIN = 1
10 TXT_LEGACY_BOTTOM_MARGIN = 0
16 from librarian.parser import parser
19 parser.makeelement('wers')
22 # Before any tags. These are text-only verses.
23 pieces = self.text.split('/')
24 for piece in pieces[:-1]:
25 verses[-1].text = piece
26 verses.append(parser.makeelement('wers'))
27 verses[-1].text = pieces[-1]
31 pieces = child.tail.split('/')
32 child_copy = copy(child)
33 child_copy.tail = pieces[0]
34 verses[-1].append(child_copy)
36 for piece in pieces[1:]:
37 verses.append(parser.makeelement('wers'))
38 verses[-1].text = piece
41 verses[-1].append(child)
45 if len(verse) == 1 and isinstance(verse[0], Wers):
46 assert not (verse.text or '').strip()
47 assert not (verse[0].tail or '').strip()
52 def _build_inner(self, builder, build_method):
53 for child in self.get_verses():
54 getattr(child, build_method)(builder)