29decibel / kindler

Kindle mobi format ebook generator
http://29decibel.github.com/kindler
22 stars 9 forks source link

How to generate a multi-section ebook? #5

Open felixding opened 10 years ago

felixding commented 10 years ago

First of all thank you for the great work!

I'm trying to generate a ebook looking like this:

dsc_0309

But now I can only get this (only 1 section):

screen shot 2014-10-04 at 10 43 44 am

Here is the code:

book = Kindler::Book.new title: title
book.mobi_type = :magzine
Article.all.each do |article|
  opts = {
      title: article.title,
      author: article.body[:author],
      content: article.body[:content],
      section: article.section
  }
  book.add_article(opts)
end

book.generate
29decibel commented 10 years ago

Hi @felixding I am not paying attention to this project for a while, could you tell me if the article has different section?

TheNotary commented 8 years ago

Hi @29decibel, I think what he was getting at was the fact that there was only one section named "readability", when there should probably have been more sections. I'm having trouble making multi-section, magzine style mobi files too actually. Here's an example gist:

https://gist.github.com/TheNotary/514f1fb39637a520113b

That should make a TOC with sections labeled news and stories, but instead the output is the article names. I haven't dug into the code too deep yet, but I think the template may need to be modified to support TOCs with sections for many different articles to be dropped into.

Would you have time for a PR in the near future? Btw, thanks for putting this gem together!