Code Monkey home page Code Monkey logo

Comments (6)

borisdaeppen avatar borisdaeppen commented on July 26, 2024

First thing I noticed: This is throwing an error with my perl 5.18.2

$mobi->debug_on(&debug);

This works:

$mobi->debug_on(\&debug);

from ebook--mobi.

borisdaeppen avatar borisdaeppen commented on July 26, 2024

Your code example gives me this:

EBook::MOBI DEBUG mode on
EBook::MOBI generating TOC...
EBook::MOBI::Mhtml2Mobi DEBUG mode on
EBook::MOBI::Mhtml2Mobi Storing HTML in the mobi format at record 1
<html>
<head>
<guide>
<reference type="toc" title="Table of Contents" filepos="00000186"/>
</guide>
</head>
<body>
<h2>Head1 not in TOC</h2>
hello world<br />
more text<mbp:pagebreak />
<h1>Table of Contents</h1><!-- TOC start -->
<p><ul>
</ul></p>

<mbp:pagebreak />
<h2>Head 2 page 2 in TOC</h2>
<p>some paragraph text</p>
<mbp:pagebreak />
<h4>Head 4 page 3 in TOC</h4>
<p>some paragraph text</p>
plain content<mbp:pagebreak />
</body>
</html>

This seems like a reasonable output at the first glance.
I used perl 5.18.2 and EBook::MOBI 0.67

from ebook--mobi.

kimryan avatar kimryan commented on July 26, 2024

Yes, but the list for TOC is empty

Table of Contents

    It seems to not be placing the text content in the TOC when I create a title with $mobi->add_mhtml_content($c->title('Head1 not in TOC', 2,0) );

    from ebook--mobi.

    borisdaeppen avatar borisdaeppen commented on July 26, 2024

    The TOC so far can only handle level one titles. So if you use level one titles like

    $c->title('Head 2 page 2 in TOC', 1,0)
    

    it will work:

    <h1>Table of Contents</h1><!-- TOC start -->
    <p><ul>
    <li><a filepos="00000342">Head 2 page 2 in TOC</a></li><!-- TOC entry -->
    </ul></p>
    

    from ebook--mobi.

    kimryan avatar kimryan commented on July 26, 2024

    OK thanks, all working for me now. Perhaps a comment is needed in the documentation for the add_toc_once method to indicate that you need to create level 1 headers (a h1 HTML tag) for any entries to go into the TOC.

    from ebook--mobi.

    borisdaeppen avatar borisdaeppen commented on July 26, 2024

    It is already documented. But i made it bold now in commit b5ffde9

    from ebook--mobi.

    Related Issues (20)

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ā¤ļø Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.