fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prettier authors on covers.
[librarian.git]
/
librarian
/
text.py
diff --git
a/librarian/text.py
b/librarian/text.py
index
39bf324
..
7ba6d29
100644
(file)
--- a/
librarian/text.py
+++ b/
librarian/text.py
@@
-3,10
+3,13
@@
# This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
# This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
+from __future__ import unicode_literals
+
import copy
from librarian import functions, OutputFile
from lxml import etree
import os
import copy
from librarian import functions, OutputFile
from lxml import etree
import os
+import six
functions.reg_substitute_entities()
functions.reg_substitute_entities()
@@
-60,7
+63,7
@@
def transform(wldoc, flags=None, **options):
license_description = parsed_dc.license_description
license = parsed_dc.license
if license:
license_description = parsed_dc.license_description
license = parsed_dc.license
if license:
- license_description = u"Ten utwór jest udost
e
pniony na licencji %s: \n%s" % (
+ license_description = u"Ten utwór jest udost
ę
pniony na licencji %s: \n%s" % (
license_description, license)
else:
license_description = u"Ten utwór nie jest objęty majątkowym prawem autorskim i znajduje się " \
license_description, license)
else:
license_description = u"Ten utwór nie jest objęty majątkowym prawem autorskim i znajduje się " \
@@
-85,9
+88,9
@@
def transform(wldoc, flags=None, **options):
if funders:
funders = u"\n\nPublikację wsparli i wsparły: %s." % funders
publisher = '\n\nWydawca: ' + ', '.join(parsed_dc.publisher)
if funders:
funders = u"\n\nPublikację wsparli i wsparły: %s." % funders
publisher = '\n\nWydawca: ' + ', '.join(parsed_dc.publisher)
- isbn
_element = document.edoc.find("//meta[@id='txt-id']"
)
- if isbn
_element is not None
:
- isbn =
isbn_element.text.replace('ISBN-', '\n\nISBN ')
+ isbn
= getattr(parsed_dc, 'isbn_txt', None
)
+ if isbn:
+ isbn =
'\n\n' + isbn
else:
isbn = ''
else:
else:
isbn = ''
else:
@@
-103,7
+106,7
@@
def transform(wldoc, flags=None, **options):
'description': description,
'url': url,
'license_description': license_description,
'description': description,
'url': url,
'license_description': license_description,
- 'text':
unicod
e(result),
+ 'text':
six.text_typ
e(result),
'source': source,
'contributors': contributors,
'funders': funders,
'source': source,
'contributors': contributors,
'funders': funders,
@@
-111,5
+114,5
@@
def transform(wldoc, flags=None, **options):
'isbn': isbn,
}).encode('utf-8')
else:
'isbn': isbn,
}).encode('utf-8')
else:
- result =
unicod
e(result).encode('utf-8')
- return OutputFile.from_
string("\r\n".join(result.splitlines()) +
"\r\n")
+ result =
six.text_typ
e(result).encode('utf-8')
+ return OutputFile.from_
bytes(b"\r\n".join(result.splitlines()) + b
"\r\n")