bookshop 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. data/README.rdoc +17 -51
  2. data/lib/bookshop/commands/build.rb +5 -10
  3. data/lib/bookshop/commands/epub/epub_build.rb +61 -37
  4. data/lib/bookshop/commands/epub/templates/OEBPS/.empty_directory +0 -0
  5. data/lib/bookshop/commands/epub/templates/OEBPS/{content.opf.erb → content.opf.tt} +0 -0
  6. data/lib/bookshop/commands/epub/templates/OEBPS/{toc.opf.erb → toc.opf.tt} +0 -0
  7. data/lib/bookshop/generators/bookshop/app/templates/README.rdoc +17 -51
  8. data/lib/bookshop/{commands/epub/templates/OEBPS → generators/bookshop/app/templates/book/assets/css}/page-template.xpgt +0 -0
  9. data/lib/bookshop/generators/bookshop/app/templates/book/{css/stylesheet.css → assets/css/stylesheet.epub.css} +0 -0
  10. data/lib/bookshop/generators/bookshop/app/templates/book/assets/css/stylesheet.html.css +451 -0
  11. data/lib/bookshop/generators/bookshop/app/templates/book/assets/css/stylesheet.mobi.css +451 -0
  12. data/lib/bookshop/generators/bookshop/app/templates/book/assets/css/stylesheet.pdf.css +451 -0
  13. data/lib/bookshop/generators/bookshop/app/templates/book/{images → assets/images}/canvas.jpg +0 -0
  14. data/lib/bookshop/generators/bookshop/app/templates/book/{images → assets/images}/draft.png +0 -0
  15. data/lib/bookshop/generators/bookshop/app/templates/book/{images → assets/images}/html-18.png +0 -0
  16. data/lib/bookshop/generators/bookshop/app/templates/book/assets/js/.empty_directory +0 -0
  17. data/lib/bookshop/generators/bookshop/app/templates/book/book.html.erb +13 -6
  18. data/lib/bookshop/generators/bookshop/app/templates/book/ch01/adding_images.html.erb +1 -1
  19. data/lib/bookshop/generators/bookshop/app/templates/book/cover.html.erb +1 -1
  20. data/lib/bookshop/generators/bookshop/app/templates/builds/epub/META-INF/.empty_directory +0 -0
  21. data/lib/bookshop/generators/bookshop/app/templates/builds/epub/META-INF/container.xml +6 -0
  22. data/lib/bookshop/generators/bookshop/app/templates/builds/epub/OEBPS/.empty_directory +0 -0
  23. data/lib/bookshop/generators/bookshop/app/templates/builds/epub/mimetype +1 -0
  24. data/lib/bookshop/generators/bookshop/app/templates/config/book.yml +2 -2
  25. data/lib/bookshop/generators/bookshop/app/templates/script/bookshop +1 -0
  26. data/lib/bookshop/version.rb +1 -1
  27. metadata +44 -26
@@ -0,0 +1,451 @@
1
+ /* Sample style sheet for boom!, the book microformat */
2
+ /* written by Hakon Wium Lie and Bert Bos, November 2005 */
3
+ /* You may reuse this style sheet for any purpose without any fees */
4
+
5
+
6
+ html {
7
+ margin: 0;
8
+ font: 10pt/1.26 "Gill Sans", sans-serif;
9
+ }
10
+
11
+ body {
12
+ margin: 0 0 0 28%;
13
+ }
14
+
15
+ h1, h2, h3, h4, h5, h6 {
16
+ font-family: "Gill Sans", sans-serif;
17
+ margin: 2em 0 0.5em 0;
18
+ page-break-after: avoid;
19
+ }
20
+
21
+ h1 {
22
+ padding: 2em 0 2em 0;
23
+ margin: 0;
24
+ font-size: 2.4em;
25
+ font-weight: 900;
26
+ }
27
+
28
+ h2 {
29
+ font-size: 1.2em;
30
+ text-transform: uppercase;
31
+ font-weight: bold;
32
+ }
33
+
34
+ h3 {
35
+ font-size: 1em;
36
+ font-weight: bold;
37
+ }
38
+
39
+ q::before {
40
+ content: "\201C";
41
+ }
42
+
43
+ q::after {
44
+ content: "\201D";
45
+ }
46
+
47
+ p { margin: 0 0 .5em 0 }
48
+ p + p { text-indent: 1.3em }
49
+ p.sidenote + p, p.caption, p.art { text-indent: 0; }
50
+
51
+ p.author {
52
+ margin-top: 2em;
53
+ text-indent: 0;
54
+ text-align: right;
55
+ }
56
+
57
+ pre { margin: 1em 1.3em; }
58
+
59
+ a { text-decoration: underline; color: blue }
60
+
61
+ /* cross-references */
62
+
63
+ a.pageref::after { content: " on page " target-counter(attr(href), page); }
64
+ a.chapref::before { content: " Chapter " target-counter(attr(href), chapter) ", "; }
65
+ a.figref { content: " Figure " target-counter(attr(href), figure); }
66
+ a.tableref { content: " Table " target-counter(attr(href), figure); }
67
+
68
+ /* sidenotes */
69
+
70
+ .sidenote {
71
+ float: left;
72
+ clear: left;
73
+ margin: 0 0 1em -41%;
74
+ width: 37%;
75
+ font-size: 0.9em;
76
+ font-style: normal;
77
+ text-indent: 0;
78
+ text-align: right;
79
+ page-break-inside: avoid;
80
+ }
81
+
82
+ /* sidebars */
83
+
84
+ div.sidebar {
85
+ float: top-next;
86
+ margin: 1.2em 0 1.2em 0;
87
+ border: thin solid;
88
+ background: #CCC;
89
+ padding: 0.5em 1em;
90
+ page-break-inside: avoid;
91
+ column-count: 2;
92
+ column-gap: 1.5em;
93
+ }
94
+
95
+ div.sidebar h2 {
96
+ margin-top: 0;
97
+ }
98
+
99
+ /* figures and tables*/
100
+
101
+ div.figure {
102
+ margin: 1em 0;
103
+ counter-increment: figure;
104
+ }
105
+
106
+ div.figure .caption, div.table .caption {
107
+ float: left;
108
+ clear: left;
109
+ width: 37%;
110
+ text-align: right;
111
+ font-size: 0.9em;
112
+ margin: 0 0 1.2em -40%;
113
+ }
114
+
115
+ div.figure .caption::before {
116
+ content: "Figure " counter(figure) ": ";
117
+ font-weight: bold;
118
+ }
119
+
120
+ div.table .caption::before {
121
+ content: "Table " counter(table) ": ";
122
+ font-weight: bold;
123
+ }
124
+
125
+ div.table {
126
+ margin: 1em 0;
127
+ counter-increment: table;
128
+ }
129
+
130
+ div.table th {
131
+ text-align: left;
132
+ }
133
+
134
+ table th, table td {
135
+ text-align: left;
136
+ padding-right: 1em;
137
+ }
138
+
139
+ table.lined td, table.lined th {
140
+ border-top: none;
141
+ border-bottom: thin dotted;
142
+ padding-top: 0.2em;
143
+ padding-bottom: 0.2em;
144
+ }
145
+
146
+
147
+ @page {
148
+ margin: 27mm 25mm 27mm 25mm;
149
+ size: 6in 9in;
150
+
151
+ @footnotes {
152
+ border-top: thin solid black;
153
+ padding-top: 0.3em;
154
+ margin-top: 0.6em;
155
+ margin-left: 30%;
156
+ }
157
+ }
158
+
159
+
160
+ /* define default page and names pages: cover, blank, frontmatter */
161
+
162
+ @page :left {
163
+ @top-left {
164
+ font: 11pt "Gill Sans", serif;
165
+ content: "Cascading Style Sheets";
166
+ vertical-align: bottom;
167
+ padding-bottom: 2em;
168
+ }
169
+
170
+ @bottom-left {
171
+ font: 11pt "Gill Sans", serif;
172
+ content: counter(page);
173
+ padding-top: 2em;
174
+ vertical-align: top;
175
+ }
176
+ }
177
+
178
+ @page :right {
179
+ @top-right {
180
+ font: 11pt "Gill Sans", serif;
181
+ content: string(header, first);
182
+ vertical-align: bottom;
183
+ padding-bottom: 2em;
184
+ }
185
+
186
+ @bottom-right {
187
+ font: 11pt "Gill Sans", serif;
188
+ content: counter(page);
189
+ text-align: right;
190
+ vertical-align: top;
191
+ padding-top: 2em;
192
+ }
193
+ }
194
+
195
+ @page frontmatter :left {
196
+ @top-left {
197
+ font: 11pt "Gill Sans", serif;
198
+ content: string(title);
199
+ vertical-align: bottom;
200
+ padding-bottom: 2em;
201
+ }
202
+
203
+ @bottom-left {
204
+ font: 11pt "Gill Sans", serif;
205
+ content: counter(page, lower-roman);
206
+ padding-top: 2em;
207
+ vertical-align: top;
208
+ }
209
+ }
210
+
211
+ @page cover { margin: 0; background-color: grey;}
212
+
213
+ @page frontmatter :right {
214
+ @top-right {
215
+ font: 11pt "Gill Sans", serif;
216
+ content: string(header, first);
217
+ vertical-align: bottom;
218
+ padding-bottom: 2em;
219
+ }
220
+
221
+ @bottom-right {
222
+ font: 11pt "Gill Sans", serif;
223
+ content: counter(page, lower-roman);
224
+ text-align: right;
225
+ vertical-align: top;
226
+ padding-top: 2em;
227
+ }
228
+ }
229
+
230
+ @page blank :left {
231
+ @top-left { content: normal }
232
+ @bottom-left { content: normal }
233
+ }
234
+
235
+ @page blank :right {
236
+ @top-right { content: normal }
237
+ @bottom-right { content: normal }
238
+ }
239
+
240
+ /* footnotes */
241
+
242
+ .footnote {
243
+ display: none; /* default rule */
244
+
245
+ display: prince-footnote; /* prince-specific rules */
246
+ position: footnote;
247
+ footnote-style-position: inside;
248
+
249
+ counter-increment: footnote;
250
+ margin-left: 1.4em;
251
+ font-size: 90%;
252
+ line-height: 1.4;
253
+ }
254
+
255
+ .footnote::footnote-call {
256
+ vertical-align: super;
257
+ font-size: 80%;
258
+ }
259
+
260
+ .footnote::footnote-marker {
261
+ vertical-align: super;
262
+ color: green;
263
+ padding-right: 0.4em;
264
+ }
265
+
266
+
267
+ /*
268
+ A book consists of different types of sections. We propose to use
269
+ DIV elements with these class names:
270
+
271
+ frontcover
272
+ halftitlepage: contains the title of the book
273
+ titlepage: contains the title of the book, name of author(s) and publisher
274
+ imprint: left page with copyright, publisher, library printing information
275
+ dedication: right page with short dedication
276
+ foreword: written by someone other than the author(s)
277
+ toc: table of contents
278
+ preface: preface, including acknowledgements
279
+ chapter: each chapter is given its own DIV element
280
+ references: contains list of references
281
+ appendix: each appendix is given its own
282
+ bibliography
283
+ glossary
284
+ index
285
+ colophon: describes how the book was produced
286
+ backcover
287
+
288
+ A book will use several of the types listed above, but few books
289
+ will use all of them.
290
+ */
291
+
292
+ /* which section uses which named page */
293
+
294
+ div.halftitlepage, div.titlepage, div.imprint, div.dedication { page: blank }
295
+ div.foreword, div.toc, div.preface { page: frontmatter }
296
+
297
+
298
+ /* page breaks */
299
+
300
+ div.frontcover, div.halftitlepage, div.titlepage { page-break-before: right }
301
+ div.imprint { page-break-before: always }
302
+ div.dedication, div.foreword, div.toc, div.preface, div.chapter, div.reference,
303
+ div.appendix, div.bibliography, div.glossary, div.index, div.colophon {
304
+ page-break-before: always
305
+ }
306
+ div.backcover { page-break-before: left }
307
+
308
+ /* the front cover; this code is probably not very reusable by other books */
309
+
310
+ div.frontcover { page: cover; }
311
+
312
+ div.frontcover img {
313
+ position: absolute;
314
+ width: 7in; height: 9.25in;
315
+ left: 0; top: 0;
316
+ z-index: -1;
317
+ }
318
+
319
+ div.frontcover h1 {
320
+ position: absolute;
321
+ left: 2cm; top: 1cm;
322
+ color: white;
323
+ font-size: 44pt;
324
+ font-weight: normal;
325
+ }
326
+
327
+ div.frontcover h2 {
328
+ position: absolute;
329
+ right: 0; top: 5cm;
330
+ color: black;
331
+ background: white;
332
+ font-size: 16pt;
333
+ font-weight: normal;
334
+ padding: 0.2em 5em 0.2em 1em;
335
+ letter-spacing: 0.15em;
336
+ }
337
+
338
+ div.frontcover h3 {
339
+ position: absolute;
340
+ left: 2cm; top: 7cm;
341
+ color: white;
342
+ font-size: 24pt;
343
+ font-weight: normal;
344
+ }
345
+
346
+ div.frontcover p {
347
+ position: absolute;
348
+ left: 2cm; bottom: 1.5cm;
349
+ font-size: 24pt;
350
+ color: black;
351
+ font-weight: bold;
352
+ text-transform: uppercase;
353
+ }
354
+
355
+
356
+ /* titlepage, halftitlepage */
357
+
358
+ div.titlepage h1, div.halftitlepage h1 { margin-bottom: 2em; }
359
+ div.titlepage h2, div.halftitlepage h2 { font-size: 1.2em; margin-bottom: 3em; }
360
+ div.titlepage h3, div.halftitlepage h3 { font-size: 1em; margin-bottom: 3em; }
361
+ div.titlepage p, div.halftitlepage p {
362
+ font-size: 1.4em;
363
+ font-weight: bold;
364
+ margin: 0; padding: 0;
365
+ }
366
+
367
+
368
+ /* TOC */
369
+
370
+ ul.toc, ul.toc ul {
371
+ list-style-type: none;
372
+ margin: 0; padding: 0;
373
+ }
374
+ ul.toc ul {
375
+ margin-left: 1em;
376
+ font-weight: normal;
377
+ }
378
+ ul.toc > li {
379
+ font-weight: bold;
380
+ margin-bottom: 0.5em;
381
+ }
382
+ ul.toc a::after {
383
+ content: leader('.') target-counter(attr(href), page);
384
+ font-style: normal;
385
+ }
386
+ ul.toc > li.frontmatter a::after {
387
+ content: leader('.') target-counter(attr(href), page, lower-roman);
388
+ font-style: normal;
389
+ }
390
+ ul.toc > li.endmatter a::after {
391
+ content: leader('.') target-counter(attr(href), page);
392
+ font-style: normal;
393
+ }
394
+ ul.toc > li.chapter::before {
395
+ content: "Chapter " counter(toc-chapter, decimal);
396
+ display: block;
397
+ margin: 1em 0 0.1em -2.5cm;
398
+ font-weight: normal;
399
+ counter-increment: toc-chapter;
400
+ page-break-after: avoid;
401
+ }
402
+
403
+ /* chapter numbers */
404
+
405
+ div.chapter { counter-increment: chapter; }
406
+
407
+ h1::before {
408
+ white-space: pre;
409
+ margin-left: -2.5cm;
410
+ font-size: 50%;
411
+ content: "\B0 \B0 \B0 \B0 \B0 \A"; /* ornaments */
412
+ }
413
+
414
+ div.chapter h1::before { content: "Chapter " counter(chapter) " \A"; }
415
+
416
+ div.frontcover h1::before, div.titlepage h1::before, div.halftitlepage h1::before {
417
+ content: normal; /* that is, none */
418
+ }
419
+
420
+ h1 { string-set: header content();}
421
+ div.chapter h1 { string-set: header "Chapter " counter(chapter) ": " content(); }
422
+
423
+ /* index */
424
+
425
+ ul.index {
426
+ list-style-type: none;
427
+ margin: 0; padding: 0;
428
+ column-count: 2;
429
+ column-gap: 1em;
430
+ }
431
+
432
+ ul.index a::after { content: ", " target-counter(attr(href), page); }
433
+
434
+
435
+ span.element, span.attribute {
436
+ text-transform: uppercase;
437
+ font-weight: bold;
438
+ font-size: 80%;
439
+ }
440
+ span.property { font-weight: bold }
441
+ code, span.css, span.value, span.declaration {
442
+ font: 90% "Lucida Console", "Lucida Sans Typewriter", monospace;
443
+ }
444
+
445
+
446
+ @media screen, handheld {
447
+ html { margin: 1em; font: 14px "Gill Sans", sans-serif; }
448
+ h1 { margin-bottom: 0.5em }
449
+ div.frontcover, div.halftitlepage, div.titlepage, div.imprint,
450
+ div.dedication, div.foreword, div.toc, div.index { display: none }
451
+ }
@@ -1,11 +1,16 @@
1
1
  <!--?xml version="1.0" encoding="iso-8859-1"?-->
2
2
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html><head>
4
- <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
5
- <meta name="pdfkit-orientation" content="Portrait" />
6
- <meta name="pdfkit-page_size" content="Letter" />
7
- <title>how-to bookshop</title>
8
- <link rel="stylesheet" type="text/css" href="css/stylesheet.css" />
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
6
+ <meta name="pdfkit-orientation" content="Portrait" />
7
+ <meta name="pdfkit-page_height" content="9in" />
8
+ <meta name="pdfkit-page_width" content="6in" />
9
+ <title>how-to bookshop</title>
10
+ <link rel="stylesheet" type="text/css" href="assets/css/stylesheet.<%= @output %>.css" />
11
+ <% if @output != :pdf %>
12
+ <link rel="stylesheet" type="application/vnd.adobe-page-template+xml" href="assets/css/page-template.xpgt"/>
13
+ <% end %>
9
14
  </head>
10
15
  <body>
11
16
  <p><a name="title">New Title:</a>
@@ -13,6 +18,8 @@
13
18
  <%= @book.html.title %>
14
19
  <% elsif @output == :pdf %>
15
20
  <%= @book.pdf.title %>
21
+ <% elsif @output == :epub %>
22
+ <%= @book.epub.title %>
16
23
  <% end %></p>
17
24
  <p>Subtitle: <%= @book.subtitle %></p>
18
25
  <p>ISBN: <%= @book.isbn %></p>
@@ -11,5 +11,5 @@ documents with the <span class="element">img</span> element &#8211;
11
11
 
12
12
  <div class="figure" id="fig-loaded">
13
13
  <p class="caption">The image has been loaded.</p>
14
- <p class="art"><img alt="[image]" src="images/html-18.png" style="width: 100%;"></p>
14
+ <p class="art"><img alt="[image]" src="../assets/images/html-18.png" style="width: 100%;"></p>
15
15
  </div>
@@ -1,5 +1,5 @@
1
1
  <div class="frontcover">
2
- <img src="images/canvas.jpg">
2
+ <img src="assets/images/canvas.jpg">
3
3
  <h1>Cascading Style Sheets</h1>
4
4
  <h2>Designing for the Web</h2>
5
5
  <h3>Third Edition</h3>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
3
+ <rootfiles>
4
+ <rootfile full-path="OEBPS/content.opf" media-type="application/oebps-package+xml"/>
5
+ </rootfiles>
6
+ </container>
@@ -0,0 +1 @@
1
+ application/epub+zip
@@ -26,12 +26,12 @@ pdf:
26
26
  # Place the epub specific settings here.
27
27
  epub:
28
28
  version: 0.0.1
29
- title: Bookshop (eBook)
29
+ title: Bookshop ePub Version
30
30
 
31
31
 
32
32
  # Place the html specific settings here
33
33
  html:
34
- title: Bookshop (HTML version)
34
+ title: Bookshop HTML version
35
35
 
36
36
 
37
37
  # You can add any additional variables you want
@@ -1,3 +1,4 @@
1
1
  # This command will automatically be run when you run "bookshop" with Bookshop gem installed from the root of your application.
2
2
 
3
+ APP_PATH = File.expand_path('../../', __FILE__)
3
4
  require 'bookshop/commands'
@@ -1,3 +1,3 @@
1
1
  module Bookshop
2
- VERSION = "0.0.21"
2
+ VERSION = "0.0.22"
3
3
  end