fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wip change fb2 api
[librarian.git]
/
src
/
librarian
/
elements
/
poetry
/
wers_wciety.py
diff --git
a/src/librarian/elements/poetry/wers_wciety.py
b/src/librarian/elements/poetry/wers_wciety.py
index
3e9bb6f
..
cb5f25e
100644
(file)
--- a/
src/librarian/elements/poetry/wers_wciety.py
+++ b/
src/librarian/elements/poetry/wers_wciety.py
@@
-1,16
+1,30
@@
+# This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
+#
from .wers import Wers
class WersWciety(Wers):
from .wers import Wers
class WersWciety(Wers):
+ HTML_CLASS = Wers.HTML_CLASS + ' verse-indent'
+
@property
def typ(self):
@property
def typ(self):
- ## Temporary legacy compatibility fix.
- return 2 if 'typ' in self.attrib else 1
-
v = self.attrib.get('typ')
return int(v) if v else 1
v = self.attrib.get('typ')
return int(v) if v else 1
- def _txt_build_inner(self, builder):
+ def txt_build_inner(self, builder):
+ ## Temporary legacy compatibility fix.
+ typ = min(self.typ, 2)
+
builder.push_text(' ' * self.typ, prepared=True)
builder.push_text(' ' * self.typ, prepared=True)
- super(WersWciety, self)._txt_build_inner(builder)
+ super().txt_build_inner(builder)
+
+ def get_html_attr(self, builder):
+ attr = super().get_html_attr(builder)
+ attr['class'] += f" verse-indent-{self.typ}"
+ return attr
+ def get_epub_attr(self, builder):
+ attr = super().get_html_attr(builder)
+ attr['style'] = "margin-left: {}em".format(self.typ)
+ return attr