diff --git a/src/calibre/ebooks/mobi/output.py b/src/calibre/ebooks/mobi/output.py
index 84860d3d0f..4c272f75d1 100644
--- a/src/calibre/ebooks/mobi/output.py
+++ b/src/calibre/ebooks/mobi/output.py
@@ -24,6 +24,10 @@ class MOBIOutput(OutputFormatPlugin):
recommended_value=False, level=OptionRecommendation.LOW,
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,
help=_('Title for any generated in-line table of contents.')
),
@@ -35,8 +39,6 @@ class MOBIOutput(OutputFormatPlugin):
recommended_value=False, level=OptionRecommendation.LOW,
help=_('Disable compression of the file contents.')
),
-
-
])
def convert(self, oeb, output_path, input_plugin, opts, log):
@@ -49,8 +51,9 @@ def convert(self, oeb, output_path, input_plugin, opts, log):
from calibre.ebooks.oeb.transforms.htmltoc import HTMLTOCAdder
from calibre.customize.ui import plugin_for_input_format
imagemax = PALM_MAX_IMAGE_SIZE if opts.rescale_images else None
- tocadder = HTMLTOCAdder(title=opts.toc_title)
- tocadder(oeb, opts)
+ if not opts.no_inline_toc:
+ tocadder = HTMLTOCAdder(title=opts.toc_title)
+ tocadder(oeb, opts)
mangler = CaseMangler()
mangler(oeb, opts)
rasterizer = SVGRasterizer()
@@ -58,7 +61,6 @@ def convert(self, oeb, output_path, input_plugin, opts, log):
mobimlizer = MobiMLizer(ignore_tables=opts.linearize_tables)
mobimlizer(oeb, opts)
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,
compression=UNCOMPRESSED if opts.dont_compress else PALMDOC,
prefer_author_sort=opts.prefer_author_sort,
diff --git a/src/calibre/gui2/convert/mobi_output.ui b/src/calibre/gui2/convert/mobi_output.ui
index bc1cd45714..8bd205e9dd 100644
--- a/src/calibre/gui2/convert/mobi_output.ui
+++ b/src/calibre/gui2/convert/mobi_output.ui
@@ -14,7 +14,7 @@
Form
- -
+
-
&Title for Table of Contents:
@@ -24,24 +24,24 @@
- -
+
-
- -
+
-
Rescale images for &Palm devices
- -
+
-
Use author &sort for author
- -
+
-
Qt::Vertical
@@ -54,20 +54,27 @@
- -
+
-
Disable compression of the file contents
- -
+
-
Generate a periodical rather than a book
+ -
+
+
+ Do not add Table of Contents to book
+
+
+