fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
release
[librarian.git]
/
src
/
librarian
/
elements
/
poetry
/
strofa.py
diff --git
a/src/librarian/elements/poetry/strofa.py
b/src/librarian/elements/poetry/strofa.py
index
7ce3f3a
..
f698bc3
100644
(file)
--- a/
src/librarian/elements/poetry/strofa.py
+++ b/
src/librarian/elements/poetry/strofa.py
@@
-8,12
+8,10
@@
from .wers import Wers
class Strofa(WLElement):
class Strofa(WLElement):
- SHOULD_HAVE_ID = True
+ NUMBERING = 'i'
TXT_TOP_MARGIN = 2
TXT_BOTTOM_MARGIN = 2
TXT_TOP_MARGIN = 2
TXT_BOTTOM_MARGIN = 2
- TXT_LEGACY_TOP_MARGIN = 1
- TXT_LEGACY_BOTTOM_MARGIN = 0
EPUB_TAG = HTML_TAG = 'div'
EPUB_CLASS = HTML_CLASS = 'stanza'
EPUB_TAG = HTML_TAG = 'div'
EPUB_CLASS = HTML_CLASS = 'stanza'
@@
-28,8
+26,8
@@
class Strofa(WLElement):
)
builder.push_text('\u00a0');
builder.end_element()
)
builder.push_text('\u00a0');
builder.end_element()
-
- def
get_verse
s(self):
+
+ def
preproces
s(self):
from librarian.parser import parser
verses = [
from librarian.parser import parser
verses = [
@@
-57,15
+55,15
@@
class Strofa(WLElement):
else:
verses[-1].append(child)
else:
verses[-1].append(child)
- for verse in verses:
- verse.stanza = self
- if len(verse) == 1 and isinstance(verse[0], Wers):
- assert not (verse.text or '').strip()
- assert not (verse[0].tail or '').strip()
- yield verse[0]
- else:
- yield verse
+ verses = [
+ verse[0] if len(verse) == 1 and isinstance(verse[0], Wers)
+ else verse
+ for verse in verses
+ ]
+
+ while len(self):
+ self.remove(self[0])
+ self.text = None
- def _build_inner(self, builder, build_method):
- for child in self.get_verses():
- getattr(child, build_method)(builder)
+ for verse in verses:
+ self.append(verse)