book_utils 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in book_utils.gemspec
4
+ gemspec
data/README ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0"?>
2
+ <container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
3
+ <rootfiles>
4
+ <rootfile full-path="OEBPS/content.opf"
5
+ media-type="application/oebps-package+xml" />
6
+ </rootfiles>
7
+ </container>
Binary file
@@ -0,0 +1,158 @@
1
+ Bergamo-Std:
2
+
3
+ This typeface software ("SOFTWARE") is the property of FontSite Inc. Its
4
+ use by you is covered under the terms of an End-User License Agreement
5
+ ("EULA"). By exercising your rights to make and use copies of this SOFTWARE,
6
+ you agree to be bound by the terms of this EULA. If you do not agree to the
7
+ terms of this EULA, you may not use the SOFTWARE.
8
+
9
+ This SOFTWARE is a valuable asset of FontSite Inc. which is protected by
10
+ copyright laws and international copyright treaties, as well as other
11
+ intellectual property laws and treaties. The typeface software is licensed,
12
+ not sold.
13
+
14
+ This EULA grants you the following rights:
15
+
16
+ You may install and use an unlimited number of copies of this SOFTWARE.
17
+
18
+ You may reproduce and distribute an unlimited number of copies of this
19
+ SOFTWARE, provided that each copy shall be a true and complete copy,
20
+ including all copyright and trademark notices, electronic documentation
21
+ (user guide in PDF format, etc.), and shall be accompanied by a copy of this
22
+ EULA. Copies of the SOFTWARE may not be distributed for profit either on a
23
+ standalone basis or included as part of your own product.
24
+
25
+
26
+ -----
27
+
28
+ OFL-Sorts-Mill-Goudy:
29
+
30
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
31
+ This license is copied below, and is also available with a FAQ at:
32
+ http://scripts.sil.org/OFL
33
+
34
+
35
+ -----------------------------------------------------------
36
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
37
+ -----------------------------------------------------------
38
+
39
+ PREAMBLE
40
+ The goals of the Open Font License (OFL) are to stimulate worldwide
41
+ development of collaborative font projects, to support the font creation
42
+ efforts of academic and linguistic communities, and to provide a free and
43
+ open framework in which fonts may be shared and improved in partnership
44
+ with others.
45
+
46
+ The OFL allows the licensed fonts to be used, studied, modified and
47
+ redistributed freely as long as they are not sold by themselves. The
48
+ fonts, including any derivative works, can be bundled, embedded,
49
+ redistributed and/or sold with any software provided that any reserved
50
+ names are not used by derivative works. The fonts and derivatives,
51
+ however, cannot be released under any other type of license. The
52
+ requirement for fonts to remain under this license does not apply
53
+ to any document created using the fonts or their derivatives.
54
+
55
+ DEFINITIONS
56
+ "Font Software" refers to the set of files released by the Copyright
57
+ Holder(s) under this license and clearly marked as such. This may
58
+ include source files, build scripts and documentation.
59
+
60
+ "Reserved Font Name" refers to any names specified as such after the
61
+ copyright statement(s).
62
+
63
+ "Original Version" refers to the collection of Font Software components as
64
+ distributed by the Copyright Holder(s).
65
+
66
+ "Modified Version" refers to any derivative made by adding to, deleting,
67
+ or substituting -- in part or in whole -- any of the components of the
68
+ Original Version, by changing formats or by porting the Font Software to a
69
+ new environment.
70
+
71
+ "Author" refers to any designer, engineer, programmer, technical
72
+ writer or other person who contributed to the Font Software.
73
+
74
+ PERMISSION & CONDITIONS
75
+ Permission is hereby granted, free of charge, to any person obtaining
76
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
77
+ redistribute, and sell modified and unmodified copies of the Font
78
+ Software, subject to the following conditions:
79
+
80
+ 1) Neither the Font Software nor any of its individual components,
81
+ in Original or Modified Versions, may be sold by itself.
82
+
83
+ 2) Original or Modified Versions of the Font Software may be bundled,
84
+ redistributed and/or sold with any software, provided that each copy
85
+ contains the above copyright notice and this license. These can be
86
+ included either as stand-alone text files, human-readable headers or
87
+ in the appropriate machine-readable metadata fields within text or
88
+ binary files as long as those fields can be easily viewed by the user.
89
+
90
+ 3) No Modified Version of the Font Software may use the Reserved Font
91
+ Name(s) unless explicit written permission is granted by the corresponding
92
+ Copyright Holder. This restriction only applies to the primary font name as
93
+ presented to the users.
94
+
95
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
96
+ Software shall not be used to promote, endorse or advertise any
97
+ Modified Version, except to acknowledge the contribution(s) of the
98
+ Copyright Holder(s) and the Author(s) or with their explicit written
99
+ permission.
100
+
101
+ 5) The Font Software, modified or unmodified, in part or in whole,
102
+ must be distributed entirely under this license, and must not be
103
+ distributed under any other license. The requirement for fonts to
104
+ remain under this license does not apply to any document created
105
+ using the Font Software.
106
+
107
+ TERMINATION
108
+ This license becomes null and void if any of the above conditions are
109
+ not met.
110
+
111
+ DISCLAIMER
112
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
113
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
114
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
115
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
116
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
117
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
118
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
119
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
120
+ OTHER DEALINGS IN THE FONT SOFTWARE.
121
+
122
+
123
+
124
+ -----
125
+
126
+ TeX Gyre (Pagella and Termes):
127
+
128
+
129
+ This is a preliminary version (2006-09-30), barring acceptance from
130
+ the LaTeX Project Team and other feedback, of the GUST Font License.
131
+ (GUST is the Polish TeX Users Group, http://www.gust.org.pl)
132
+
133
+ For the most recent version of this license see
134
+ http://www.gust.org.pl/fonts/licenses/GUST-FONT-LICENSE.txt
135
+ or
136
+ http://tug.org/fonts/licenses/GUST-FONT-LICENSE.txt
137
+
138
+ This work may be distributed and/or modified under the conditions
139
+ of the LaTeX Project Public License, either version 1.3c of this
140
+ license or (at your option) any later version.
141
+
142
+ Please also observe the following clause:
143
+ 1) it is requested, but not legally required, that derived works be
144
+ distributed only after changing the names of the fonts comprising this
145
+ work and given in an accompanying "manifest", and that the
146
+ files comprising the Work, as listed in the manifest, also be given
147
+ new names. Any exceptions to this request are also given in the
148
+ manifest.
149
+
150
+ We recommend the manifest be given in a separate file named
151
+ MANIFEST-<fontid>.txt, where <fontid> is some unique identification
152
+ of the font family. If a separate "readme" file accompanies the Work,
153
+ we recommend a name of the form README-<fontid>.txt.
154
+
155
+ The latest version of the LaTeX Project Public License is in
156
+ http://www.latex-project.org/lppl.txt and version 1.3c or later
157
+ is part of all distributions of LaTeX version 2006/05/20 or later.
158
+
@@ -0,0 +1,127 @@
1
+ /* A Few Fonts
2
+ * -----------
3
+ *
4
+ * There are many ways to embed fonts for different browsers.
5
+ * For the sake of simplicity, I'm including the most correct way. As such,
6
+ * these, fonts might not work for all browsers, but they should fall back
7
+ * properly.
8
+ *
9
+ * See: http://www.metaltoad.com/blog/how-use-font-face-avoid-faux-italic-and-bold-browser-styles
10
+ */
11
+
12
+
13
+
14
+ /* OFL Sorts Mill Goudy */
15
+
16
+ @font-face {
17
+ font-family: 'OFL Sorts Mill Goudy';
18
+ font-style: normal;
19
+ font-weight: normal;
20
+ src: url("fonts/OFL Sorts Mill GoudyStM.otf");
21
+ }
22
+
23
+ @font-face {
24
+ font-family: 'OFL Sorts Mill Goudy';
25
+ font-style: italic;
26
+ font-weight: normal;
27
+ src: url("fonts/OFL Sorts Mill GoudyStM-Italic.otf");
28
+ }
29
+
30
+
31
+
32
+ /* Bergamo Std */
33
+
34
+ @font-face {
35
+ font-family: 'Bergamo Std';
36
+ font-style: normal;
37
+ font-weight: normal;
38
+ src: url("fonts/BergamoStd-Regular.otf");
39
+ }
40
+
41
+ @font-face {
42
+ font-family: 'Bergamo Std';
43
+ font-style: italic;
44
+ font-weight: normal;
45
+ src: url("fonts/BergamoStd-Italic.otf");
46
+ }
47
+
48
+ @font-face {
49
+ font-family: 'Bergamo Std';
50
+ font-style: normal;
51
+ font-weight: bold;
52
+ src: url("fonts/BergamoStd-Bold.otf");
53
+ }
54
+
55
+ @font-face {
56
+ font-family: 'Bergamo Std';
57
+ font-style: italic;
58
+ font-weight: bold;
59
+ src: url("fonts/BergamoStd-BoldItalic.otf");
60
+ }
61
+
62
+
63
+
64
+
65
+
66
+ /* TeX Gyre Pagella */
67
+
68
+ @font-face {
69
+ font-family: 'TeX Gyre Pagella';
70
+ font-style: normal;
71
+ font-weight: normal;
72
+ src: url("fonts/texgyrepagella-regular.otf");
73
+ }
74
+
75
+ @font-face {
76
+ font-family: 'TeX Gyre Pagella';
77
+ font-style: italic;
78
+ font-weight: normal;
79
+ src: url("fonts/texgyrepagella-italic.otf");
80
+ }
81
+
82
+ @font-face {
83
+ font-family: 'TeX Gyre Pagella';
84
+ font-style: normal;
85
+ font-weight: bold;
86
+ src: url("fonts/texgyrepagella-bold.otf");
87
+ }
88
+
89
+ @font-face {
90
+ font-family: 'TeX Gyre Pagella';
91
+ font-style: italic;
92
+ font-weight: bold;
93
+ src: url("fonts/texgyrepagella-bolditalic.otf");
94
+ }
95
+
96
+
97
+
98
+ /* TeX Gyre Termes */
99
+
100
+ @font-face {
101
+ font-family: 'TeX Gyre Termes';
102
+ font-style: normal;
103
+ font-weight: normal;
104
+ src: url("fonts/texgyretermes-regular.otf");
105
+ }
106
+
107
+ @font-face {
108
+ font-family: 'TeX Gyre Termes';
109
+ font-style: italic;
110
+ font-weight: normal;
111
+ src: url("fonts/texgyretermes-italic.otf");
112
+ }
113
+
114
+ @font-face {
115
+ font-family: 'TeX Gyre Termes';
116
+ font-style: normal;
117
+ font-weight: bold;
118
+ src: url("fonts/texgyretermes-bold.otf");
119
+ }
120
+
121
+ @font-face {
122
+ font-family: 'TeX Gyre Termes';
123
+ font-style: italic;
124
+ font-weight: bold;
125
+ src: url("fonts/texgyretermes-bolditalic.otf");
126
+ }
127
+
@@ -0,0 +1,4 @@
1
+ h1 { font-size: 13pt; }
2
+ h2 { font-size: 12pt; }
3
+ h3 { font-size: 11pt; }
4
+ p { font-size: 10.5pt; }
@@ -0,0 +1,82 @@
1
+ /* Most of this CSS is by Jason LaPier:
2
+ * http://openbookfiction.com
3
+ *
4
+ * other great resources:
5
+ * http://epubzengarden.com/
6
+ * http://www.fontsquirrel.com/
7
+ * http://blog.threepress.org/
8
+ */
9
+
10
+ #content {
11
+ background-color: white;
12
+ color: black;
13
+ font-family: 'TeX Gyre Termes', serif;
14
+ text-align: justify;
15
+ }
16
+
17
+ #content h1, #content h2, #content h3 {
18
+ text-align: right;
19
+ font-family: sans-serif;
20
+ }
21
+
22
+ #content h1 {
23
+ border-bottom: 1px solid black;
24
+ margin: 2em 0em;
25
+ font-variant: small-caps;
26
+ }
27
+
28
+ /*
29
+ #content h1 { text-transform:uppercase }
30
+ */
31
+
32
+ #content h3 {
33
+ font-style: italic;
34
+ }
35
+
36
+ blockquote {
37
+ margin-left: 5em;
38
+ margin-right: 5em;
39
+ }
40
+
41
+ blockquote .attribution {
42
+ display: block;
43
+ text-align: right;
44
+ }
45
+
46
+ p {
47
+ text-indent: 1em;
48
+ text-align: justify;
49
+ margin: 0;
50
+ clear:both;
51
+ }
52
+
53
+ p.first, p.noindent, blockquote p, h1 + p, h2 + p, h3 + p {
54
+ text-indent: 0;
55
+ margin-top: 1em;
56
+ clear:both;
57
+ }
58
+
59
+ h1 + p:first-line, h2 + p:first-line, h3 + p:first-line {
60
+ font-variant: small-caps;
61
+ }
62
+
63
+ /*
64
+ h2 + p:first-letter, h1 + p:first-letter {
65
+ font-size: 2.5em;
66
+ font-weight: bold;
67
+ }
68
+ */
69
+
70
+ em { font-style: italic; }
71
+ em em { font-style: normal; }
72
+
73
+ strong { font-weight: bold; }
74
+ strong strong { font-weight: normal; }
75
+
76
+ .smaller p {
77
+ font-size: 8pt;
78
+ text-indent: 0;
79
+ text-align:left;
80
+ margin-bottom: 1em;
81
+ font-family: 'TeX Gyre Termes', serif;
82
+ }
data/assets/mimetype ADDED
@@ -0,0 +1 @@
1
+ application/epub+zip
@@ -0,0 +1,64 @@
1
+ <?xml version='1.0' encoding='utf-8'?>
2
+ <package xmlns="http://www.idpf.org/2007/opf"
3
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
4
+ unique-identifier="bookid" version="2.0">
5
+ <metadata>
6
+ <dc:title><%= title %></dc:title>
7
+ <dc:creator>Alex Vakhov</dc:creator>
8
+ <dc:identifier id="bookid">urn:uuid:a4ea6f00-8bcd-012e-1448-0013a97f1781</dc:identifier>
9
+ <dc:language>en-US</dc:language>
10
+ <dc:date>2011-07-09</dc:date>
11
+ <dc:rights>http://creativecommons.org/licenses/by-nc-nd/3.0/</dc:rights>
12
+ <meta name="cover" content="cover-image" />
13
+ </metadata>
14
+ <manifest>
15
+ <item id="cover" href="title.html" media-type="application/xhtml+xml"/>
16
+ <% files.each do |file| %>
17
+ <item id="<%= file.gsub(".", "_") %>" href="<%= file %>.html" media-type="application/xhtml+xml"/>
18
+ <% end %>
19
+
20
+ <item id="css_print.css" href="print.css" media-type="text/css"/>
21
+
22
+ <item id="css_stylesheet.css" href="stylesheet.css" media-type="text/css"/>
23
+
24
+ <item id="css_fonts.css" href="fonts.css" media-type="text/css"/>
25
+
26
+
27
+ <item id="font_BergamoStd-Regular.otf" href="fonts/BergamoStd-Regular.otf" media-type="application/x-font-opentype"/>
28
+
29
+ <item id="font_texgyrepagella-regular.otf" href="fonts/texgyrepagella-regular.otf" media-type="application/x-font-opentype"/>
30
+
31
+ <item id="font_licenses.txt" href="fonts/licenses.txt" media-type="application/x-font-opentype"/>
32
+
33
+ <item id="font_texgyretermes-bolditalic.otf" href="fonts/texgyretermes-bolditalic.otf" media-type="application/x-font-opentype"/>
34
+
35
+ <item id="font_texgyrepagella-bold.otf" href="fonts/texgyrepagella-bold.otf" media-type="application/x-font-opentype"/>
36
+
37
+ <item id="font_texgyretermes-bold.otf" href="fonts/texgyretermes-bold.otf" media-type="application/x-font-opentype"/>
38
+
39
+ <item id="font_OFLGoudyStM.otf" href="fonts/OFLGoudyStM.otf" media-type="application/x-font-opentype"/>
40
+
41
+ <item id="font_BergamoStd-Italic.otf" href="fonts/BergamoStd-Italic.otf" media-type="application/x-font-opentype"/>
42
+
43
+ <item id="font_texgyrepagella-italic.otf" href="fonts/texgyrepagella-italic.otf" media-type="application/x-font-opentype"/>
44
+
45
+ <item id="font_texgyrepagella-bolditalic.otf" href="fonts/texgyrepagella-bolditalic.otf" media-type="application/x-font-opentype"/>
46
+
47
+ <item id="font_texgyretermes-italic.otf" href="fonts/texgyretermes-italic.otf" media-type="application/x-font-opentype"/>
48
+
49
+ <item id="font_BergamoStd-Bold.otf" href="fonts/BergamoStd-Bold.otf" media-type="application/x-font-opentype"/>
50
+
51
+ <item id="font_OFLGoudyStM-Italic.otf" href="fonts/OFLGoudyStM-Italic.otf" media-type="application/x-font-opentype"/>
52
+
53
+ <item id="font_texgyretermes-regular.otf" href="fonts/texgyretermes-regular.otf" media-type="application/x-font-opentype"/>
54
+
55
+ <item id="font_BergamoStd-BoldItalic.otf" href="fonts/BergamoStd-BoldItalic.otf" media-type="application/x-font-opentype"/>
56
+
57
+ </manifest>
58
+ <spine toc="ncx">
59
+ <itemref idref="cover" linear="yes"/>
60
+ <% files.each do |file| %>
61
+ <itemref idref="<%= file.gsub(".", "_") %>"/>
62
+ <% end %>
63
+ </spine>
64
+ </package>
@@ -0,0 +1,12 @@
1
+ <html xmlns="http://www.w3.org/1999/xhtml">
2
+ <head>
3
+ <title></title>
4
+ <link rel="stylesheet" href="stylesheet.css" type="text/css" media="all" />
5
+ <link rel="stylesheet" href="fonts.css" type="text/css" media="all" />
6
+ <link rel="stylesheet" href="print.css" type="text/css" media="print" />
7
+ </head>
8
+ <body>
9
+ <h1><%= title %></h1>
10
+ <h2>Alex Vakhov</h2>
11
+ </body>
12
+ </html>
@@ -0,0 +1,12 @@
1
+ <html xmlns="http://www.w3.org/1999/xhtml">
2
+ <head>
3
+ <title></title>
4
+ <link rel="stylesheet" href="stylesheet.css" type="text/css" media="all" />
5
+ <link rel="stylesheet" href="fonts.css" type="text/css" media="all" />
6
+ <link rel="stylesheet" href="print.css" type="text/css" media="print" />
7
+ </head>
8
+ <body>
9
+ <h2><%= file_name %></h2>
10
+ <%= body %>
11
+ </body>
12
+ </html>
data/bin/dir2epub ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $: << File.expand_path("../../lib", __FILE__)
4
+ require 'rubygems'
5
+ require 'book_utils/convert'
6
+
7
+ if ARGV.empty?
8
+ puts "Usage: "
9
+ puts " dir2epub <folder>"
10
+ puts ""
11
+ puts "GEM paths:"
12
+ Gem.path.each do |path|
13
+ puts " " + path
14
+ end
15
+ else
16
+ BookUtils::Convert.new(ARGV[0]).run
17
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "book_utils/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "book_utils"
7
+ s.version = BookUtils::VERSION
8
+ s.authors = ["Alexey Vakhov"]
9
+ s.email = ["vakhov@gmail.com"]
10
+ s.homepage = "https://github.com/avakhov/book_utils"
11
+ s.summary = %q{ebooks utils}
12
+ s.description = %q{my ebooks utils}
13
+
14
+ #s.rubyforge_project = "book_utils"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency('coderay', '~> 0.9')
22
+ end
@@ -0,0 +1,94 @@
1
+ require 'tmpdir'
2
+ require 'fileutils'
3
+ require 'erb'
4
+ require 'coderay'
5
+
6
+ module BookUtils
7
+ class Convert
8
+ def initialize(dir)
9
+ @dir = dir
10
+ end
11
+
12
+ def run
13
+ files = Dir[File.expand_path("**/*", @dir)].sort.reject{|a| File.directory?(a)}
14
+
15
+ Dir.mktmpdir do |path|
16
+ assets_dir = File.expand_path("../../../assets/", __FILE__)
17
+
18
+ # copy system files
19
+ FileUtils.cp_r("#{assets_dir}/META-INF", path)
20
+ FileUtils.cp_r("#{assets_dir}/OEBPS", path)
21
+ FileUtils.cp("#{assets_dir}/mimetype", path)
22
+
23
+ # colorize files
24
+ files = files.select do |file|
25
+ File.extname(file) == '.rb'
26
+ end
27
+
28
+ files.each do |file|
29
+ File.open(path + "/OEBPS/" + file_basename(file) + ".html", "w") do |f|
30
+ f.write colorize(file_basename(file), File.read(file))
31
+ end
32
+ end
33
+
34
+ # process ERB templates
35
+ %w(title.html.erb content.opf.erb).each do |template_name|
36
+ template = "#{assets_dir}/templates/#{template_name}"
37
+ File.open(path + "/OEBPS/" + File.basename(template, '.erb'), "w") do |f|
38
+ f.write process_template(File.read(template), File.basename(@dir), files.map{|f| file_basename(f)})
39
+ end
40
+ end
41
+
42
+ # zip book
43
+ Dir.chdir path do
44
+ system "zip -0Xq ebook.epub mimetype"
45
+ system "zip -Xr9Dq ebook.epub *"
46
+ end
47
+
48
+ # move to work directory
49
+ FileUtils.mv(path + "/ebook.epub", File.basename(@dir) + ".epub")
50
+ end
51
+ end
52
+
53
+ private
54
+ def process_template(template, title_, files_)
55
+ title = title_
56
+ files = files_
57
+
58
+ ERB.new(template).result(binding)
59
+ end
60
+
61
+ def colorize(file_name_, code)
62
+ wrapper = File.read(File.expand_path("../../../assets/templates/wrapper.html.erb", __FILE__))
63
+ body = CodeRay.
64
+ scan(code, :ruby).
65
+ html(:css => :style).
66
+ split("\n").
67
+ map{|line| "<div>" + indent(line) + "</div>"}.
68
+ join("\n")
69
+ file_name = file_name_
70
+
71
+ ERB.new(wrapper).result(binding)
72
+ end
73
+
74
+ def indent(line)
75
+ out = ""
76
+ while line[0..0] == ' '
77
+ out << '&nbsp;'*1
78
+ line = line[1..-1]
79
+ end
80
+
81
+ out += line
82
+
83
+ if out.empty?
84
+ '&nbsp;'
85
+ else
86
+ out
87
+ end
88
+ end
89
+
90
+ def file_basename(file)
91
+ file.sub(@dir, '').gsub("/", "_")
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,3 @@
1
+ module BookUtils
2
+ VERSION = "0.0.1"
3
+ end
data/lib/book_utils.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "book_utils/version"
2
+
3
+ module BookUtils
4
+ # Your code goes here...
5
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: book_utils
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Alexey Vakhov
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-07-13 00:00:00 +04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: coderay
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 25
30
+ segments:
31
+ - 0
32
+ - 9
33
+ version: "0.9"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: my ebooks utils
37
+ email:
38
+ - vakhov@gmail.com
39
+ executables:
40
+ - dir2epub
41
+ extensions: []
42
+
43
+ extra_rdoc_files: []
44
+
45
+ files:
46
+ - .gitignore
47
+ - Gemfile
48
+ - README
49
+ - Rakefile
50
+ - assets/META-INF/container.xml
51
+ - assets/OEBPS/fonts.css
52
+ - assets/OEBPS/fonts/BergamoStd-Bold.otf
53
+ - assets/OEBPS/fonts/BergamoStd-BoldItalic.otf
54
+ - assets/OEBPS/fonts/BergamoStd-Italic.otf
55
+ - assets/OEBPS/fonts/BergamoStd-Regular.otf
56
+ - assets/OEBPS/fonts/OFLGoudyStM-Italic.otf
57
+ - assets/OEBPS/fonts/OFLGoudyStM.otf
58
+ - assets/OEBPS/fonts/licenses.txt
59
+ - assets/OEBPS/fonts/texgyrepagella-bold.otf
60
+ - assets/OEBPS/fonts/texgyrepagella-bolditalic.otf
61
+ - assets/OEBPS/fonts/texgyrepagella-italic.otf
62
+ - assets/OEBPS/fonts/texgyrepagella-regular.otf
63
+ - assets/OEBPS/fonts/texgyretermes-bold.otf
64
+ - assets/OEBPS/fonts/texgyretermes-bolditalic.otf
65
+ - assets/OEBPS/fonts/texgyretermes-italic.otf
66
+ - assets/OEBPS/fonts/texgyretermes-regular.otf
67
+ - assets/OEBPS/print.css
68
+ - assets/OEBPS/stylesheet.css
69
+ - assets/mimetype
70
+ - assets/templates/content.opf.erb
71
+ - assets/templates/title.html.erb
72
+ - assets/templates/wrapper.html.erb
73
+ - bin/dir2epub
74
+ - book_utils.gemspec
75
+ - lib/book_utils.rb
76
+ - lib/book_utils/convert.rb
77
+ - lib/book_utils/version.rb
78
+ has_rdoc: true
79
+ homepage: https://github.com/avakhov/book_utils
80
+ licenses: []
81
+
82
+ post_install_message:
83
+ rdoc_options: []
84
+
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ hash: 3
93
+ segments:
94
+ - 0
95
+ version: "0"
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ requirements: []
106
+
107
+ rubyforge_project:
108
+ rubygems_version: 1.5.2
109
+ signing_key:
110
+ specification_version: 3
111
+ summary: ebooks utils
112
+ test_files: []
113
+