kindler
kindler copied to clipboard
How to generate a multi-section ebook?
First of all thank you for the great work!
I'm trying to generate a ebook looking like this:
But now I can only get this (only 1 section):
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
Hi @felixding I am not paying attention to this project for a while, could you tell me if the article has different section?
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!