Pages

Thursday, 20 May 2021

Kindler


Kindle mobi format ebook generator.(基于ruby)

29decibel.github.com/kindler

Code Climate

Todo

  • support inner reference, inner link can take to that article
  • refactor templates
  • fix image download

Is this gem what you want?

There is an alternative gem called kindlerb can generate mobi books, the gem is also used for the website KindleFeeder which is built by Daniel Choi.

If you like to generate mobi book by some html files, you have to conform to the structure which author provide. But if you just want to generate mobi book in the fly, then you should try this gem.

BTW, we share the same internal way to generating mobi book by KindleGen 2.

Prerequisite

  1. kindlegen execute file from amazon
  2. imagemagick exist
  3. that's all

Installation

gem 'kindler'

or

gem 'kindler',:git=>'git@github.com:29decibel/kindler.git'

A kindle mobi book generator

which receive a couple of urls then output one mobi file

Usage

title = 'my_first_mobi_book'
book = Kindler::Book.new :title=>title,:author=>'mike'
# add one article
book.add_article {
  :title    =>  'page1',
  :author   =>  'mike1',
  :content  =>  'this is the page 1',
  :section  =>  'love' }
# add another article
book.add_article {
  :title    =>  'page2',
  :author   =>  'mike1',
  :content  =>  'this is the page 2',
  :section  =>  'hate' }
# add an article contains image
book.add_article {
  :title    =>  'page_with_image',
  :author   =>  'mike1',
  :content  =>  '<img src="http://media2.glamour-sales.com.cn/media/catalog/category/Stroili_banner_02.jpg"></img>this is the page 3',
  :section  =>  'hate' }
# you will get my_first_mobi_book.mobi file
book.generate

#or you can just generate simple mobi book
book.mobi_type = :flat
book.generate

Keep Reading!

from https://github.com/29decibel/kindler 

 

No comments:

Post a Comment