mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
MOBI Output: Add option to suppress addition of Table of Contents to end of book, since there appear to be lots of people that think doing this is bad, and I am tired of respoding to them.
This commit is contained in:
parent
c941abc652
commit
9788269337
@ -24,6 +24,10 @@ class MOBIOutput(OutputFormatPlugin):
|
|||||||
recommended_value=False, level=OptionRecommendation.LOW,
|
recommended_value=False, level=OptionRecommendation.LOW,
|
||||||
help=_('When present, use author sort field as author.')
|
help=_('When present, use author sort field as author.')
|
||||||
),
|
),
|
||||||
|
OptionRecommendation(name='no_inline_toc',
|
||||||
|
recommended_value=False, level=OptionRecommendation.LOW,
|
||||||
|
help=_('Don\'t add Table of Contents to end of book. Useful if '
|
||||||
|
'the book has its own table of contents.')),
|
||||||
OptionRecommendation(name='toc_title', recommended_value=None,
|
OptionRecommendation(name='toc_title', recommended_value=None,
|
||||||
help=_('Title for any generated in-line table of contents.')
|
help=_('Title for any generated in-line table of contents.')
|
||||||
),
|
),
|
||||||
@ -35,8 +39,6 @@ class MOBIOutput(OutputFormatPlugin):
|
|||||||
recommended_value=False, level=OptionRecommendation.LOW,
|
recommended_value=False, level=OptionRecommendation.LOW,
|
||||||
help=_('Disable compression of the file contents.')
|
help=_('Disable compression of the file contents.')
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
])
|
])
|
||||||
|
|
||||||
def convert(self, oeb, output_path, input_plugin, opts, log):
|
def convert(self, oeb, output_path, input_plugin, opts, log):
|
||||||
@ -49,8 +51,9 @@ class MOBIOutput(OutputFormatPlugin):
|
|||||||
from calibre.ebooks.oeb.transforms.htmltoc import HTMLTOCAdder
|
from calibre.ebooks.oeb.transforms.htmltoc import HTMLTOCAdder
|
||||||
from calibre.customize.ui import plugin_for_input_format
|
from calibre.customize.ui import plugin_for_input_format
|
||||||
imagemax = PALM_MAX_IMAGE_SIZE if opts.rescale_images else None
|
imagemax = PALM_MAX_IMAGE_SIZE if opts.rescale_images else None
|
||||||
tocadder = HTMLTOCAdder(title=opts.toc_title)
|
if not opts.no_inline_toc:
|
||||||
tocadder(oeb, opts)
|
tocadder = HTMLTOCAdder(title=opts.toc_title)
|
||||||
|
tocadder(oeb, opts)
|
||||||
mangler = CaseMangler()
|
mangler = CaseMangler()
|
||||||
mangler(oeb, opts)
|
mangler(oeb, opts)
|
||||||
rasterizer = SVGRasterizer()
|
rasterizer = SVGRasterizer()
|
||||||
@ -58,7 +61,6 @@ class MOBIOutput(OutputFormatPlugin):
|
|||||||
mobimlizer = MobiMLizer(ignore_tables=opts.linearize_tables)
|
mobimlizer = MobiMLizer(ignore_tables=opts.linearize_tables)
|
||||||
mobimlizer(oeb, opts)
|
mobimlizer(oeb, opts)
|
||||||
write_page_breaks_after_item = not input_plugin is plugin_for_input_format('cbz')
|
write_page_breaks_after_item = not input_plugin is plugin_for_input_format('cbz')
|
||||||
print 111111, write_page_breaks_after_item
|
|
||||||
writer = MobiWriter(opts, imagemax=imagemax,
|
writer = MobiWriter(opts, imagemax=imagemax,
|
||||||
compression=UNCOMPRESSED if opts.dont_compress else PALMDOC,
|
compression=UNCOMPRESSED if opts.dont_compress else PALMDOC,
|
||||||
prefer_author_sort=opts.prefer_author_sort,
|
prefer_author_sort=opts.prefer_author_sort,
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Title for Table of Contents:</string>
|
<string>&Title for Table of Contents:</string>
|
||||||
@ -24,24 +24,24 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QLineEdit" name="opt_toc_title"/>
|
<widget class="QLineEdit" name="opt_toc_title"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="2">
|
<item row="2" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="opt_rescale_images">
|
<widget class="QCheckBox" name="opt_rescale_images">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Rescale images for &Palm devices</string>
|
<string>Rescale images for &Palm devices</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="2">
|
<item row="3" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="opt_prefer_author_sort">
|
<widget class="QCheckBox" name="opt_prefer_author_sort">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use author &sort for author</string>
|
<string>Use author &sort for author</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="6" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -54,20 +54,27 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QCheckBox" name="opt_dont_compress">
|
<widget class="QCheckBox" name="opt_dont_compress">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Disable compression of the file contents</string>
|
<string>Disable compression of the file contents</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QCheckBox" name="opt_mobi_periodical">
|
<widget class="QCheckBox" name="opt_mobi_periodical">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Generate a periodical rather than a book</string>
|
<string>Generate a periodical rather than a book</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QCheckBox" name="opt_no_inline_toc">
|
||||||
|
<property name="text">
|
||||||
|
<string>Do not add Table of Contents to book</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user