mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book Edit: Fix importing DOCX file as new book not setting the version attribute in the OPF
This commit is contained in:
parent
b0de1b61ef
commit
692022e3b3
@ -37,6 +37,8 @@ class PrettyPrint(object):
|
|||||||
def __exit__(self, *args):
|
def __exit__(self, *args):
|
||||||
global pretty_print_opf
|
global pretty_print_opf
|
||||||
pretty_print_opf = False
|
pretty_print_opf = False
|
||||||
|
|
||||||
|
|
||||||
pretty_print = PrettyPrint()
|
pretty_print = PrettyPrint()
|
||||||
|
|
||||||
|
|
||||||
@ -1570,6 +1572,7 @@ class OPFCreator(Metadata):
|
|||||||
guide
|
guide
|
||||||
)
|
)
|
||||||
root.set('unique-identifier', __appname__+'_id')
|
root.set('unique-identifier', __appname__+'_id')
|
||||||
|
root.set('version', '2.0')
|
||||||
raw = etree.tostring(root, pretty_print=True, xml_declaration=True,
|
raw = etree.tostring(root, pretty_print=True, xml_declaration=True,
|
||||||
encoding=encoding)
|
encoding=encoding)
|
||||||
raw = raw.replace(DNS, OPF2_NS)
|
raw = raw.replace(DNS, OPF2_NS)
|
||||||
@ -1835,6 +1838,7 @@ def test_user_metadata():
|
|||||||
assert um == opf2._user_metadata_
|
assert um == opf2._user_metadata_
|
||||||
print opf.render()
|
print opf.render()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# test_user_metadata()
|
# test_user_metadata()
|
||||||
test_m2o()
|
test_m2o()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user