mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-01-22 12:54:12 +01:00
34 lines
1.5 KiB
Python
34 lines
1.5 KiB
Python
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
|
|
|
|
|
|
__license__ = 'GPL v3'
|
|
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
|
|
|
|
|
class DOCXInput(InputFormatPlugin):
|
|
name = 'DOCX Input'
|
|
author = 'Kovid Goyal'
|
|
description = 'Convert DOCX files (.docx and .docm) to HTML'
|
|
file_types = {'docx', 'docm'}
|
|
commit_name = 'docx_input'
|
|
|
|
options = {
|
|
OptionRecommendation(name='docx_no_cover', recommended_value=False,
|
|
help='Normally, if a large image is present at the start of the '
|
|
'document that looks like a cover, it will be removed from '
|
|
'the document and used as the cover for created e-book. This '
|
|
'option turns off that behavior.'),
|
|
OptionRecommendation(name='docx_no_pagebreaks_between_notes', recommended_value=False,
|
|
help='Do not insert a page break after every endnote.'),
|
|
OptionRecommendation(name='docx_inline_subsup', recommended_value=False,
|
|
help='Render superscripts and subscripts so that they do not '
|
|
'affect the line height.'),
|
|
}
|
|
|
|
recommendations = {('page_breaks_before', '/', OptionRecommendation.MED)}
|
|
|
|
def convert(self, stream, options, file_ext, log, accelerators):
|
|
from ebook_converter.ebooks.docx.to_html import Convert
|
|
return Convert(stream, detect_cover=not options.docx_no_cover, log=log, notes_nopb=options.docx_no_pagebreaks_between_notes,
|
|
nosupsub=options.docx_inline_subsup)()
|