fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
FB2: use mode=para for poems -- simplify.
[librarian.git]
/
librarian
/
parser.py
diff --git
a/librarian/parser.py
b/librarian/parser.py
index
469b7df
..
6343d21
100644
(file)
--- a/
librarian/parser.py
+++ b/
librarian/parser.py
@@
-19,7
+19,7
@@
class WLDocument(object):
LINE_SWAP_EXPR = re.compile(r'/\s', re.MULTILINE | re.UNICODE)
provider = None
LINE_SWAP_EXPR = re.compile(r'/\s', re.MULTILINE | re.UNICODE)
provider = None
- def __init__(self, edoc, parse_dublincore=True, provider=None):
+ def __init__(self, edoc, parse_dublincore=True, provider=None
, strict=False
):
self.edoc = edoc
self.provider = provider
self.edoc = edoc
self.provider = provider
@@
-36,7
+36,8
@@
class WLDocument(object):
if self.rdf_elem is None:
raise NoDublinCore('Document has no DublinCore - which is required.')
if self.rdf_elem is None:
raise NoDublinCore('Document has no DublinCore - which is required.')
- self.book_info = dcparser.BookInfo.from_element(self.rdf_elem)
+ self.book_info = dcparser.BookInfo.from_element(
+ self.rdf_elem, strict=strict)
else:
self.book_info = None
else:
self.book_info = None
@@
-184,6
+185,10
@@
class WLDocument(object):
from librarian import mobi
return mobi.transform(self, *args, **kwargs)
from librarian import mobi
return mobi.transform(self, *args, **kwargs)
+ def as_fb2(self, *args, **kwargs):
+ from librarian import fb2
+ return fb2.transform(self, *args, **kwargs)
+
def save_output_file(self, output_file, output_path=None,
output_dir_path=None, make_author_dir=False, ext=None):
if output_dir_path:
def save_output_file(self, output_file, output_path=None,
output_dir_path=None, make_author_dir=False, ext=None):
if output_dir_path:
@@
-191,7
+196,8
@@
class WLDocument(object):
if make_author_dir:
save_path = os.path.join(save_path,
unicode(self.book_info.author).encode('utf-8'))
if make_author_dir:
save_path = os.path.join(save_path,
unicode(self.book_info.author).encode('utf-8'))
- save_path = os.path.join(save_path, self.book_info.slug)
+ save_path = os.path.join(save_path,
+ self.book_info.uri.slug)
if ext:
save_path += '.%s' % ext
else:
if ext:
save_path += '.%s' % ext
else: