bookie 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -25,3 +25,9 @@ preformatted text. See examples/preformatted.rb for to see how it works.
25
25
  Reinstated a skeletal HTML emitter because it's needed for EPub and Mobi. Added
26
26
  pretty terrible Mobi support, will not really be useful until we flesh out
27
27
  manifests and table of content generation, but looks okay on my Kindle!
28
+
29
+ ## 0.0.6 (2011.04.26)
30
+
31
+ Added a minimal ePUB generator that seems to work at least for Adobe Digital
32
+ Editions and EPubReader. Still have not tested where it matters, the
33
+ iPad+iBooks.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Bookie: An ebook publishing toolchain in pure Ruby
1
+ # Bookie: An ebook publishing toolchain written mostly in Ruby
2
2
 
3
3
  While I have not looked especially far and wide, I haven't found a book
4
4
  publishing toolchain that I like which both has a nice workflow AND does not
@@ -22,9 +22,13 @@ PDF generation is provided by [Prawn](http::/prawn.majesticseacreature.com),
22
22
  ePUB from [eeepub](https://github.com/jugyo/eeepub), and MOBI via the command
23
23
  line tool [kindlegen](http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000234621).
24
24
 
25
- Prawn and eeepub are free software projects available via rubygems, kindlegen is
26
- free-as-in-beer proprietary software from Amazon that needs to be installed
27
- manually.
25
+ PDF can be generated out of the box after installing the bookie gem. For ePUB,
26
+ it's necessary to have the GNU zip command line utility present (preinstalled on
27
+ OS X and many linux distros, but you may need msys on Windows, not sure.). For
28
+ MOBI, you need to install kindlegen manually.
29
+
30
+ A long term goal for this project would be to eliminate most or all of these
31
+ non-ruby dependencies, but I want to get a working toolchain together first.
28
32
 
29
33
  ## Contributing
30
34
 
@@ -18,3 +18,8 @@ mobi_document = Bookie::Document.new(file, Bookie::Emitters::MOBI.new)
18
18
 
19
19
  mobi_document.render(title: "Ruby's Method Lookup Path",
20
20
  file: "output.mobi")
21
+
22
+ epub_document = Bookie::Document.new(file, Bookie::Emitters::EPUB.new)
23
+
24
+ epub_document.render(title: "Ruby's Method Lookup Path",
25
+ file: "output.epub")
data/lib/bookie.rb CHANGED
@@ -1,7 +1,9 @@
1
- require "tempfile"
1
+ require "date"
2
2
  require "fileutils"
3
+ require "tempfile"
3
4
 
4
5
  require "prawn"
6
+ require "eeepub"
5
7
 
6
8
  require_relative "bookie/version"
7
9
  require_relative "bookie/document"
@@ -34,6 +34,31 @@ module Bookie
34
34
  end
35
35
  end
36
36
 
37
+ class EPUB < HTML
38
+ def render(params)
39
+ t = Tempfile.new(params[:file])
40
+ t << %{<?xml version="1.0" encoding="UTF-8"?>
41
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
42
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
43
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
44
+ <body><h1>#{params[:title]}</h1>#{@body}</body>
45
+ </html>
46
+ }
47
+ t.close
48
+ FileUtils.mv(t.path, "#{t.path}.html")
49
+
50
+ epub = EeePub.make do
51
+ title params[:title]
52
+ identifier '', :scheme => 'URL'
53
+ uid ''
54
+
55
+ files [File.expand_path("#{t.path}.html")]
56
+ end
57
+
58
+ epub.save(params[:file])
59
+ end
60
+ end
61
+
37
62
  class MOBI < HTML
38
63
  def render(params)
39
64
  t = Tempfile.new(params[:file])
@@ -1,3 +1,3 @@
1
1
  module Bookie
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: bookie
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.5
5
+ version: 0.0.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Gregory Brown
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-24 00:00:00 -04:00
13
+ date: 2011-04-26 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -24,6 +24,17 @@ dependencies:
24
24
  version: 0.11.0
25
25
  type: :runtime
26
26
  version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: eeepub
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ~>
34
+ - !ruby/object:Gem::Version
35
+ version: 0.6.0
36
+ type: :runtime
37
+ version_requirements: *id002
27
38
  description: Eventually this may be a markdown to PDF, ePUB, MOBI processor. For now it's just something I'm playing around with, so use at your own risk
28
39
  email:
29
40
  - gregory.t.brown@gmail.com