rpub 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -1
- data/.rspec +0 -1
- data/.travis.yml +3 -4
- data/.yardopts +1 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +70 -46
- data/Guardfile +6 -0
- data/HISTORY.md +10 -0
- data/README.md +1 -1
- data/Rakefile +7 -2
- data/bin/rpub +64 -1
- data/doc/.gitignore +8 -0
- data/doc/api/Rpub.html +339 -0
- data/doc/api/Rpub/Book.html +983 -0
- data/doc/api/Rpub/Chapter.html +737 -0
- data/doc/api/Rpub/Command.html +356 -0
- data/doc/api/Rpub/Commands.html +117 -0
- data/doc/api/Rpub/Commands/Clean.html +216 -0
- data/doc/api/Rpub/Commands/Compile.html +218 -0
- data/doc/api/Rpub/Commands/Generate.html +242 -0
- data/doc/api/Rpub/Commands/Package.html +230 -0
- data/doc/api/Rpub/Commands/Preview.html +216 -0
- data/doc/api/Rpub/Commands/Stats.html +226 -0
- data/doc/api/Rpub/Compressor.html +687 -0
- data/doc/api/Rpub/Context.html +553 -0
- data/doc/api/Rpub/Document.html +647 -0
- data/doc/api/Rpub/Document/OutlineElement.html +388 -0
- data/doc/api/Rpub/Epub.html +465 -0
- data/doc/api/Rpub/Epub/Container.html +224 -0
- data/doc/api/Rpub/Epub/Content.html +344 -0
- data/doc/api/Rpub/Epub/Cover.html +236 -0
- data/doc/api/Rpub/Epub/HtmlToc.html +240 -0
- data/doc/api/Rpub/Epub/Toc.html +244 -0
- data/doc/api/Rpub/FilesystemSource.html +544 -0
- data/doc/api/Rpub/HashDelegation.html +281 -0
- data/doc/api/Rpub/HashDelegation/ClassMethods.html +175 -0
- data/doc/api/Rpub/MediaType.html +192 -0
- data/doc/api/Rpub/Preview.html +464 -0
- data/doc/api/Rpub/XmlFile.html +457 -0
- data/doc/api/_index.html +405 -0
- data/doc/api/class_list.html +54 -0
- data/doc/api/css/common.css +1 -0
- data/doc/api/css/full_list.css +57 -0
- data/doc/api/css/style.css +339 -0
- data/doc/api/file.HISTORY.html +131 -0
- data/doc/api/file.LICENSE.html +92 -0
- data/doc/api/file.README.html +337 -0
- data/doc/api/file_list.html +62 -0
- data/doc/api/frames.html +26 -0
- data/doc/api/index.html +337 -0
- data/doc/api/js/app.js +219 -0
- data/doc/api/js/full_list.js +178 -0
- data/doc/api/js/jquery.js +4 -0
- data/doc/api/method_list.html +533 -0
- data/doc/api/top-level-namespace.html +112 -0
- data/doc/index.html +312 -0
- data/doc/javascripts/scale.fix.js +17 -0
- data/doc/params.json +1 -0
- data/doc/stylesheets/pygment_trac.css +69 -0
- data/doc/stylesheets/styles.css +255 -0
- data/features/clean.feature +31 -0
- data/features/compile.feature +49 -0
- data/features/embedded_assets.feature +51 -0
- data/features/generate.feature +63 -0
- data/features/layout.feature +41 -0
- data/features/package.feature +30 -0
- data/features/previews.feature +66 -0
- data/features/stats.feature +18 -0
- data/features/step_definitions/general_steps.rb +60 -0
- data/features/styles.feature +33 -0
- data/features/support/env.rb +7 -0
- data/features/table_of_contents.feature +35 -0
- data/lib/rpub.rb +28 -31
- data/lib/rpub/book.rb +9 -16
- data/lib/rpub/chapter.rb +4 -54
- data/lib/rpub/command.rb +32 -0
- data/lib/rpub/commands/clean.rb +4 -49
- data/lib/rpub/commands/compile.rb +4 -49
- data/lib/rpub/commands/generate.rb +10 -67
- data/lib/rpub/commands/package.rb +9 -37
- data/lib/rpub/commands/preview.rb +4 -54
- data/lib/rpub/commands/stats.rb +6 -10
- data/lib/rpub/compressor.rb +3 -3
- data/lib/rpub/context.rb +48 -0
- data/lib/rpub/document.rb +68 -0
- data/lib/rpub/epub.rb +8 -7
- data/lib/rpub/epub/content.rb +9 -30
- data/lib/rpub/epub/cover.rb +1 -8
- data/lib/rpub/epub/html_toc.rb +4 -9
- data/lib/rpub/epub/toc.rb +16 -13
- data/lib/rpub/filesystem_source.rb +47 -0
- data/lib/rpub/media_type.rb +16 -0
- data/lib/rpub/preview.rb +29 -0
- data/lib/rpub/version.rb +1 -1
- data/lib/rpub/xml_file.rb +4 -1
- data/rpub.gemspec +6 -7
- data/spec/rpub/book_spec.rb +45 -45
- data/spec/rpub/chapter_spec.rb +87 -22
- data/spec/rpub/epub/container_spec.rb +3 -5
- data/spec/rpub/epub/content_spec.rb +62 -41
- data/spec/rpub/epub/cover_spec.rb +3 -5
- data/spec/rpub/epub/html_toc_spec.rb +8 -8
- data/spec/rpub/epub/toc_spec.rb +20 -22
- data/spec/rpub_spec.rb +1 -3
- data/spec/spec_helper.rb +28 -0
- data/support/config.yml +1 -0
- data/support/styles.css +3 -3
- metadata +131 -120
- data/lib/rpub/commander.rb +0 -23
- data/lib/rpub/commands/base.rb +0 -33
- data/lib/rpub/commands/help.rb +0 -37
- data/lib/rpub/commands/main.rb +0 -45
- data/lib/rpub/compilation_helpers.rb +0 -73
- data/lib/rpub/subclass_tracker.rb +0 -53
- data/spec/rpub/commands/clean_spec.rb +0 -46
- data/spec/rpub/commands/generate_spec.rb +0 -52
- data/spec/rpub/commands/main_spec.rb +0 -26
- data/spec/rpub/commands/package_spec.rb +0 -33
- data/spec/rpub/commands/preview_spec.rb +0 -43
@@ -0,0 +1,112 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Top Level Namespace
|
8
|
+
|
9
|
+
— Rpub, a simple ePub generator library in Ruby
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!top-level-namespace.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">Top Level Namespace</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Top Level Namespace
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
</dl>
|
82
|
+
<div class="clear"></div>
|
83
|
+
|
84
|
+
<h2>Defined Under Namespace</h2>
|
85
|
+
<p class="children">
|
86
|
+
|
87
|
+
|
88
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Rpub.html" title="Rpub (module)">Rpub</a></span>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
</p>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
<div id="footer">
|
106
|
+
Generated on Thu Aug 14 19:54:32 2014 by
|
107
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
|
+
0.8.7.4 (ruby-2.1.2).
|
109
|
+
</div>
|
110
|
+
|
111
|
+
</body>
|
112
|
+
</html>
|
data/doc/index.html
ADDED
@@ -0,0 +1,312 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
6
|
+
<title>Rpub by avdgaag</title>
|
7
|
+
|
8
|
+
<link rel="stylesheet" href="stylesheets/styles.css">
|
9
|
+
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
11
|
+
<!--[if lt IE 9]>
|
12
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
13
|
+
<![endif]-->
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<div class="wrapper">
|
17
|
+
<header>
|
18
|
+
<h1>Rpub</h1>
|
19
|
+
<p>an ePub generation library in Ruby</p>
|
20
|
+
<p class="view"><a href="https://github.com/avdgaag/rpub">View the Project on GitHub <small>avdgaag/rpub</small></a></p>
|
21
|
+
<p class="view"><a href="https://avdgaag.github.com/rpub/api">View the API docs <small>rpub/api</small></a></p>
|
22
|
+
<ul>
|
23
|
+
<li><a href="https://github.com/avdgaag/rpub/zipball/master">Download <strong>ZIP File</strong></a></li>
|
24
|
+
<li><a href="https://github.com/avdgaag/rpub/tarball/master">Download <strong>TAR Ball</strong></a></li>
|
25
|
+
<li><a href="https://github.com/avdgaag/rpub">Fork On <strong>GitHub</strong></a></li>
|
26
|
+
</ul>
|
27
|
+
</header>
|
28
|
+
<section>
|
29
|
+
<h1>Rpub – an ePub generator in Ruby <a href="http://travis-ci.org/avdgaag/rpub"><img src="https://secure.travis-ci.org/avdgaag/rpub.png?branch=master" alt="Build Status" /></a> </h1>
|
30
|
+
|
31
|
+
<h2>Introduction</h2>
|
32
|
+
|
33
|
+
<p>Rpub is a command-line tool that generates a collection of plain text input
|
34
|
+
files into an eBook in ePub format. It provides several related functions to
|
35
|
+
make working with ePub files a little easier:</p>
|
36
|
+
|
37
|
+
<ul>
|
38
|
+
<li>Generation of table of contents</li>
|
39
|
+
<li>Packaging your eBook in an archive with additional <span class="caps">README</span> file</li>
|
40
|
+
<li>Embedding fonts</li>
|
41
|
+
<li>Easy previewing as you write</li>
|
42
|
+
<li>.mobi compatibility</li>
|
43
|
+
</ul>
|
44
|
+
|
45
|
+
<h2>Installation</h2>
|
46
|
+
|
47
|
+
<p>Rpub is distributed as a Ruby gem, which should be installed on most Macs and
|
48
|
+
Linux systems. Once you have ensured you have a working installation of Ruby
|
49
|
+
and Ruby gems, install the gem as follows from the command line:</p>
|
50
|
+
|
51
|
+
<pre><code>$ gem install rpub
|
52
|
+
</code></pre>
|
53
|
+
|
54
|
+
<p>You can verify the gem has installed correctly by checking its version number:</p>
|
55
|
+
|
56
|
+
<pre><code>$ rpub -v
|
57
|
+
</code></pre>
|
58
|
+
|
59
|
+
<p>If this generates an error, something has gone wrong. You should see something
|
60
|
+
along the lines of <code>rpub 1.0.0</code>.</p>
|
61
|
+
|
62
|
+
<h2>Usage</h2>
|
63
|
+
|
64
|
+
<h3>Basics</h3>
|
65
|
+
|
66
|
+
<p>ePubs are basically collections of <span class="caps">HTML</span> files, combined in a single archive
|
67
|
+
according to a set of predefined rules. Rpub generates these files for you from
|
68
|
+
simple text files written in <a href="http://daringfireball.net/projects/markdown">Markdown</a>, a very readable markup language created
|
69
|
+
by <a href="http://daringfireball.net">John Gruber</a>. This very <span class="caps">README</span> file is an example of a Markdown document.</p>
|
70
|
+
|
71
|
+
<p>The idea is you write several Markdown files using your favourite text editor,
|
72
|
+
and save them as plain text in your project directory. Usually you would write
|
73
|
+
one file per chapter. By invoking the <code>rpub</code> program you convert those files to
|
74
|
+
<span class="caps">HTML</span> and combine them in an ePub archive:</p>
|
75
|
+
|
76
|
+
<pre><code>$ rpub compile
|
77
|
+
Generating my-new-book-0.1.0.epub... Done!
|
78
|
+
</code></pre>
|
79
|
+
|
80
|
+
<p>After you have run the <code>rpub compile</code> command, you will find a new <code>.epub</code> file
|
81
|
+
in your project directory. The name of this file depends on the title of your
|
82
|
+
book, and its version number. You can set these values, as well as a few others,
|
83
|
+
in a special configuration file called <code>config.yml</code>:</p>
|
84
|
+
|
85
|
+
<pre><code>---
|
86
|
+
author: Your Name
|
87
|
+
title: My new book
|
88
|
+
version: 0.1.0
|
89
|
+
</code></pre>
|
90
|
+
|
91
|
+
<p>This file is written in <a href="http://yaml.org"><span class="caps">YAML</span></a> and sets basic properties of
|
92
|
+
your book project.</p>
|
93
|
+
|
94
|
+
<p>Since regenerating your ePub file and opening it in a suitable reader
|
95
|
+
application is cumbersome, Rpub can generate a simple preview document for you:</p>
|
96
|
+
|
97
|
+
<pre><code>$ rpub preview
|
98
|
+
</code></pre>
|
99
|
+
|
100
|
+
<p>This will generate a new <span class="caps">HTML</span> file in your project directory with a name similar
|
101
|
+
to your ePub file. This is the entire text of your book as a single web page for
|
102
|
+
easy viewing in any browser.</p>
|
103
|
+
|
104
|
+
<h3>Generating a .mobi file</h3>
|
105
|
+
|
106
|
+
<p>Since the ePub and Mobipocket file formats are very (<em>very</em>) similar it is
|
107
|
+
quite easy to create a <code>.mobi</code> version of your book, suitable for reading on
|
108
|
+
Amazon’s Kindle. To do so, you will need to install the <a href="http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211">kindlegen program
|
109
|
+
Amazon provides</a>.</p>
|
110
|
+
|
111
|
+
<p>Here’s how it works:</p>
|
112
|
+
|
113
|
+
<ol>
|
114
|
+
<li>Install <code>kindlegen</code> (<a href="http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211">download it here</a>)</li>
|
115
|
+
<li>Compile your book as usual using <code>rpub compile</code></li>
|
116
|
+
<li>Compile <code>my-book.epub</code> to <code>my-book.mobi</code>: <code>kindlegen my-book.epub</code>.</li>
|
117
|
+
</ol>
|
118
|
+
|
119
|
+
<p>Optionally, include your <code>my-book.mobi</code> in your package by adding it to your
|
120
|
+
list of packaged files (see “Packaging for distribution”).</p>
|
121
|
+
|
122
|
+
<h3>Advanced features</h3>
|
123
|
+
|
124
|
+
<h4>Packaging for distribution</h4>
|
125
|
+
|
126
|
+
<p>Often you want to distribute your ebook over the internet, along with some
|
127
|
+
extra files. You’ll probably want to include a <span class="caps">README</span> file, a license or
|
128
|
+
references to extra online resources. A <code>package</code> task is defined to generate a
|
129
|
+
single compressed archive file from your generated ebook along with such
|
130
|
+
additional files.</p>
|
131
|
+
|
132
|
+
<p>You list the files to include with your ebook in your <code>config.yml</code> file, along
|
133
|
+
with the resulting packaged file name:</p>
|
134
|
+
|
135
|
+
<pre><code>---
|
136
|
+
package_file: mybook.zip
|
137
|
+
package:
|
138
|
+
- README
|
139
|
+
- license.txt
|
140
|
+
- code-samples.rb
|
141
|
+
</code></pre>
|
142
|
+
|
143
|
+
<p>All the filenames listed under <code>package</code> are looked up in the root of your
|
144
|
+
project directory. These files will be combined with the ebook in the
|
145
|
+
<code>mybook.zip</code> file in your project directory.</p>
|
146
|
+
|
147
|
+
<h4>Automatic table of contents</h4>
|
148
|
+
|
149
|
+
<p>Rpub automatically generates a table of contents for you, if you want it to. It
|
150
|
+
does this by scanning all your markdown files for headings and listing them on
|
151
|
+
a single page in the ebook. Each entry in the table of contents is linked to
|
152
|
+
its appropriate heading in the chapter, and has various hooks for your
|
153
|
+
stylesheet to determine its formatting.</p>
|
154
|
+
|
155
|
+
<p>To enable the automatic generation of a table of contents, add the following
|
156
|
+
configuration to your <code>config.yml</code> file:</p>
|
157
|
+
|
158
|
+
<pre><code>toc: true
|
159
|
+
</code></pre>
|
160
|
+
|
161
|
+
<p>Note that this only affects the human-readable table of contents, represented
|
162
|
+
as a page in your book. Rpub will alway generate the .epub table of contents
|
163
|
+
for you, which contains the machine-readable references to your chapters. It
|
164
|
+
will, by default, reference all chapter titles and subheadings for you, but
|
165
|
+
you can customize the number of levels that will be included using the
|
166
|
+
following in your <code>config.yml</code> file:</p>
|
167
|
+
|
168
|
+
<pre><code>max_level: 3
|
169
|
+
</code></pre>
|
170
|
+
|
171
|
+
<h4>Custom layout and styles</h4>
|
172
|
+
|
173
|
+
<p>When you compile a set of Markdown files to an ePub file, rpub uses a default
|
174
|
+
<span class="caps">HTML</span> layout and set of styles to determine the look and feel of the book. These
|
175
|
+
will do fine for most cases, but you can provide your own, if you are so
|
176
|
+
inclined.</p>
|
177
|
+
|
178
|
+
<p>Simply define a <code>layout.html</code> and/or <code>styles.css</code> in your project directory.
|
179
|
+
Your <span class="caps">HTML</span> file will be parsed with Erb, an so you can include your writing
|
180
|
+
using the <code>@body</code> instance variable:</p>
|
181
|
+
|
182
|
+
<pre><code><html>
|
183
|
+
<body>
|
184
|
+
<%= @body %>
|
185
|
+
</body>
|
186
|
+
</html>
|
187
|
+
</code></pre>
|
188
|
+
|
189
|
+
<p><strong>Note 1</strong>: this feature is actually provided by the <a href="http://kramdown.rubyforge.org">Kramdown gem</a>,
|
190
|
+
so have a look at <a href="https://github.com/gettalong/kramdown/blob/master/data/kramdown/document.html">the standard Kramdown document template</a> to see some
|
191
|
+
nifty tricks.</p>
|
192
|
+
|
193
|
+
<p><strong>Note 2</strong>: despite the name ‘html’ and <code>.html</code> extension, your file actually has
|
194
|
+
to be <span class="caps">XHTML</span>-compliant.</p>
|
195
|
+
|
196
|
+
<p>You can also provide custom layouts or styles to use when invoking the <code>compile</code>
|
197
|
+
or <code>preview</code> commands, using the <code>-l</code> or <code>-s</code> options:</p>
|
198
|
+
|
199
|
+
<pre><code>$ rpub compile -l /tmp/my-layout.html
|
200
|
+
</code></pre>
|
201
|
+
|
202
|
+
<p>If you like the default layout or styles, but want to adapt them, you can copy
|
203
|
+
those files into your project using the <code>generate</code> subcommand:</p>
|
204
|
+
|
205
|
+
<pre><code>$ rpub generate
|
206
|
+
</code></pre>
|
207
|
+
|
208
|
+
<h3>Command reference</h3>
|
209
|
+
|
210
|
+
<dl>
|
211
|
+
<dt><code>rpub compile</code></dt>
|
212
|
+
<dd>generate .epub file</dd>
|
213
|
+
<dt><code>rpub package</code></dt>
|
214
|
+
<dd>create zip file with compiled book and other listed files</dd>
|
215
|
+
<dt><code>rpub preview</code></dt>
|
216
|
+
<dd>generate preview <span class="caps">HTML</span> file</dd>
|
217
|
+
<dt><code>rpub generate</code></dt>
|
218
|
+
<dd>copy default layout.html, styles.css and config.yml</dd>
|
219
|
+
<dt><code>rpub help</code></dt>
|
220
|
+
<dd>get help on subcommands</dd>
|
221
|
+
<dt><code>rpub clean</code></dt>
|
222
|
+
<dd>remove generated files</dd>
|
223
|
+
</dl>
|
224
|
+
|
225
|
+
<h3>Configuration reference</h3>
|
226
|
+
|
227
|
+
<dl>
|
228
|
+
<dt><code>title</code></dt>
|
229
|
+
<dd>the book title (string)</dd>
|
230
|
+
<dt><code>descrption</code></dt>
|
231
|
+
<dd>one-line summary of the book (string)</dd>
|
232
|
+
<dt><code>creator</code></dt>
|
233
|
+
<dd>author name (string)</dd>
|
234
|
+
<dt><code>publisher</code></dt>
|
235
|
+
<dd>publisher name (string)</dd>
|
236
|
+
<dt><code>subject</code></dt>
|
237
|
+
<dd>book subject/category (string)</dd>
|
238
|
+
<dt><code>language</code></dt>
|
239
|
+
<dd>language code of the book contents, e.g. ‘en’ (string)</dd>
|
240
|
+
<dt><code>rights</code></dt>
|
241
|
+
<dd>copyright line (string)</dd>
|
242
|
+
<dt><code>version</code></dt>
|
243
|
+
<dd>version number of the book to include in the .epub filename (string)</dd>
|
244
|
+
<dt><code>toc</code></dt>
|
245
|
+
<dd>whether to generate a table of contents as book page (boolean, default false)</dd>
|
246
|
+
<dt><code>max_level</code></dt>
|
247
|
+
<dd>the maximum depth of the .epub table of contents (number, default 2)</dd>
|
248
|
+
<dt><code>ignore</code></dt>
|
249
|
+
<dd>list of files not to include in the epub, that otherwise would (array)</dd>
|
250
|
+
<dt><code>package</code></dt>
|
251
|
+
<dd>list of files to be included in the archive created by the package task (array)</dd>
|
252
|
+
</dl>
|
253
|
+
|
254
|
+
<h3>Examples</h3>
|
255
|
+
|
256
|
+
<p>See the <a href="https://github.com/avdgaag/rpub/tree/master/example">examples directory</a> for two example projects.</p>
|
257
|
+
|
258
|
+
<h3>Documentation</h3>
|
259
|
+
|
260
|
+
<p>See the inline <a href="http://rubydoc.info/github/avdgaag/rpub/master/frames"><span class="caps">API</span> docs</a> for more information.</p>
|
261
|
+
|
262
|
+
<h2>Other</h2>
|
263
|
+
|
264
|
+
<h3>Note on Patches/Pull Requests</h3>
|
265
|
+
|
266
|
+
<ol>
|
267
|
+
<li>Fork the project.</li>
|
268
|
+
<li>Make your feature addition or bug fix.</li>
|
269
|
+
<li>Add tests for it. This is important so I don’t break it in a future version
|
270
|
+
unintentionally.</li>
|
271
|
+
<li>Commit, do not mess with rakefile, version, or history. (if you want to have
|
272
|
+
your own version, that is fine but bump version in a commit by itself I can
|
273
|
+
ignore when I pull)</li>
|
274
|
+
<li>Send me a pull request. Bonus points for topic branches.</li>
|
275
|
+
</ol>
|
276
|
+
|
277
|
+
<h3>Issues</h3>
|
278
|
+
|
279
|
+
<p>Please report any issues, defects or suggestions in the <a href="https://github.com/avdgaag/rpub/issues">Github issue
|
280
|
+
tracker</a>.</p>
|
281
|
+
|
282
|
+
<h3>What has changed?</h3>
|
283
|
+
|
284
|
+
<p>See the <a href="https://github.com/avdgaag/rpub/blob/master/HISTORY.md"><span class="caps">HISTORY</span></a> file for a detailed changelog.</p>
|
285
|
+
|
286
|
+
<h3>Credits</h3>
|
287
|
+
|
288
|
+
<p>Created by: Arjan van der Gaag<br />
|
289
|
+
<span class="caps">URL</span>: <a href="http://arjanvandergaag.nl">http://arjanvandergaag.nl</a><br />
|
290
|
+
Project homepage: <a href="http://avdgaag.github.com/rpub">http://avdgaag.github.com/rpub</a><br />
|
291
|
+
Date: april 2012<br />
|
292
|
+
License: <a href="https://github.com/avdgaag/rpub/LICENSE"><span class="caps">MIT</span>-license</a> (same as Ruby)</p>
|
293
|
+
</section>
|
294
|
+
<footer>
|
295
|
+
<p>This project is maintained by <a href="https://github.com/avdgaag">avdgaag</a></p>
|
296
|
+
<p><small>Hosted on GitHub Pages — Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
|
297
|
+
</footer>
|
298
|
+
</div>
|
299
|
+
<script src="javascripts/scale.fix.js"></script>
|
300
|
+
<script type="text/javascript">
|
301
|
+
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
302
|
+
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
303
|
+
</script>
|
304
|
+
<script type="text/javascript">
|
305
|
+
try {
|
306
|
+
var pageTracker = _gat._getTracker("UA-20357800-1");
|
307
|
+
pageTracker._trackPageview();
|
308
|
+
} catch(err) {}
|
309
|
+
</script>
|
310
|
+
|
311
|
+
</body>
|
312
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
var metas = document.getElementsByTagName('meta');
|
2
|
+
var i;
|
3
|
+
if (navigator.userAgent.match(/iPhone/i)) {
|
4
|
+
for (i=0; i<metas.length; i++) {
|
5
|
+
if (metas[i].name == "viewport") {
|
6
|
+
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
|
7
|
+
}
|
8
|
+
}
|
9
|
+
document.addEventListener("gesturestart", gestureStart, false);
|
10
|
+
}
|
11
|
+
function gestureStart() {
|
12
|
+
for (i=0; i<metas.length; i++) {
|
13
|
+
if (metas[i].name == "viewport") {
|
14
|
+
metas[i].content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6";
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
data/doc/params.json
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"name":"Rpub","body":"# Introduction\r\n\r\nrPub is a command-line tool that generates a collection of plain text input\r\nfiles into an eBook in ePub format. It provides several related functions to\r\nmake working with ePub files a little easier:\r\n\r\n* Generation of table of contents\r\n* Tracking of references to tables or figures\r\n* Validation of output file\r\n* Packaging your eBook in an archive with additional README file\r\n* Very simple version control\r\n\r\n# Installation\r\n\r\nrPub is distributed as a Ruby gem, which should be installed on most Macs and\r\nLinux systems. Once you have ensured you have a working installation of Ruby\r\nand Ruby gems, install the gem as follows from the command line:\r\n\r\n $ gem install rpub\r\n\r\nYou can verify the gem has installed correctly by checking its version number:\r\n\r\n\r\n $ rpub -v\r\n\r\nIf this generates an error, something has gone wrong. You should see something\r\nalong the lines of `rpub 1.0.0`.\r\n\r\n# Usage\r\n\r\n## Basics\r\n\r\nePubs are basically collections of HTML files, combined in a single archive\r\naccording to a set of predefined rules. rPub generates these files for you from\r\nsimple text files written in [Markdown][], a very readable markup language created\r\nby [John Gruber][]. This very README file is an example of a Markdown document.\r\n\r\nThe idea is you write several Markdown files using your favourite text editor,\r\nand save them as plain text in your project directory. Usually you would write\r\none file per chapter. By invoking the `rpub` program you convert those files to\r\nHTML and combine them in an ePub archive:\r\n\r\n $ rpub compile\r\n Generating my-new-book-0.1.0.epub... Done!\r\n\r\nAfter you have run the `rpub compile` command, you will find a new `.epub` file\r\nin your project directory. The name of this file depends on the title of your\r\nbook, and its version number. You can set these values, as well as a few others,\r\nin a special configuration file called `config.yml`:\r\n\r\n ---\r\n author: Your Name\r\n title: My new book\r\n version: 0.1.0\r\n\r\nThis file is written in [YAML][] and sets basic properties of your book project.\r\n\r\nTo make sure the book you generated is _valid_ -- meaning it is likely that most\r\nreaders out there will be able to read it -- you can use the special `validate`\r\ncommand:\r\n\r\n $ rpub validate\r\n\r\nrPub will report any errors it finds. No output means everything is alright.\r\n\r\nSince regenerating your ePub file and opening it in a suitable reader\r\napplication is cumbersome, rPub can generate a simple preview document for you:\r\n\r\n $ rpub preview\r\n\r\nThis will generate a new HTML file in your project directory with a name similar\r\nto your ePub file. This is the entire text of your book as a single web page for\r\neasy viewing in any browser.\r\n\r\n[Markdown]: http://daringfireball.net/projects/markdown\r\n[John gruber]: http://daringfireball.net\r\n\r\n## Advanced features\r\n\r\n### Watching for changes\r\n\r\n### Packaging for distribution\r\n\r\n### Very simple version control\r\n\r\n### Automatic references\r\n\r\n### Automatic table of contents\r\n\r\n### Custom layout and styles\r\n\r\n## Command reference\r\n\r\n* `rpub compile` -- generate .epub file\r\n* `rpub package` -- create zip file with compiled book and other listed files\r\n* `rpub validate` -- compile, then validate\r\n* `rpub preview` -- generate preview HTML file\r\n* `rpub new` -- create skeleton directory tree\r\n* `rpub help` -- get help on subcommands\r\n* `rpub clean` -- remove generated files\r\n* `rpub release` -- package and tag in Git\r\n* `rpub snapshot` -- commit changes in git after validation\r\n\r\n## Examples\r\n\r\nSee the [examples directory](examples) for two example projects.\r\n\r\n# Other\r\n\r\n## Note on Patches/Pull Requests\r\n\r\n1. Fork the project.\r\n2. Make your feature addition or bug fix.\r\n3. Add tests for it. This is important so I don't break it in a future version\r\n unintentionally.\r\n4. Commit, do not mess with rakefile, version, or history. (if you want to have\r\n your own version, that is fine but bump version in a commit by itself I can\r\n ignore when I pull)\r\n5. Send me a pull request. Bonus points for topic branches.\r\n\r\n## Issues\r\n\r\nPlease report any issues, defects or suggestions in the [Github issue\r\ntracker](https://github.com/avdgaag/rpub/issues).\r\n\r\n## What has changed?\r\n\r\nSee the [HISTORY](HISTORY) file for a detailed changelog.\r\n\r\n## Credits\r\n\r\nCreated by: Arjan van der Gaag \r\nURL: [http://arjanvandergaag.nl](http://arjanvandergaag.nl) \r\nProject homepage: [http://avdgaag.github.com/rpub](http://avdgaag.github.com/rpub) \r\nDate: april 2012 \r\nLicense: [MIT-license](LICENSE) (same as Ruby)\r\n","tagline":"an ePub generation library in Ruby","google":"UA-20357800-1","note":"Don't delete this file! It's used internally to help with page regeneration."}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
.highlight { background: #ffffff; }
|
2
|
+
.highlight .c { color: #999988; font-style: italic } /* Comment */
|
3
|
+
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
|
4
|
+
.highlight .k { font-weight: bold } /* Keyword */
|
5
|
+
.highlight .o { font-weight: bold } /* Operator */
|
6
|
+
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
|
7
|
+
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
|
8
|
+
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
|
9
|
+
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
|
10
|
+
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
|
11
|
+
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
|
12
|
+
.highlight .ge { font-style: italic } /* Generic.Emph */
|
13
|
+
.highlight .gr { color: #aa0000 } /* Generic.Error */
|
14
|
+
.highlight .gh { color: #999999 } /* Generic.Heading */
|
15
|
+
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
|
16
|
+
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
|
17
|
+
.highlight .go { color: #888888 } /* Generic.Output */
|
18
|
+
.highlight .gp { color: #555555 } /* Generic.Prompt */
|
19
|
+
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
20
|
+
.highlight .gu { color: #800080; font-weight: bold; } /* Generic.Subheading */
|
21
|
+
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
|
22
|
+
.highlight .kc { font-weight: bold } /* Keyword.Constant */
|
23
|
+
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
|
24
|
+
.highlight .kn { font-weight: bold } /* Keyword.Namespace */
|
25
|
+
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
|
26
|
+
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
|
27
|
+
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
|
28
|
+
.highlight .m { color: #009999 } /* Literal.Number */
|
29
|
+
.highlight .s { color: #d14 } /* Literal.String */
|
30
|
+
.highlight .na { color: #008080 } /* Name.Attribute */
|
31
|
+
.highlight .nb { color: #0086B3 } /* Name.Builtin */
|
32
|
+
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
|
33
|
+
.highlight .no { color: #008080 } /* Name.Constant */
|
34
|
+
.highlight .ni { color: #800080 } /* Name.Entity */
|
35
|
+
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
|
36
|
+
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
|
37
|
+
.highlight .nn { color: #555555 } /* Name.Namespace */
|
38
|
+
.highlight .nt { color: #000080 } /* Name.Tag */
|
39
|
+
.highlight .nv { color: #008080 } /* Name.Variable */
|
40
|
+
.highlight .ow { font-weight: bold } /* Operator.Word */
|
41
|
+
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
|
42
|
+
.highlight .mf { color: #009999 } /* Literal.Number.Float */
|
43
|
+
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
|
44
|
+
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
|
45
|
+
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
|
46
|
+
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
|
47
|
+
.highlight .sc { color: #d14 } /* Literal.String.Char */
|
48
|
+
.highlight .sd { color: #d14 } /* Literal.String.Doc */
|
49
|
+
.highlight .s2 { color: #d14 } /* Literal.String.Double */
|
50
|
+
.highlight .se { color: #d14 } /* Literal.String.Escape */
|
51
|
+
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
|
52
|
+
.highlight .si { color: #d14 } /* Literal.String.Interpol */
|
53
|
+
.highlight .sx { color: #d14 } /* Literal.String.Other */
|
54
|
+
.highlight .sr { color: #009926 } /* Literal.String.Regex */
|
55
|
+
.highlight .s1 { color: #d14 } /* Literal.String.Single */
|
56
|
+
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
|
57
|
+
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
|
58
|
+
.highlight .vc { color: #008080 } /* Name.Variable.Class */
|
59
|
+
.highlight .vg { color: #008080 } /* Name.Variable.Global */
|
60
|
+
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
|
61
|
+
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
|
62
|
+
|
63
|
+
.type-csharp .highlight .k { color: #0000FF }
|
64
|
+
.type-csharp .highlight .kt { color: #0000FF }
|
65
|
+
.type-csharp .highlight .nf { color: #000000; font-weight: normal }
|
66
|
+
.type-csharp .highlight .nc { color: #2B91AF }
|
67
|
+
.type-csharp .highlight .nn { color: #000000 }
|
68
|
+
.type-csharp .highlight .s { color: #A31515 }
|
69
|
+
.type-csharp .highlight .sc { color: #A31515 }
|