epubber 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +22 -0
- data/README.md +58 -0
- data/Rakefile +9 -0
- data/epubber.gemspec +23 -0
- data/lib/epubber/generator.rb +63 -0
- data/lib/epubber/generators/chapters.rb +20 -0
- data/lib/epubber/generators/content.rb +10 -0
- data/lib/epubber/generators/endnotes.rb +14 -0
- data/lib/epubber/generators/generator.rb +29 -0
- data/lib/epubber/generators/introduction.rb +14 -0
- data/lib/epubber/generators/static.rb +21 -0
- data/lib/epubber/generators/toc.rb +13 -0
- data/lib/epubber/models/book.rb +87 -0
- data/lib/epubber/models/chapter.rb +26 -0
- data/lib/epubber/models/concerns/has_chapters.rb +23 -0
- data/lib/epubber/models/concerns/has_endnotes.rb +17 -0
- data/lib/epubber/models/concerns/has_introduction.rb +17 -0
- data/lib/epubber/models/endnotes.rb +16 -0
- data/lib/epubber/models/introduction.rb +16 -0
- data/lib/epubber/services/compressor.rb +45 -0
- data/lib/epubber/services/persistance.rb +35 -0
- data/lib/epubber/services/template.rb +27 -0
- data/lib/epubber/version.rb +3 -0
- data/lib/epubber.rb +12 -0
- data/lib/templates/META-INF/com.apple.ibooks.display-options.xml +6 -0
- data/lib/templates/META-INF/container.xml +6 -0
- data/lib/templates/OEBPS/Styles/style.css +16 -0
- data/lib/templates/OEBPS/Text/acknowledgements.xhtml +15 -0
- data/lib/templates/OEBPS/Text/chapter.xhtml +16 -0
- data/lib/templates/OEBPS/Text/cover.xhtml +21 -0
- data/lib/templates/OEBPS/Text/dedication.xhtml +15 -0
- data/lib/templates/OEBPS/Text/endnotes.xhtml +16 -0
- data/lib/templates/OEBPS/Text/foreword.xhtml +15 -0
- data/lib/templates/OEBPS/Text/frontmatter.xhtml +15 -0
- data/lib/templates/OEBPS/Text/introduction.xhtml +16 -0
- data/lib/templates/OEBPS/Text/toc.xhtml +37 -0
- data/lib/templates/OEBPS/content.opf +180 -0
- data/lib/templates/OEBPS/toc.ncx +79 -0
- data/lib/templates/mimetype +1 -0
- data/test/test_epubber.rb +31 -0
- metadata +115 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
6
|
+
<head>
|
7
|
+
<title>Acknowledgements</title>
|
8
|
+
<link href="../Styles/style.css" rel="stylesheet" type="text/css" />
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="acknowledgements" xml:lang="en-US">
|
12
|
+
<h2>Acknowledgements</h2>
|
13
|
+
</div>
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
6
|
+
<head>
|
7
|
+
<title>{{ chapter.title }}</title>
|
8
|
+
<link href="../Styles/style.css" rel="stylesheet" type="text/css" />
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="chapter-{{ id }}" xml:lang="en-US">
|
12
|
+
<h2>{{ title }}</h2>
|
13
|
+
{{ content }}
|
14
|
+
</div>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
6
|
+
<head>
|
7
|
+
<title>Cover</title>
|
8
|
+
<style type="text/css">
|
9
|
+
/*<![CDATA[*/
|
10
|
+
img { max-width: 100%; }
|
11
|
+
body { oeb-column-number: 1; }
|
12
|
+
#cover-image { text-align: center; }
|
13
|
+
/*]]>*/
|
14
|
+
</style>
|
15
|
+
</head>
|
16
|
+
<body>
|
17
|
+
<div id="cover-image">
|
18
|
+
<img alt="[BOOK'S TITLE]" src="../Images/cover.jpg" />
|
19
|
+
</div>
|
20
|
+
</body>
|
21
|
+
</html>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
6
|
+
<head>
|
7
|
+
<title>Dedication</title>
|
8
|
+
<link href="../Styles/style.css" rel="stylesheet" type="text/css" />
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="dedication" xml:lang="en-US">
|
12
|
+
<h2>Dedication</h2>
|
13
|
+
</div>
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
6
|
+
<head>
|
7
|
+
<title>Endnotes</title>
|
8
|
+
<link href="../Styles/style.css" rel="stylesheet" type="text/css" />
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="endnotes" xml:lang="en-US">
|
12
|
+
<h2>End notes</h2>
|
13
|
+
{{ book.endnotes.content }}
|
14
|
+
</div>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
6
|
+
<head>
|
7
|
+
<title>Foreword</title>
|
8
|
+
<link href="../Styles/style.css" rel="stylesheet" type="text/css" />
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="foreword" xml:lang="en-US">
|
12
|
+
<h2>Foreword</h2>
|
13
|
+
</div>
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
6
|
+
<head>
|
7
|
+
<title>Frontmatter</title>
|
8
|
+
<link href="../Styles/style.css" rel="stylesheet" type="text/css" />
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div class="frontmatter" xml:lang="en-US">
|
12
|
+
<h2>Front matter</h2>
|
13
|
+
</div>
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
6
|
+
<head>
|
7
|
+
<title>Introduction</title>
|
8
|
+
<link href="../Styles/style.css" rel="stylesheet" type="text/css" />
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="introduction" xml:lang="en-US">
|
12
|
+
<h2>Introduction</h2>
|
13
|
+
{{ book.introduction.content }}
|
14
|
+
</div>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
6
|
+
<head>
|
7
|
+
<title>Contents</title>
|
8
|
+
<link href="../Styles/style.css" rel="stylesheet" type="text/css" />
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="toc" xml:lang="en-US">
|
12
|
+
<h1>Contents</h1>
|
13
|
+
<ul>
|
14
|
+
<!--
|
15
|
+
<li><a href="../Text/cover.xhtml"><span>Cover</span></a></li>
|
16
|
+
<li><a href="../Text/frontmatter.xhtml"><span>Front Matter</span></a></li>
|
17
|
+
<li><a href="../Text/dedication.xhtml"><span>Dedication</span></a></li>
|
18
|
+
<li><a href="../Text/foreword.xhtml"><span>Foreword</span></a></li>
|
19
|
+
-->
|
20
|
+
{% if book.introduction %}
|
21
|
+
<li><a href="../Text/introduction.xhtml"><span>Introduction</span></a></li>
|
22
|
+
{% endif %}
|
23
|
+
|
24
|
+
{% for chapter in book.chapters %}
|
25
|
+
<li><a href="../Text/chapter{{ chapter.id }}.xhtml"><span>{{ chapter.title }}</span></a></li>
|
26
|
+
{% endfor %}
|
27
|
+
|
28
|
+
{% if book.endnotes %}
|
29
|
+
<li><a href="../Text/endnotes.xhtml"><span>Endnotes</span></a></li>
|
30
|
+
{% endif %}
|
31
|
+
<!--
|
32
|
+
<li><a href="../Text/acknowledgements.xhtml"><span>Acknowledgements</span></a></li>
|
33
|
+
-->
|
34
|
+
</ul>
|
35
|
+
</div>
|
36
|
+
</body>
|
37
|
+
</html>
|
@@ -0,0 +1,180 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
2
|
+
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="bookid" version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
3
|
+
<metadata xmlns:opf="http://www.idpf.org/2007/opf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
4
|
+
|
5
|
+
<!-- ISBN -->
|
6
|
+
{% if book.isbn %}
|
7
|
+
<dc:identifier id="bookid" opf:scheme="ISBN">urn:isbn:{{ book.isbn }}</dc:identifier>
|
8
|
+
{% endif %}
|
9
|
+
<dc:title>{{ book.title }}</dc:title>
|
10
|
+
<dc:rights>Copyright © [YEAR] {{ book.author }}. All rights reserved.</dc:rights>
|
11
|
+
|
12
|
+
<!-- BISAC Subject Headings List: http://www.bisg.org/what-we-do-0-136-bisac-subject-headings-list-major-subjects.php-->
|
13
|
+
<dc:subject>{{ book.subjects }}</dc:subject>
|
14
|
+
|
15
|
+
<dc:creator opf:file-as="{{ book.author }}" opf:role="aut">{{ book.author }}</dc:creator>
|
16
|
+
|
17
|
+
<dc:source>{{ book.url }}</dc:source>
|
18
|
+
|
19
|
+
<!-- List of contributors
|
20
|
+
|
21
|
+
See: MARC Code List for Relators: http://www.loc.gov/marc/relators/relaterm.html
|
22
|
+
|
23
|
+
Examples:
|
24
|
+
|
25
|
+
* Editor [edt]
|
26
|
+
Use for a person or organization who prepares for publication a work not primarily his/her own,
|
27
|
+
such as by elucidating text, adding introductory or other critical matter, or technically directing
|
28
|
+
an editorial staff.
|
29
|
+
|
30
|
+
* Cover designer [cov]
|
31
|
+
Use for a person or organization responsible for the graphic design of a book cover,
|
32
|
+
album cover, slipcase, box, container, etc. For a person or organization responsible
|
33
|
+
for the graphic design of an entire book, use Book designer; for book jackets, use Bookjacket designer.
|
34
|
+
|
35
|
+
* Translator [trl]
|
36
|
+
Use for a person or organization who renders a text from one language into another, or from an older
|
37
|
+
form of a language into the modern form.
|
38
|
+
|
39
|
+
-->
|
40
|
+
|
41
|
+
<!--
|
42
|
+
<dc:contributor opf:file-as="[LASTNAME, NAME]" opf:role="edt">[NAME LASTNAME]</dc:contributor>
|
43
|
+
<dc:contributor opf:file-as="[LASTNAME, NAME]" opf:role="cov">[NAME LASTNAME]</dc:contributor>
|
44
|
+
-->
|
45
|
+
|
46
|
+
<dc:publisher>{{ book.publisher }}</dc:publisher>
|
47
|
+
<dc:date opf:event="publication">2012-01-01</dc:date>
|
48
|
+
|
49
|
+
<!-- Language code: http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes -->
|
50
|
+
<dc:language>{{ book.language }}</dc:language>
|
51
|
+
|
52
|
+
<meta name="cover" content="[COVER_NAME].jpg" />
|
53
|
+
|
54
|
+
<!-- UUID generator: http://www.famkruithof.net/uuid/uuidgen -->
|
55
|
+
<dc:identifier opf:scheme="UUID">urn:uuid:{{ book.uuid }}</dc:identifier>
|
56
|
+
|
57
|
+
</metadata>
|
58
|
+
|
59
|
+
<!-- MANIFEST (mandatory)
|
60
|
+
List of all the resources of the book (XHTML, CSS, images,…).
|
61
|
+
The order of item elements in the manifest is NOT significant.
|
62
|
+
|
63
|
+
http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.3
|
64
|
+
-->
|
65
|
+
|
66
|
+
<manifest>
|
67
|
+
<!--
|
68
|
+
<item href="Images/cover.jpg" id="cover.jpg" media-type="image/jpeg" />
|
69
|
+
<item href="Text/cover.xhtml" id="cover" media-type="application/xhtml+xml" />
|
70
|
+
-->
|
71
|
+
<item href="toc.ncx" id="ncx" media-type="application/x-dtbncx+xml" />
|
72
|
+
<item href="Styles/style.css" id="css" media-type="text/css" />
|
73
|
+
<!--
|
74
|
+
<item href="Text/frontmatter.xhtml" id="frontmatter" media-type="application/xhtml+xml" />
|
75
|
+
<item href="Text/dedication.xhtml" id="dedication" media-type="application/xhtml+xml" />
|
76
|
+
-->
|
77
|
+
<item href="Text/toc.xhtml" id="toc" media-type="application/xhtml+xml" />
|
78
|
+
<!--
|
79
|
+
<item href="Text/foreword.xhtml" id="foreword" media-type="application/xhtml+xml" />
|
80
|
+
-->
|
81
|
+
{% if book.introduction %}
|
82
|
+
<item href="Text/introduction.xhtml" id="introduction" media-type="application/xhtml+xml" />
|
83
|
+
{% endif %}
|
84
|
+
|
85
|
+
{% for chapter in book.chapters %}
|
86
|
+
<item href="Text/chapter{{ chapter.id }}.xhtml" id="chapter-{{ chapter.id }}" media-type="application/xhtml+xml" />
|
87
|
+
{% endfor %}
|
88
|
+
|
89
|
+
{% if book.endnotes %}
|
90
|
+
<item href="Text/endnotes.xhtml" id="endnotes" media-type="application/xhtml+xml" />
|
91
|
+
{% endif %}
|
92
|
+
<!--
|
93
|
+
<item href="Text/acknowledgements.xhtml" id="acknowledgements" media-type="application/xhtml+xml" />
|
94
|
+
<item href="Images/image-01.jpg" id="image-01" media-type="image/jpeg" />
|
95
|
+
<item href="Images/image-02.png" id="image-02" media-type="image/png" />
|
96
|
+
-->
|
97
|
+
</manifest>
|
98
|
+
|
99
|
+
<!-- SPINE (mandatory)
|
100
|
+
|
101
|
+
The spine element defines the default reading order of the content. It doesn't list every file in the manifest,
|
102
|
+
just the reading order.
|
103
|
+
|
104
|
+
The value of the idref tag in the spine has to match the ID tag for that entry in the manifest.
|
105
|
+
|
106
|
+
For example, if you have the following reference in your manifest:
|
107
|
+
|
108
|
+
<item id="chapter-1" href="chapter01.xhtml" media-type="application/xhtml+xml" />
|
109
|
+
|
110
|
+
your spine entry would be:
|
111
|
+
|
112
|
+
<itemref idref="chapter-1" />
|
113
|
+
|
114
|
+
http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.4
|
115
|
+
|
116
|
+
-->
|
117
|
+
<spine toc="ncx">
|
118
|
+
<!--
|
119
|
+
<itemref idref="cover" />
|
120
|
+
<itemref idref="frontmatter" />
|
121
|
+
-->
|
122
|
+
<itemref idref="toc" />
|
123
|
+
<!--
|
124
|
+
<itemref idref="foreword" />
|
125
|
+
<itemref idref="dedication" />
|
126
|
+
-->
|
127
|
+
{% if book.introduction %}
|
128
|
+
<itemref idref="introduction" />
|
129
|
+
{% endif %}
|
130
|
+
|
131
|
+
{% for chapter in book.chapters %}
|
132
|
+
<itemref idref="chapter-{{ chapter.id }}" />
|
133
|
+
{% endfor %}
|
134
|
+
|
135
|
+
{% if book.endnotes %}
|
136
|
+
<itemref idref="endnotes" />
|
137
|
+
{% endif %}
|
138
|
+
<!--
|
139
|
+
<itemref idref="acknowledgements" />
|
140
|
+
-->
|
141
|
+
</spine>
|
142
|
+
|
143
|
+
<!-- GUIDE (optional, recommended by Apple)
|
144
|
+
|
145
|
+
The guide lets you specify the role of the book's files.
|
146
|
+
|
147
|
+
Available tags: cover, title-page, toc, index, glossary, acknowledgements, bibliography,
|
148
|
+
colophon, copyright-page, dedication, epigraph, foreword, loi (list of illustrations),
|
149
|
+
lot (list of tables), notes, preface, and text.
|
150
|
+
|
151
|
+
http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.6
|
152
|
+
|
153
|
+
-->
|
154
|
+
<guide>
|
155
|
+
<!--
|
156
|
+
<reference href="Text/cover.xhtml" title="Cover" type="cover" />
|
157
|
+
-->
|
158
|
+
<reference href="Text/toc.xhtml" title="Table of Contents" type="toc" />
|
159
|
+
<!--
|
160
|
+
<reference href="Text/frontmatter.xhtml" type="copyright-page" />
|
161
|
+
<reference href="Text/foreword.xhtml" type="foreword" />
|
162
|
+
<reference href="Text/dedication.xhtml" type="dedication" />
|
163
|
+
-->
|
164
|
+
{% if book.introduction %}
|
165
|
+
<reference href="Text/introduction.xhtml" type="text" />
|
166
|
+
{% endif %}
|
167
|
+
|
168
|
+
{% for chapter in book.chapters %}
|
169
|
+
<reference href="Text/chapter{{ chapter.id }}.xhtml" type="text" />
|
170
|
+
{% endfor %}
|
171
|
+
|
172
|
+
{% if book.endnotes %}
|
173
|
+
<reference href="Text/endnotes.xhtml" type="notes" />
|
174
|
+
{% endif %}
|
175
|
+
<!--
|
176
|
+
<reference href="Text/acknowledgements.xhtml" type="acknowledgements" />
|
177
|
+
-->
|
178
|
+
</guide>
|
179
|
+
|
180
|
+
</package>
|
@@ -0,0 +1,79 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
2
|
+
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
|
3
|
+
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
|
4
|
+
<head>
|
5
|
+
<meta content="urn:isbn:[ISBN]" name="dtb:uid"/>
|
6
|
+
<meta content="1" name="dtb:depth"/>
|
7
|
+
|
8
|
+
<!-- totalPageCount and maxPageNumber are mandatory, but they're not used in ebooks -->
|
9
|
+
<meta content="-1" name="dtb:totalPageCount"/>
|
10
|
+
<meta content="-1" name="dtb:maxPageNumber"/>
|
11
|
+
</head>
|
12
|
+
<docTitle>
|
13
|
+
<text>{{ book.title }}</text>
|
14
|
+
</docTitle>
|
15
|
+
<navMap>
|
16
|
+
<!--
|
17
|
+
<navPoint id="navpoint-cover">
|
18
|
+
<navLabel>
|
19
|
+
<text>Cover</text>
|
20
|
+
</navLabel>
|
21
|
+
<content src="Text/cover.xhtml" />
|
22
|
+
</navPoint>
|
23
|
+
<navPoint id="navpoint-frontmatter">
|
24
|
+
<navLabel>
|
25
|
+
<text>Front Matter</text>
|
26
|
+
</navLabel>
|
27
|
+
<content src="Text/frontmatter.xhtml" />
|
28
|
+
</navPoint>
|
29
|
+
<navPoint id="navpoint-dedication">
|
30
|
+
<navLabel>
|
31
|
+
<text>Dedication</text>
|
32
|
+
</navLabel>
|
33
|
+
<content src="Text/dedication.xhtml" />
|
34
|
+
</navPoint>
|
35
|
+
<navPoint id="navpoint-foreword">
|
36
|
+
<navLabel>
|
37
|
+
<text>Foreword</text>
|
38
|
+
</navLabel>
|
39
|
+
<content src="Text/foreword.xhtml" />
|
40
|
+
</navPoint>
|
41
|
+
-->
|
42
|
+
|
43
|
+
{% if book.introduction %}
|
44
|
+
<navPoint id="navpoint-introduction">
|
45
|
+
<navLabel>
|
46
|
+
<text>Introduction</text>
|
47
|
+
</navLabel>
|
48
|
+
<content src="Text/introduction.xhtml" />
|
49
|
+
</navPoint>
|
50
|
+
{% endif %}
|
51
|
+
|
52
|
+
{% for chapter in book.chapters %}
|
53
|
+
<navPoint id="navpoint{{ chapter.id }}" playOrder="{{ chapter.id }}">
|
54
|
+
<navLabel>
|
55
|
+
<text>{{ chapter.title }}</text>
|
56
|
+
</navLabel>
|
57
|
+
<content src="Text/chapter{{ chapter.id }}.xhtml"/>
|
58
|
+
</navPoint>
|
59
|
+
{% endfor %}
|
60
|
+
|
61
|
+
{% if book.endnotes %}
|
62
|
+
<navPoint id="navpoint-endnotes">
|
63
|
+
<navLabel>
|
64
|
+
<text>Endnotes</text>
|
65
|
+
</navLabel>
|
66
|
+
<content src="Text/endnotes.xhtml" />
|
67
|
+
</navPoint>
|
68
|
+
{% endif %}
|
69
|
+
|
70
|
+
<!--
|
71
|
+
<navPoint id="navpoint-acknowledgements">
|
72
|
+
<navLabel>
|
73
|
+
<text>Acknowledgements</text>
|
74
|
+
</navLabel>
|
75
|
+
<content src="Text/acknowledgements.xhtml" />
|
76
|
+
</navPoint>
|
77
|
+
-->
|
78
|
+
</navMap>
|
79
|
+
</ncx>
|
@@ -0,0 +1 @@
|
|
1
|
+
application/epub+zip
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'epubber'
|
3
|
+
|
4
|
+
class EpubberTest < Minitest::Test
|
5
|
+
def test_dsl
|
6
|
+
result = Epubber.generate do
|
7
|
+
title 'My First EPUB book'
|
8
|
+
author 'Ramirez, Federico'
|
9
|
+
|
10
|
+
introduction do
|
11
|
+
content "<p>This is the introduction, and it's optional. What is this book about?</p>"
|
12
|
+
end
|
13
|
+
|
14
|
+
chapter do
|
15
|
+
title 'Chapter 1'
|
16
|
+
content '<p>This is some content!</p>'
|
17
|
+
end
|
18
|
+
|
19
|
+
chapter do
|
20
|
+
title 'Chapter 2'
|
21
|
+
content '<p>Some more content this is.</p>'
|
22
|
+
end
|
23
|
+
|
24
|
+
endnotes do
|
25
|
+
content '<p>This was a fun book. Thanks for reading!</p>'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
assert_equal '/tmp/epubber/My First EPUB book.epub', result
|
30
|
+
end
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: epubber
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Federico Ramirez
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- fedra.arg@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- epubber.gemspec
|
54
|
+
- lib/epubber.rb
|
55
|
+
- lib/epubber/generator.rb
|
56
|
+
- lib/epubber/generators/chapters.rb
|
57
|
+
- lib/epubber/generators/content.rb
|
58
|
+
- lib/epubber/generators/endnotes.rb
|
59
|
+
- lib/epubber/generators/generator.rb
|
60
|
+
- lib/epubber/generators/introduction.rb
|
61
|
+
- lib/epubber/generators/static.rb
|
62
|
+
- lib/epubber/generators/toc.rb
|
63
|
+
- lib/epubber/models/book.rb
|
64
|
+
- lib/epubber/models/chapter.rb
|
65
|
+
- lib/epubber/models/concerns/has_chapters.rb
|
66
|
+
- lib/epubber/models/concerns/has_endnotes.rb
|
67
|
+
- lib/epubber/models/concerns/has_introduction.rb
|
68
|
+
- lib/epubber/models/endnotes.rb
|
69
|
+
- lib/epubber/models/introduction.rb
|
70
|
+
- lib/epubber/services/compressor.rb
|
71
|
+
- lib/epubber/services/persistance.rb
|
72
|
+
- lib/epubber/services/template.rb
|
73
|
+
- lib/epubber/version.rb
|
74
|
+
- lib/templates/META-INF/com.apple.ibooks.display-options.xml
|
75
|
+
- lib/templates/META-INF/container.xml
|
76
|
+
- lib/templates/OEBPS/Styles/style.css
|
77
|
+
- lib/templates/OEBPS/Text/acknowledgements.xhtml
|
78
|
+
- lib/templates/OEBPS/Text/chapter.xhtml
|
79
|
+
- lib/templates/OEBPS/Text/cover.xhtml
|
80
|
+
- lib/templates/OEBPS/Text/dedication.xhtml
|
81
|
+
- lib/templates/OEBPS/Text/endnotes.xhtml
|
82
|
+
- lib/templates/OEBPS/Text/foreword.xhtml
|
83
|
+
- lib/templates/OEBPS/Text/frontmatter.xhtml
|
84
|
+
- lib/templates/OEBPS/Text/introduction.xhtml
|
85
|
+
- lib/templates/OEBPS/Text/toc.xhtml
|
86
|
+
- lib/templates/OEBPS/content.opf
|
87
|
+
- lib/templates/OEBPS/toc.ncx
|
88
|
+
- lib/templates/mimetype
|
89
|
+
- test/test_epubber.rb
|
90
|
+
homepage: https://github.com/gosukiwi/epubber
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.2.2
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: Generate EPUB files programatically
|
114
|
+
test_files:
|
115
|
+
- test/test_epubber.rb
|