![]() |
#1 |
Member
![]() Posts: 17
Karma: 10
Join Date: Jan 2015
Device: iphone 6
|
![]()
The file is:
Code:
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <h1>Document</h1> <h2>Test 1</h2> <h3>Test 1.1</h3> <h3>Test 1.2</h3> <h2>Test 2</h2> ... </body> </html> What I tried: Code:
/Applications/calibre.app/Contents/MacOS/ebook-convert 2.html 2.epub --level1-toc '//h2' --level2-toc '//h3' -vv Code:
iliakan> /Applications/calibre.app/Contents/MacOS/ebook-convert 2.html 2.epub --level1-toc '//h2' --level2-toc '//h3' -vv Resolved conversion options calibre version: 2.14.0 {'asciiize': False, 'author_sort': None, 'authors': None, 'base_font_size': 0, 'book_producer': None, 'breadth_first': False, 'change_justification': 'original', 'chapter': "//*[((name()='h1' or name()='h2') and re:test(., '\\s*((chapter|book|section|part)\\s+)|((prolog|prologue|epilogue)(\\s+|$))', 'i')) or @class = 'chapter']", 'chapter_mark': 'pagebreak', 'comments': None, 'cover': None, 'debug_pipeline': None, 'dehyphenate': True, 'delete_blank_paragraphs': True, 'disable_font_rescaling': False, 'dont_package': False, 'dont_split_on_page_breaks': False, 'duplicate_links_in_toc': False, 'embed_all_fonts': False, 'embed_font_family': None, 'enable_heuristics': False, 'epub_flatten': False, 'epub_inline_toc': False, 'epub_toc_at_end': False, 'expand_css': False, 'extra_css': None, 'extract_to': None, 'filter_css': None, 'fix_indents': True, 'flow_size': 260, 'font_size_mapping': None, 'format_scene_breaks': True, 'html_unwrap_factor': 0.4, 'input_encoding': None, 'input_profile': <calibre.customize.profiles.InputProfile object at 0x10ef22a10>, 'insert_blank_line': False, 'insert_blank_line_size': 0.5, 'insert_metadata': False, 'isbn': None, 'italicize_common_cases': True, 'keep_ligatures': False, 'language': None, 'level1_toc': u'//h2', 'level2_toc': u'//h3', 'level3_toc': None, 'line_height': 0, 'linearize_tables': False, 'margin_bottom': 5.0, 'margin_left': 5.0, 'margin_right': 5.0, 'margin_top': 5.0, 'markup_chapter_headings': True, 'max_levels': 5, 'max_toc_links': 50, 'minimum_line_height': 120.0, 'no_chapters_in_toc': False, 'no_default_epub_cover': False, 'no_inline_navbars': False, 'no_svg_cover': False, 'output_profile': <calibre.customize.profiles.OutputProfile object at 0x10ef22dd0>, 'page_breaks_before': "//*[name()='h1' or name()='h2']", 'prefer_metadata_cover': False, 'preserve_cover_aspect_ratio': False, 'pretty_print': True, 'pubdate': None, 'publisher': None, 'rating': None, 'read_metadata_from_opf': None, 'remove_fake_margins': True, 'remove_first_image': False, 'remove_paragraph_spacing': False, 'remove_paragraph_spacing_indent_size': 1.5, 'renumber_headings': True, 'replace_scene_breaks': '', 'search_replace': None, 'series': None, 'series_index': None, 'smarten_punctuation': False, 'sr1_replace': '', 'sr1_search': '', 'sr2_replace': '', 'sr2_search': '', 'sr3_replace': '', 'sr3_search': '', 'start_reading_at': None, 'subset_embedded_fonts': False, 'tags': None, 'timestamp': None, 'title': None, 'title_sort': None, 'toc_filter': None, 'toc_threshold': 6, 'toc_title': None, 'unsmarten_punctuation': False, 'unwrap_lines': True, 'use_auto_toc': False, 'verbose': 2} 1% Converting input to HTML... InputFormatPlugin: HTML Input running on /Users/iliakan/Downloads/2.html Language not specified Creator not specified Building file list... Found files... HTMLFile:0:a:/Users/iliakan/Downloads/2.html Normalizing filename cases Rewriting HTML links Parsing 2.html ... Forcing 2.html into XHTML namespace 34% Running transforms on ebook... Merging user specified metadata... Detecting structure... Auto generated TOC with 0 entries. Flattening CSS and remapping font sizes... Source base font size is 14.04000pt Removing fake margins... Cleaning up manifest... Trimming unused files from manifest... Creating EPUB Output... 67% Running EPUB Output plugin Splitting markup on page breaks and flow limits, if any... Splitting on page-break at id=calibre_pb_0 Splitting on page-break at id=calibre_pb_1 Looking for large trees in 2.html... No large trees found Split into 2 parts Generating default cover This EPUB file has no Table of Contents. Creating a default TOC EPUB output written to /Users/iliakan/Downloads/2.epub Output saved to /Users/iliakan/Downloads/2.epub P.S. I also tried --chapter "//*[((name()='h2' or name()='h3') and re:test(., '.*', 'i'))]", it worked, but generated a plain TOC, not a nested one. I tried a number of other ways. The file is so simple, it just must work. |
![]() |
![]() |
![]() |
#2 |
Member
![]() Posts: 17
Karma: 10
Join Date: Jan 2015
Device: iphone 6
|
P.S. The actual title should be "html does not generate TOC", sorry, somehow it got cut.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,221
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You forgot the h: prefix
|
![]() |
![]() |
![]() |
#4 |
Member
![]() Posts: 17
Karma: 10
Join Date: Jan 2015
Device: iphone 6
|
Thanks a lot, Kovid! Magically, it worked!
By the way, why the h: prefix? In Chrome and Firefox, I just use XPath //h2 and it works. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to generate nested toc.ncx with more than 6 levels? | Tom Wiser | Sigil | 20 | 08-21-2017 05:28 PM |
Can't tell ebook-convert to NOT generate inline TOC for Mobi | EliW | Conversion | 17 | 05-10-2013 11:08 AM |
generate TOC duplicates puzzle | cybmole | Calibre | 14 | 01-09-2011 07:01 PM |
can't generate a toc from an html file | p3aul | Calibre | 13 | 08-27-2010 05:44 AM |
How not to auto-generate TOC in Calibre -setting? | Jundle | Calibre | 0 | 05-05-2010 02:53 AM |