fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove direct verse styling from html.
[librarian.git]
/
src
/
librarian
/
elements
/
base.py
diff --git
a/src/librarian/elements/base.py
b/src/librarian/elements/base.py
index
646067e
..
863436c
100644
(file)
--- a/
src/librarian/elements/base.py
+++ b/
src/librarian/elements/base.py
@@
-1,3
+1,6
@@
+# This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
+#
import copy
import re
from lxml import etree
import copy
import re
from lxml import etree
@@
-39,11
+42,11
@@
class WLElement(etree.ElementBase):
STRIP = False
text_substitutions = [
STRIP = False
text_substitutions = [
- (
u'---', u
'—'),
- (
u'--', u
'–'),
- #(
u'...', u
'…'), # Temporary turnoff for epub
- (
u',,', u
'„'),
- (
u'"', u
'”'),
+ (
'---',
'—'),
+ (
'--',
'–'),
+ #(
'...',
'…'), # Temporary turnoff for epub
+ (
',,',
'„'),
+ (
'"',
'”'),
('\ufeff', ''),
("'", "\u2019"), # This was enabled for epub.
('\ufeff', ''),
("'", "\u2019"), # This was enabled for epub.
@@
-113,11
+116,11
@@
class WLElement(etree.ElementBase):
newt = ''
wlist = re.compile(r'\w+|[^\w]', re.UNICODE).findall(text)
for w in wlist:
newt = ''
wlist = re.compile(r'\w+|[^\w]', re.UNICODE).findall(text)
for w in wlist:
- newt += builder.hyphenator.inserted(w,
u
'\u00AD')
+ newt += builder.hyphenator.inserted(w, '\u00AD')
text = newt
if builder.orphans:
text = newt
if builder.orphans:
- text = re.sub(r'(?<=\s\w)\s+',
u
'\u00A0', text)
+ text = re.sub(r'(?<=\s\w)\s+', '\u00A0', text)
return text
return text
@@
-278,8
+281,6
@@
class WLElement(etree.ElementBase):
# do we dare go up?
parent = self.getparent()
if parent is not None and parent.CAN_HAVE_TEXT:
# do we dare go up?
parent = self.getparent()
if parent is not None and parent.CAN_HAVE_TEXT:
- print(etree.tostring(self, encoding='unicode'))
- assert False
words, parsnip = parent.snip(words, before=self)
return words, parsnip[:-1] + snippet + parsnip[-1:]
words, parsnip = parent.snip(words, before=self)
return words, parsnip[:-1] + snippet + parsnip[-1:]