2 from ..base import WLElement
6 class Strofa(WLElement):
9 TXT_LEGACY_TOP_MARGIN = 1
10 TXT_LEGACY_BOTTOM_MARGIN = 0
13 from librarian.parser import parser
16 parser.makeelement('wers')
19 # Before any tags. These are text-only verses.
20 pieces = self.text.split('/')
21 for piece in pieces[:-1]:
22 verses[-1].text = piece
23 verses.append(parser.makeelement('wers'))
24 verses[-1].text = pieces[-1]
28 pieces = child.tail.split('/')
29 child_copy = copy(child)
30 child_copy.tail = pieces[0]
31 verses[-1].append(child_copy)
33 for piece in pieces[1:]:
34 verses.append(parser.makeelement('wers'))
35 verses[-1].text = piece
38 verses[-1].append(child)
41 if len(verse) == 1 and isinstance(verse[0], Wers):
42 assert not (verse.text or '').strip()
43 assert not (verse[0].tail or '').strip()
48 def _build_inner(self, builder, build_method):
49 for child in self.get_verses():
50 getattr(child, build_method)(builder)