fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add funding info.
[redakcja.git]
/
src
/
catalogue
/
xml_tools.py
diff --git
a/src/catalogue/xml_tools.py
b/src/catalogue/xml_tools.py
index
242714b
..
917e62a
100644
(file)
--- a/
src/catalogue/xml_tools.py
+++ b/
src/catalogue/xml_tools.py
@@
-1,4
+1,6
@@
-# -*- coding: utf-8 -*-
+# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
from copy import deepcopy
import re
from copy import deepcopy
import re
@@
-60,7
+62,7
@@
def add_trim_begin(text):
master.insert(0, trim_tag)
trim_tag.tail = '\n\n\n' + (master.text or '')
master.text = '\n'
master.insert(0, trim_tag)
trim_tag.tail = '\n\n\n' + (master.text or '')
master.text = '\n'
- return
unicode
(etree.tostring(e, encoding="utf-8"), 'utf-8')
+ return
str
(etree.tostring(e, encoding="utf-8"), 'utf-8')
def add_trim_end(text):
def add_trim_end(text):
@@
-79,7
+81,7
@@
def add_trim_end(text):
prev.tail = (prev.tail or '') + '\n\n\n'
else:
master.text = (master.text or '') + '\n\n\n'
prev.tail = (prev.tail or '') + '\n\n\n'
else:
master.text = (master.text or '') + '\n\n\n'
- return
unicode
(etree.tostring(e, encoding="utf-8"), 'utf-8')
+ return
str
(etree.tostring(e, encoding="utf-8"), 'utf-8')
def split_xml(text):
def split_xml(text):
@@
-124,13
+126,13
@@
def split_xml(text):
del parent[0]
element, parent = parent, parent.getparent()
chunks[:0] = [[name,
del parent[0]
element, parent = parent, parent.getparent()
chunks[:0] = [[name,
-
unicode
(etree.tostring(copied, encoding='utf-8'), 'utf-8')
+
str
(etree.tostring(copied, encoding='utf-8'), 'utf-8')
]]
parts = src.findall('.//naglowek_rozdzial')
chunks[:0] = [[u'początek',
]]
parts = src.findall('.//naglowek_rozdzial')
chunks[:0] = [[u'początek',
-
unicode
(etree.tostring(src, encoding='utf-8'), 'utf-8')
+
str
(etree.tostring(src, encoding='utf-8'), 'utf-8')
]]
for ch in chunks[1:]:
]]
for ch in chunks[1:]: