bookshop 0.0.19 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,106 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="PragmaticMagazine">
3
+ <metadata xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dc="http://purl.org/dc/elements/1.1/">
4
+ <dc:language>en</dc:language>
5
+ <dc:title>PragPub 2011-11: Issue #29</dc:title>
6
+ <dc:creator opf:role="aut">The Pragmatic Bookshelf</dc:creator>
7
+ <dc:date>2011-11-01</dc:date>
8
+ <dc:publisher>The Pragmatic Bookshelf, LLC</dc:publisher>
9
+ <dc:rights>
10
+ Copyright © The Pragmatic Bookshelf, LLC
11
+ </dc:rights>
12
+ <dc:identifier id="PragmaticMagazine" opf:scheme="pragmatic">November 2011</dc:identifier>
13
+ <dc:subject>PragPub—Monthly Magazine</dc:subject>
14
+ <meta name="cover" content="cover-image"/>
15
+ </metadata>
16
+ <manifest>
17
+ <item id="magazine-css" href="css/magazine.css" media-type="text/css"/>
18
+ <item id="pt" href="page-template.xpgt" media-type="application/vnd.adobe-page-template+xml"/>
19
+ <item id="cover" href="cover.xhtml" media-type="application/xhtml+xml"/>
20
+ <item id="cover-image" href="images/cover.jpg" media-type="image/jpeg"/>
21
+ <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
22
+ <item id="f_0000"
23
+ href="f_0000.html"
24
+ media-type="application/xhtml+xml" />
25
+
26
+ <item id="f_0001"
27
+ href="f_0001.html"
28
+ media-type="application/xhtml+xml" />
29
+
30
+ <item id="f_0002"
31
+ href="f_0002.html"
32
+ media-type="application/xhtml+xml" />
33
+
34
+ <item id="f_0003"
35
+ href="f_0003.html"
36
+ media-type="application/xhtml+xml" />
37
+
38
+ <item id="f_0004"
39
+ href="f_0004.html"
40
+ media-type="application/xhtml+xml" />
41
+
42
+ <item id="f_0005"
43
+ href="f_0005.html"
44
+ media-type="application/xhtml+xml" />
45
+
46
+ <item id="f_0006"
47
+ href="f_0006.html"
48
+ media-type="application/xhtml+xml" />
49
+
50
+ <item id="f_0007"
51
+ href="f_0007.html"
52
+ media-type="application/xhtml+xml" />
53
+
54
+ <item id="f_0008"
55
+ href="f_0008.html"
56
+ media-type="application/xhtml+xml" />
57
+
58
+ <item id="f_0009"
59
+ href="f_0009.html"
60
+ media-type="application/xhtml+xml" />
61
+
62
+ <item id="f_0010"
63
+ href="f_0010.html"
64
+ media-type="application/xhtml+xml" />
65
+
66
+ <item id="f_0011"
67
+ href="f_0011.html"
68
+ media-type="application/xhtml+xml" />
69
+
70
+ <item id="f_0012"
71
+ href="f_0012.html"
72
+ media-type="application/xhtml+xml" />
73
+
74
+ <item id="img1" href="images/actionshot-november.jpg" media-type="image/jpeg"/>
75
+ <item id="img2" href="images/XcodeSettings.jpg" media-type="image/jpeg"/>
76
+ <item id="img3" href="images/RefactorToARC.jpg" media-type="image/jpeg"/>
77
+ <item id="img4" href="images/ScreenShot.jpg" media-type="image/jpeg"/>
78
+ <item id="img5" href="images/bigger-than-we-thought.jpg" media-type="image/jpeg"/>
79
+ <item id="img6" href="images/self-infliced-scope-creep.jpg" media-type="image/jpeg"/>
80
+ <item id="img7" href="images/why-is-this-going-up.jpg" media-type="image/jpeg"/>
81
+ <item id="img8" href="images/Brian1.jpg" media-type="image/jpeg"/>
82
+ <item id="img9" href="images/Brian2.jpg" media-type="image/jpeg"/>
83
+ <item id="img10" href="images/Brian3.jpg" media-type="image/jpeg"/>
84
+ <item id="img11" href="images/new-in-pragpub.jpg" media-type="image/jpeg"/>
85
+ <item id="img12" href="images/new-on-bookshelf.jpg" media-type="image/jpeg"/>
86
+ </manifest>
87
+ <spine toc="ncx">
88
+ <itemref idref="cover" linear="no"/>
89
+ <itemref idref="f_0000" />
90
+ <itemref idref="f_0001" />
91
+ <itemref idref="f_0002" />
92
+ <itemref idref="f_0003" />
93
+ <itemref idref="f_0004" />
94
+ <itemref idref="f_0005" />
95
+ <itemref idref="f_0006" />
96
+ <itemref idref="f_0007" />
97
+ <itemref idref="f_0008" />
98
+ <itemref idref="f_0009" />
99
+ <itemref idref="f_0010" />
100
+ <itemref idref="f_0011" />
101
+ <itemref idref="f_0012" />
102
+ </spine>
103
+ <guide>
104
+ <reference type="cover" title="Cover" href="cover.xhtml"/>
105
+ </guide>
106
+ </package>
@@ -0,0 +1,48 @@
1
+ <ade:template xmlns="http://www.w3.org/1999/xhtml" xmlns:ade="http://ns.adobe.com/2006/ade"
2
+ xmlns:fo="http://www.w3.org/1999/XSL/Format">
3
+
4
+ <fo:layout-master-set>
5
+
6
+ <fo:simple-page-master master-name="single_column">
7
+ <fo:region-body margin-bottom="3pt" margin-top="3pt" margin-left="3pt" margin-right="3pt"/>
8
+ </fo:simple-page-master>
9
+
10
+ <fo:simple-page-master master-name="two_column"
11
+ margin-bottom="0.5em" margin-top="0.5em" margin-left="0.5em" margin-right="0.5em">
12
+ <fo:region-body column-count="2" column-gap="10pt"/>
13
+ </fo:simple-page-master>
14
+
15
+ <fo:simple-page-master master-name="two_column_head"
16
+ margin-bottom="0.5em" margin-left="0.5em" margin-right="0.5em">
17
+ <fo:region-before extent="8.3em"/>
18
+ <fo:region-body column-count="2" margin-top="8.7em" column-gap="10pt"/>
19
+ </fo:simple-page-master>
20
+
21
+ <fo:simple-page-master master-name="three_column"
22
+ margin-bottom="0.5em" margin-top="0.5em" margin-left="0.5em" margin-right="0.5em">
23
+ <fo:region-body column-count="3" column-gap="10pt"/>
24
+ </fo:simple-page-master>
25
+
26
+ <fo:simple-page-master master-name="three_column_head"
27
+ margin-bottom="0.5em" margin-top="0.5em" margin-left="0.5em" margin-right="0.5em">
28
+ <fo:region-before extent="8.3em"/>
29
+ <fo:region-body column-count="3" margin-top="8.7em" column-gap="10pt"/>
30
+ </fo:simple-page-master>
31
+
32
+ <fo:page-sequence-master>
33
+ <fo:repeatable-page-master-alternatives>
34
+ <fo:conditional-page-master-reference master-reference="three_column_head" page-position="first" ade:min-page-width="80em"/>
35
+ <fo:conditional-page-master-reference master-reference="three_column" ade:min-page-width="80em"/>
36
+ <fo:conditional-page-master-reference master-reference="two_column_head" page-position="first" ade:min-page-width="50em"/>
37
+ <fo:conditional-page-master-reference master-reference="two_column" ade:min-page-width="50em"/>
38
+ <fo:conditional-page-master-reference master-reference="single_column"/>
39
+ </fo:repeatable-page-master-alternatives>
40
+ </fo:page-sequence-master>
41
+
42
+ </fo:layout-master-set>
43
+
44
+ <ade:style>
45
+ <ade:styling-rule selector=".title_box" display="adobe-other-region" adobe-region="xsl-region-before"/>
46
+ </ade:style>
47
+
48
+ </ade:template>
@@ -0,0 +1,107 @@
1
+ <?xml version="1.0"?>
2
+ <ncx xmlns:calibre="http://calibre.kovidgoyal.net/2009/metadata" xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1" xml:lang="en">
3
+ <head>
4
+ <meta name="dtb:uid" content="<%= book.isbn %>"/>
5
+ <meta name="dtb:depth" content="1"/>
6
+ <meta name="dtb:totalPageCount" content="0"/>
7
+ <meta name="dtb:maxPageNumber" content="0"/>
8
+ </head>
9
+ <docTitle>
10
+ <text><%= book.epub.title %></text>
11
+ </docTitle>
12
+ <navMap>
13
+ <% for toc in toc do %>
14
+ <navPoint id="navPoint-0" playOrder="1">
15
+ <navLabel>
16
+ <text><%= toc.test %></text>
17
+ </navLabel>
18
+ <content src="book.html#<%= toc.name %>"/>
19
+ </navPoint>
20
+
21
+
22
+ <navPoint id="navPoint-1" playOrder="2">
23
+ <navLabel>
24
+ <text>Up Front</text>
25
+ </navLabel>
26
+ <content src="f_0001.html"/>
27
+ </navPoint>
28
+
29
+ <navPoint id="navPoint-2" playOrder="3">
30
+ <navLabel>
31
+ <text>Choice Bits</text>
32
+ </navLabel>
33
+ <content src="f_0002.html"/>
34
+ </navPoint>
35
+
36
+ <navPoint id="navPoint-3" playOrder="4">
37
+ <navLabel>
38
+ <text>Meet the Team</text>
39
+ </navLabel>
40
+ <content src="f_0003.html"/>
41
+ </navPoint>
42
+
43
+ <navPoint id="navPoint-4" playOrder="5">
44
+ <navLabel>
45
+ <text>Inside iOS 5</text>
46
+ </navLabel>
47
+ <content src="f_0004.html"/>
48
+ </navPoint>
49
+
50
+ <navPoint id="navPoint-5" playOrder="6">
51
+ <navLabel>
52
+ <text>Scala for the Intrigued</text>
53
+ </navLabel>
54
+ <content src="f_0005.html"/>
55
+ </navPoint>
56
+
57
+ <navPoint id="navPoint-6" playOrder="7">
58
+ <navLabel>
59
+ <text>Test-Driven Development</text>
60
+ </navLabel>
61
+ <content src="f_0006.html"/>
62
+ </navPoint>
63
+
64
+ <navPoint id="navPoint-7" playOrder="8">
65
+ <navLabel>
66
+ <text>Self-Inflicted Scope Creep</text>
67
+ </navLabel>
68
+ <content src="f_0007.html"/>
69
+ </navPoint>
70
+
71
+ <navPoint id="navPoint-8" playOrder="9">
72
+ <navLabel>
73
+ <text>Root Cause Analysis from Long Ago</text>
74
+ </navLabel>
75
+ <content src="f_0008.html"/>
76
+ </navPoint>
77
+
78
+ <navPoint id="navPoint-9" playOrder="10">
79
+ <navLabel>
80
+ <text>When Did That Happen?</text>
81
+ </navLabel>
82
+ <content src="f_0009.html"/>
83
+ </navPoint>
84
+
85
+ <navPoint id="navPoint-10" playOrder="11">
86
+ <navLabel>
87
+ <text>Calendar</text>
88
+ </navLabel>
89
+ <content src="f_0010.html"/>
90
+ </navPoint>
91
+
92
+ <navPoint id="navPoint-11" playOrder="12">
93
+ <navLabel>
94
+ <text>Shady Illuminations</text>
95
+ </navLabel>
96
+ <content src="f_0011.html"/>
97
+ </navPoint>
98
+
99
+ <navPoint id="navPoint-12" playOrder="13">
100
+ <navLabel>
101
+ <text>But Wait, There ’s More...</text>
102
+ </navLabel>
103
+ <content src="f_0012.html"/>
104
+ </navPoint>
105
+
106
+ </navMap>
107
+ </ncx>
@@ -0,0 +1 @@
1
+ application/epub+zip
@@ -1,4 +1,4 @@
1
- # Take a YAML data structure and express it in a 'class.method.method' convention so
1
+ # Take a YAML data structure and express it in a 'class.attribute.attribute' convention so
2
2
  # it can be passed to the build command, used in the source files to call data
3
3
  # from the book.yml file
4
4
  #
@@ -7,37 +7,41 @@
7
7
  # bar: foobar
8
8
  #
9
9
  # is referenced in the source files as <%= book.foo.bar %> and yields in build 'foobar'
10
- class Book
10
+ module Bookshop
11
+ module Commands
12
+ class Book
11
13
 
12
- def initialize(data={})
13
- @data = {}
14
- update!(data)
15
- end
14
+ def initialize(data={})
15
+ @data = {}
16
+ update!(data)
17
+ end
16
18
 
17
- def update!(data)
18
- data.each do |key, value|
19
- self[key] = value
20
- end
21
- end
19
+ def update!(data)
20
+ data.each do |key, value|
21
+ self[key] = value
22
+ end
23
+ end
22
24
 
23
- def [](key)
24
- @data[key.to_sym]
25
- end
25
+ def [](key)
26
+ @data[key.to_sym]
27
+ end
26
28
 
27
- def []=(key, value)
28
- if value.class == Hash
29
- @data[key.to_sym] = Book.new(value)
30
- else
31
- @data[key.to_sym] = value
32
- end
33
- end
29
+ def []=(key, value)
30
+ if value.class == Hash
31
+ @data[key.to_sym] = Book.new(value)
32
+ else
33
+ @data[key.to_sym] = value
34
+ end
35
+ end
36
+
37
+ def method_missing(sym, *args)
38
+ if sym.to_s =~ /(.+)=$/
39
+ self[$1] = args.first
40
+ else
41
+ self[sym]
42
+ end
43
+ end
34
44
 
35
- def method_missing(sym, *args)
36
- if sym.to_s =~ /(.+)=$/
37
- self[$1] = args.first
38
- else
39
- self[sym]
40
45
  end
41
46
  end
42
-
43
47
  end
@@ -0,0 +1,46 @@
1
+ # Take a YAML data structure and express it in a 'class.attribute.attribute' convention so
2
+ # it can be used in the source files to call data from the toc.yml file
3
+ #
4
+ # # toc.yml
5
+ # foo:
6
+ # bar: foobar
7
+ #
8
+ # is referenced in the source files as <%= toc.foo.bar %> and yields in build 'foobar'
9
+ module Bookshop
10
+ module Commands
11
+ class Toc
12
+
13
+ def initialize(data={})
14
+ @data = {}
15
+ update!(data)
16
+ end
17
+
18
+ def update!(data)
19
+ data.each do |key, value|
20
+ self[key] = value
21
+ end
22
+ end
23
+
24
+ def [](key)
25
+ @data[key.to_sym]
26
+ end
27
+
28
+ def []=(key, value)
29
+ if value.class == Hash
30
+ @data[key.to_sym] = Book.new(value)
31
+ else
32
+ @data[key.to_sym] = value
33
+ end
34
+ end
35
+
36
+ def method_missing(sym, *args)
37
+ if sym.to_s =~ /(.+)=$/
38
+ self[$1] = args.first
39
+ else
40
+ self[sym]
41
+ end
42
+ end
43
+
44
+ end
45
+ end
46
+ end
@@ -1,12 +1,18 @@
1
- == Welcome to bookshop
1
+ === http://blueheadpublishing.github.com/bookshop/assets/logo.png
2
2
 
3
- bookShop is a publishing framework for html-to-pdf/(e)book toolchain happiness and sustainable productivity. The framework is optimized to help developers quickly ramp-up, allowing them to more rapidly jump in and develop their html-to-pdf/(e)book (print-pdf, epub, mobi, etc.) flows, by favoring convention over configuration, setting them up with best practices, standards and tools from the start.
3
+ "a book publishing framework for today's publishing world"
4
+
5
+ bookshop is a book publishing framework for publishers, editors, and coders in today's publishing industry. bookshop provides a framework for developing books using well-known/standard web languages like HTML/CSS, which are then converted into pdf and other (e)book formats. The framework is optimized to help developers quickly ramp-up, allowing them to jump in and develop their html-to-pdf/(e)book flows, by favoring convention over configuration, setting them up with best-practices, standards and tools from the start.
4
6
 
5
7
  bookshop hopes to simplify the process by:
6
- * using common tools like HTML, CSS, etc. to make the creation of your book comfortable and familiar, greatly reducing the learning curve for your developers, authors, agents, and other team members
7
- * providing a Ruby Gem to make building a book from HTML as easy as 'gem install bookshop'
8
+ * separating the book into layers
9
+ * *Content*: the book's source - <i>writings, images, videos, copy</i>
10
+ * *Structure*: using div/css microformat to describe the book's structure - <i>chapter, section, etc.</i>
11
+ * *Style*: stylesheets to create the book's layout - <i>fonts, margins, color, etc.</i>
12
+ * using common tools like HTML/CSS to make the creation of your book comfortable and familiar, greatly reducing the learning curve for your developers, authors, agents, and other team members
13
+ * providing a Ruby Gem to make building a book in HTML as easy as 'gem install bookshop'
8
14
  * pulling all the html-to-pdf/(e)book tools together into one place (wkhtmltopdf, kindlegen, epubcheck)
9
- * sticking with open-source tools
15
+ * sticking with open-source tools to encourage community development
10
16
  * giving the developer a set of scripts to automate the redundant stuff
11
17
  * providing an architecture/structure that follows best-practices and simplification (DRY... Don't Repeat Yourself)
12
18
 
@@ -14,8 +20,7 @@ bookshop hopes to simplify the process by:
14
20
 
15
21
  === System Requirements
16
22
 
17
- * Ruby v1.8.7 or v1.9.2 http://www.ruby-lang.org/en/downloads/
18
- * Rubygems v1.3.6 http://docs.rubygems.org/read/chapter/3
23
+ * Ruby v1.8.7 or higher http://www.ruby-lang.org/en/downloads/
19
24
 
20
25
  == Installation
21
26
 
@@ -25,13 +30,13 @@ bookshop hopes to simplify the process by:
25
30
 
26
31
  === Install wkhtmltopdf
27
32
 
28
- 1. Install by hand (recommended):
33
+ 1. Try using the wkhtmltopdf-binary gem (mac + linux i386)
29
34
 
30
- https://github.com/blueheadpublishing/bookshop/wiki/Installing-wkhtmltopdf
35
+ $ gem install wkhtmltopdf-binary
31
36
 
32
- 2. Try using the wkhtmltopdf-binary gem (mac + linux i386)
37
+ 2. Install by hand (for windows or users who want to install newer builds):
33
38
 
34
- $ gem install wkhtmltopdf-binary
39
+ https://github.com/blueheadpublishing/bookshop/wiki/Installing-wkhtmltopdf
35
40
 
36
41
  3. The wkhtmltopdf site has more info
37
42
 
@@ -39,18 +44,30 @@ https://github.com/blueheadpublishing/bookshop/wiki/Installing-wkhtmltopdf
39
44
 
40
45
  == Using bookshop
41
46
 
42
- === Create a bookshop application
47
+ === Create a bookshop book
43
48
 
44
- $ bookshop new name_of_book
49
+ $ bookshop new my_new_book
45
50
 
46
- This will create a new bookshop app in /path/to/name_of_book
47
-
48
- * If you can't issue bookshop from your command line, make sure you have included your gems folder in your system $PATH. In unix you can add the following to your .bashrc file in your home folder (this example is for Ubuntu 10.10):
51
+ This will create a new bookshop book in /path/to/my_new_book with the following structure:
52
+
53
+ |-- book/ # Source files for your book
54
+ |--book.html.erb # The master file
55
+ |--css/
56
+ |--stylesheet.css
57
+ |--images/
58
+
59
+ |-- builds/ # All the builds are created here
60
+ |--epub/
61
+ |--html/
62
+ |--mobi/
63
+ |--pdf/
64
+
65
+ |-- config/ # Your config and data settings
66
+ |--book.yml # Settings/Data for your book
49
67
 
50
- PATH="$PATH:/var/lib/gems/1.8/bin"
51
- export PATH
52
68
 
53
69
  === Editing Your New Book
70
+
54
71
  ==== Where does my Book really live?
55
72
 
56
73
  All of the source documents and assets for your book are stored in the +book/+ folder. So your stylesheets, images, text - everything used for building your book - lives here. Ideally, you should only every edit files in your +book/+ folder (with the exception of your config/book.yml file).
@@ -59,23 +76,15 @@ All of the source documents and assets for your book are stored in the +book/+ f
59
76
 
60
77
  The source files are all in ERB. ERB is a templating language for the Ruby programming language. Why is this cool? Because it means that you can use HTML _and_ you can embed Ruby code in your source files. In other words, you can do all kinds of cool programmy things. Like embed ruby functions and calls:
61
78
 
62
- <p>Today is <%= Time.now.strftime('%A') %>.</p>
63
-
64
- or
79
+ <p>Today is <%= Time.now.strftime('%A') %>.</p> # creates -> <p>Today is Thursday.</p>
65
80
 
66
- items = [ "ball", "stick", "corgi" ]
67
-
68
- <ul>
69
- <% items.each do |item| %>
70
- <li><%= item %></li>
71
- <% end %>
72
- </ul>
81
+ More information on ERB - http://www.ruby-doc.org/stdlib-1.9.3/libdoc/erb/rdoc/ERB.html
73
82
 
74
83
  ==== One File to Rule Them All!
75
84
 
76
85
  Your master file (which is used to build everything) is the +book.html.erb+ file (remember that we are in the +book/+ folder). You could of course just use this file and put all of your book contents here, making one enormous file, but we don't recommend it...
77
86
 
78
- ==== The Magic of include()
87
+ ==== The Magic of import()
79
88
 
80
89
  Are you writing another "War and Peace"? We've created a nice way to make your epic book easier to manage. Rather than putting everything in the +book.html.erb+ file, you can +import+ files. This allows you to break your book up into smaller, more manageable pieces. This makes it soooooo much easier to manage your book. And others will thank you for it..
81
90
 
@@ -147,9 +156,9 @@ Here's an example +config/book.yml+ file with some Book Variables:
147
156
 
148
157
  You can then use these Book Variables in your book source file:
149
158
 
150
- <p>The book isbn is <%= book.isbn %></p>
151
- <p>The html title is <%= book.html.title %></p>
152
- <p>The epub pub_date is <%= book.epub.pub_date %></p>
159
+ <p>The book isbn is <%= @book.isbn %></p>
160
+ <p>The html title is <%= @book.html.title %></p>
161
+ <p>The epub pub_date is <%= @book.epub.pub_date %></p>
153
162
 
154
163
  Note that you can construct and/or nest variables however you want to:
155
164
 
@@ -162,7 +171,7 @@ Note that you can construct and/or nest variables however you want to:
162
171
 
163
172
  Then call it in your source file with the variable:
164
173
 
165
- <p>My made up friend's name is <%= book.my.madeup.friend.name %>
174
+ <p>My made up friend's name is <%= @book.my.madeup.friend.name %>
166
175
 
167
176
  More info about YAML:
168
177
 
@@ -172,30 +181,68 @@ http://en.wikipedia.org/wiki/YAML
172
181
 
173
182
  So, do you want to see something cool? Now that we have the Output Variable and Book Variables, we can combine them to do nifty things, like:
174
183
 
175
- <p>The ISBN is <%= book.isbn %></p>
184
+ <p>The ISBN is <%= @book.isbn %></p>
176
185
  <p>Title:
177
186
  <% if @output == :html %>
178
- <%= book.html.title %>
187
+ <%= @book.html.title %>
179
188
  <% elsif @output == :pdf %>
180
- <%= book.pdf.title %>
189
+ <%= @book.pdf.title %>
181
190
  <% elsif @output == :epub %>
182
- <%= book.epub.title %>
191
+ <%= @book.epub.title %>
183
192
  <% end %>
184
193
  </p>
185
194
 
186
195
  Please explore other creative ways to structure and enhance your book (we'd love to see how you are doing it).
187
196
 
188
- http://www.ruby-doc.org/stdlib-1.9.3/libdoc/erb/rdoc/ERB.html
189
-
190
197
  === Building Your First Book
191
198
 
199
+ To build an HTML format of your book from the ERB source:
200
+
201
+ $ bookshop build html # -> find the output in builds/html/book_(date).html
202
+
192
203
  To build a pdf format of your book from the ERB source:
193
204
 
194
205
  $ bookshop build pdf # -> find the output in builds/pdf/book_(date).pdf
195
206
 
196
- To build an HTML format of your book from the ERB source:
207
+ ==== Editing your pdf document options
197
208
 
198
- $ bookshop build html # -> find the output in builds/html/book_(date).html
209
+ What if you want your pdf to print as Lanscape, or a different page-size, or in grayscale? Because bookshop uses PDFKit, you can pass wkhtmltopdf (the pdf rendering engine) options by way of <meta> tags in your html source code.
210
+
211
+ For example, to print in Landscape mode, in your master +book/book.html.erb+ file we can add <meta name="pdfkit-orientation" content="Landscape" />:
212
+
213
+ so you html would be:
214
+
215
+ <html>
216
+ <head>
217
+ <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
218
+ <meta name="pdfkit-orientation" content="Landscape" />
219
+ <title>how-to bookshop</title>
220
+ <link rel="stylesheet" type="text/css" href="css/stylesheet.css" />
221
+ </head>
222
+ <body>
223
+ <p>The ISBN is <%= @book.isbn %></p>
224
+
225
+ Here's a list of other options https://github.com/blueheadpublishing/bookshop/wiki/wkhtmltopdf-options
226
+
227
+ Or you can look at all of the possible wkhtmltopdf options by using the command:
228
+
229
+ $ wkhtmltopdf --extended-help
230
+
231
+ Your meta tags should use the following naming conventions.
232
+
233
+ * For each option, replace the double-dashes '--' before the option with +pdfkit-+ and change single-dashes '-' to an underscore +_+.
234
+ --page-size
235
+
236
+ becomes
237
+
238
+ <meta name="pdfkit-page_size" content="Letter" />
239
+
240
+ * For options that do not require an additional parameter/value, you still need to include the content attribute, but keep it blank.
241
+ --grayscale
242
+
243
+ becomes
244
+
245
+ <meta name="pdfkit-grayscale" content="" />
199
246
 
200
247
  == Example Book
201
248
 
@@ -213,14 +260,20 @@ You can then build the book into whatever format you like.
213
260
 
214
261
  The default directory structure of a generated bookshop project:
215
262
 
216
- |-- book
217
- |-- builds
218
- epub
219
- html
220
- mobi
221
- pdf
263
+ |-- book/ # Source files for your book
264
+ |--book.html.erb # The master file
265
+ |--css/
266
+ |--stylesheet.css
267
+ |--images/
268
+
269
+ |-- builds/ # All the builds are created here
270
+ |--epub/
271
+ |--html/
272
+ |--mobi/
273
+ |--pdf/
222
274
 
223
- |-- config
275
+ |-- config/ # Your config and data settings
276
+ |--book.yml # Settings/Data for your book
224
277
 
225
278
  book
226
279
  Holds all the manuscript html code/files. This is where your master manuscript lives from which everything is built.
@@ -249,9 +302,45 @@ config
249
302
  6. Let us know about your code and we'll review/merge it into the master.
250
303
  7. And pat yourself on the back for contributing to an open source project!!
251
304
 
252
- == Copyright (MIT-LICENSE)
305
+ == Copyright (LICENSE)
306
+
307
+ BookShop is available under *either* the terms of the modified BSD license *or* the
308
+ MIT License (2008). As a recipient of BookShop, you may choose which
309
+ license to receive this code under (except as noted in per-module LICENSE
310
+ files). Some modules may not be the copyright of BlueHead Publishing. These
311
+ modules contain explicit declarations of copyright in both the LICENSE files in
312
+ the directories in which they reside and in the code itself. No external
313
+ contributions are allowed under licenses which are fundamentally incompatible
314
+ with the MIT or BSD licenses that BookShop is distributed under.
315
+
316
+ The text of the MIT and BSD licenses is reproduced below.
317
+
318
+ === The "New" BSD License
319
+
320
+ Copyright (c) 2010-2011, BlueHead Publishing
321
+ All rights reserved.
322
+
323
+ Redistribution and use in source and binary forms, with or without
324
+ modification, are permitted provided that the following conditions are met:
325
+
326
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
327
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
328
+ * Neither the name of Bookshop/BlueHead/BlueHead Publishing nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
329
+
330
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
331
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
332
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
333
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
334
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
335
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
336
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
337
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
338
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
339
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
340
+
341
+ === The MIT License
253
342
 
254
- Copyright (C) 2010, 2011 by BlueHead Publishing, Inc (http://blueheadpublishing.com)
343
+ Copyright (c) 2010, 2011 BlueHead Publishing, et. al.,
255
344
 
256
345
  Permission is hereby granted, free of charge, to any person obtaining a copy
257
346
  of this software and associated documentation files (the "Software"), to deal
@@ -273,9 +362,9 @@ THE SOFTWARE.
273
362
 
274
363
  == The Boom Microformat License (as listed in the boom.css)
275
364
 
276
- Sample style sheet for boom!, the book microformat
277
- written by Hakon Wium Lie and Bert Bos, November 2005
278
- You may reuse this style sheet for any purpose without any fees
365
+ Sample style sheet for boom!, the book microformat
366
+ written by Hakon Wium Lie and Bert Bos, November 2005
367
+ You may reuse this style sheet for any purpose without any fees
279
368
 
280
369
  == Thanks
281
370