prophecy 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Released under the Creative Commons Attribution License.
9
9
  * http://creativecommons.org/licenses/by/3.0/ */
10
- /* line 22, ../sass/_byronic.sass */
10
+ /* line 26, ../sass/_byronic.sass */
11
11
  #content {
12
12
  font-family: "SourceSansPro", "Lucida Grande", "DejaVu Sans", "Bitstream Vera Sans", "Tahoma", "Palatino", "Caecilia", sans-serif;
13
13
  font-weight: normal;
@@ -17,21 +17,21 @@
17
17
  margin-right: 0;
18
18
  }
19
19
 
20
- /* line 33, ../sass/_byronic.sass */
20
+ /* line 37, ../sass/_byronic.sass */
21
21
  h1, h2, h3, h4, h5, h6 {
22
22
  font-weight: normal;
23
23
  font-family: "SourceSansPro", "Lucida Grande", "DejaVu Sans", "Bitstream Vera Sans", "Tahoma", "Palatino", "Caecilia", sans-serif;
24
24
  page-break-after: avoid;
25
25
  }
26
26
 
27
- /* line 38, ../sass/_byronic.sass */
27
+ /* line 42, ../sass/_byronic.sass */
28
28
  h1, h2 {
29
29
  text-align: left;
30
30
  text-transform: uppercase;
31
31
  padding-top: 10px;
32
32
  }
33
33
 
34
- /* line 45, ../sass/_byronic.sass */
34
+ /* line 49, ../sass/_byronic.sass */
35
35
  h1 {
36
36
  font-size: 2em;
37
37
  margin: 0.5em 0 1em 0px;
@@ -43,17 +43,17 @@ h1 {
43
43
  * chapter-name (always contains the word "Chapter") and
44
44
  * chapter-number (as a roman numeral) */
45
45
  }
46
- /* line 56, ../sass/_byronic.sass */
46
+ /* line 60, ../sass/_byronic.sass */
47
47
  h1 .chapter-name {
48
48
  font-weight: normal;
49
49
  }
50
- /* line 58, ../sass/_byronic.sass */
50
+ /* line 62, ../sass/_byronic.sass */
51
51
  h1 .chapter-number {
52
52
  font-size: 0.8em;
53
53
  letter-spacing: 0.1em;
54
54
  }
55
55
 
56
- /* line 62, ../sass/_byronic.sass */
56
+ /* line 66, ../sass/_byronic.sass */
57
57
  h2 {
58
58
  font-size: 1.5em;
59
59
  font-weight: 300;
@@ -62,16 +62,16 @@ h2 {
62
62
  letter-spacing: 1pt;
63
63
  }
64
64
 
65
- /* line 69, ../sass/_byronic.sass */
65
+ /* line 73, ../sass/_byronic.sass */
66
66
  h3, h4 {
67
67
  font-weight: bold;
68
68
  text-transform: none;
69
69
  margin-bottom: 0.1em;
70
70
  }
71
71
 
72
- /* line 74, ../sass/_byronic.sass */
72
+ /* line 78, ../sass/_byronic.sass */
73
73
  a {
74
- color: #323232;
74
+ color: #333333;
75
75
  }
76
76
 
77
77
  /* The main title page of the book.
@@ -82,13 +82,13 @@ a {
82
82
  * h1 - Part I
83
83
  * h2 - part title
84
84
  * h3 - part subtitle */
85
- /* line 89, ../sass/_byronic.sass */
85
+ /* line 93, ../sass/_byronic.sass */
86
86
  #content.title-page p,
87
87
  #content.part-page p {
88
88
  text-align: right;
89
89
  padding-right: 0px;
90
90
  }
91
- /* line 92, ../sass/_byronic.sass */
91
+ /* line 96, ../sass/_byronic.sass */
92
92
  #content.title-page h1, #content.title-page h2, #content.title-page h3,
93
93
  #content.part-page h1,
94
94
  #content.part-page h2,
@@ -97,13 +97,13 @@ a {
97
97
  text-align: right;
98
98
  text-transform: none;
99
99
  }
100
- /* line 96, ../sass/_byronic.sass */
100
+ /* line 100, ../sass/_byronic.sass */
101
101
  #content.title-page h1, #content.title-page h2,
102
102
  #content.part-page h1,
103
103
  #content.part-page h2 {
104
104
  letter-spacing: 1.5pt;
105
105
  }
106
- /* line 98, ../sass/_byronic.sass */
106
+ /* line 102, ../sass/_byronic.sass */
107
107
  #content.title-page h1,
108
108
  #content.part-page h1 {
109
109
  font-size: 2em;
@@ -114,7 +114,7 @@ a {
114
114
  padding-right: 0px;
115
115
  line-height: 1em;
116
116
  }
117
- /* line 106, ../sass/_byronic.sass */
117
+ /* line 110, ../sass/_byronic.sass */
118
118
  #content.title-page h2,
119
119
  #content.part-page h2 {
120
120
  font-size: 1.5em;
@@ -123,7 +123,7 @@ a {
123
123
  padding-top: 0.3em;
124
124
  padding-right: 0px;
125
125
  }
126
- /* line 112, ../sass/_byronic.sass */
126
+ /* line 116, ../sass/_byronic.sass */
127
127
  #content.title-page h3,
128
128
  #content.part-page h3 {
129
129
  font-size: 1.2em;
@@ -131,17 +131,17 @@ a {
131
131
  padding-right: 0px;
132
132
  }
133
133
 
134
- /* line 117, ../sass/_byronic.sass */
134
+ /* line 121, ../sass/_byronic.sass */
135
135
  div.title-page-rule {
136
136
  height: 40px;
137
137
  margin-left: 0;
138
138
  margin-right: 0;
139
- background-color: #cbcbcb;
139
+ background-color: #cccccc;
140
140
  text-align: right;
141
141
  padding-right: 0px;
142
142
  }
143
143
 
144
- /* line 125, ../sass/_byronic.sass */
144
+ /* line 129, ../sass/_byronic.sass */
145
145
  div.publisher-logo {
146
146
  float: right;
147
147
  clear: right;
@@ -150,30 +150,31 @@ div.publisher-logo {
150
150
  padding-bottom: 20px;
151
151
  }
152
152
 
153
- /* line 133, ../sass/_byronic.sass */
153
+ /* line 137, ../sass/_byronic.sass */
154
154
  table.toc td.section {
155
155
  text-align: right;
156
- color: #323232;
156
+ color: #333333;
157
+ width: 5em;
157
158
  }
158
- /* line 137, ../sass/_byronic.sass */
159
+ /* line 142, ../sass/_byronic.sass */
159
160
  table.toc td.title a {
160
161
  text-decoration: none;
161
162
  color: #1a1a1a;
162
163
  }
163
- /* line 140, ../sass/_byronic.sass */
164
+ /* line 145, ../sass/_byronic.sass */
164
165
  table.toc td.title.frontmatter, table.toc td.title.backmatter {
165
166
  font-style: italic;
166
167
  }
167
- /* line 143, ../sass/_byronic.sass */
168
+ /* line 148, ../sass/_byronic.sass */
168
169
  table.toc td.separator {
169
170
  width: 30px;
170
171
  text-align: center;
171
172
  font-size: 2em;
172
- color: #7f7f7f;
173
+ color: gray;
173
174
  }
174
175
 
175
176
  /* Epigraphs at the beginning of each chapter are in blockquotes */
176
- /* line 150, ../sass/_byronic.sass */
177
+ /* line 155, ../sass/_byronic.sass */
177
178
  h1 + blockquote,
178
179
  blockquote.epigraph {
179
180
  margin-right: 1em;
@@ -182,7 +183,7 @@ blockquote.epigraph {
182
183
  font-size: 0.9em;
183
184
  font-style: italic;
184
185
  }
185
- /* line 158, ../sass/_byronic.sass */
186
+ /* line 163, ../sass/_byronic.sass */
186
187
  h1 + blockquote p,
187
188
  blockquote.epigraph p {
188
189
  text-indent: 0;
@@ -190,13 +191,13 @@ blockquote.epigraph p {
190
191
  margin-top: 2pt;
191
192
  }
192
193
 
193
- /* line 163, ../sass/_byronic.sass */
194
+ /* line 168, ../sass/_byronic.sass */
194
195
  blockquote {
195
- border-left: 1px solid #989898;
196
+ border-left: 1px solid #8c8c8c;
196
197
  padding: 0.3em 0 0.3em 1em;
197
198
  }
198
199
 
199
- /* line 167, ../sass/_byronic.sass */
200
+ /* line 172, ../sass/_byronic.sass */
200
201
  #content.verse blockquote {
201
202
  font-style: normal;
202
203
  font-size: 1em;
@@ -204,7 +205,7 @@ blockquote {
204
205
  }
205
206
 
206
207
  /* The attribution of the blockquote */
207
- /* line 173, ../sass/_byronic.sass */
208
+ /* line 178, ../sass/_byronic.sass */
208
209
  span.attribution,
209
210
  p.attribution {
210
211
  display: block;
@@ -217,7 +218,7 @@ p.attribution {
217
218
 
218
219
  /* ...which also contains an attribution-name, wrapping the name of
219
220
  * the person who made the quotation */
220
- /* line 184, ../sass/_byronic.sass */
221
+ /* line 189, ../sass/_byronic.sass */
221
222
  span.attribution-name,
222
223
  p.attribution-name {
223
224
  text-align: left;
@@ -229,13 +230,13 @@ p.attribution-name {
229
230
 
230
231
  /* Outside of the content area you can address the style of the
231
232
  * running book and author headings. */
232
- /* line 194, ../sass/_byronic.sass */
233
+ /* line 199, ../sass/_byronic.sass */
233
234
  #content-title {
234
235
  text-align: right;
235
236
  font-size: 0.8em;
236
237
  }
237
238
 
238
- /* line 202, ../sass/_byronic.sass */
239
+ /* line 207, ../sass/_byronic.sass */
239
240
  p {
240
241
  text-align: justify;
241
242
  }
@@ -243,7 +244,7 @@ p {
243
244
  /* The first paragraph in the work has a class called "noindent" which
244
245
  * suppresses any paragraph indentation applied by default, but you
245
246
  * can override this. */
246
- /* line 212, ../sass/_byronic.sass */
247
+ /* line 217, ../sass/_byronic.sass */
247
248
  h1 + p, h2 + p, h3 + p, h4 + p,
248
249
  h1 + blockquote + p,
249
250
  blockquote.epigraph + p,
@@ -256,62 +257,62 @@ p.noindent {
256
257
  * the class 'firstletter', which can be used for dropcaps. */
257
258
  /* Middlemarch contains a number of letters, which can be styled
258
259
  * differently. */
259
- /* line 230, ../sass/_byronic.sass */
260
+ /* line 235, ../sass/_byronic.sass */
260
261
  #content p.letter {
261
262
  padding-left: 1.5em;
262
263
  padding-right: 0.5em;
263
264
  }
264
265
 
265
266
  /* Found in a letter */
266
- /* line 235, ../sass/_byronic.sass */
267
+ /* line 240, ../sass/_byronic.sass */
267
268
  #content p.salutation {
268
269
  display: block;
269
270
  font-variant: small-caps;
270
271
  }
271
272
 
272
- /* line 239, ../sass/_byronic.sass */
273
+ /* line 244, ../sass/_byronic.sass */
273
274
  #content p.closing {
274
275
  display: block;
275
276
  text-indent: 1em;
276
277
  }
277
278
 
278
- /* line 243, ../sass/_byronic.sass */
279
+ /* line 248, ../sass/_byronic.sass */
279
280
  div.page-break {
280
281
  page-break-after: always;
281
282
  }
282
283
 
283
- /* line 246, ../sass/_byronic.sass */
284
+ /* line 251, ../sass/_byronic.sass */
284
285
  .page-break-after {
285
286
  page-break-after: always;
286
287
  }
287
288
 
288
- /* line 249, ../sass/_byronic.sass */
289
+ /* line 254, ../sass/_byronic.sass */
289
290
  .page-break-before {
290
291
  page-break-before: always;
291
292
  }
292
293
 
293
- /* line 252, ../sass/_byronic.sass */
294
+ /* line 257, ../sass/_byronic.sass */
294
295
  pre {
295
296
  margin-top: 1em;
296
297
  margin-bottom: 1em;
297
298
  }
298
299
 
299
- /* line 256, ../sass/_byronic.sass */
300
+ /* line 261, ../sass/_byronic.sass */
300
301
  .small {
301
302
  font-size: 0.9em;
302
303
  }
303
304
 
304
- /* line 259, ../sass/_byronic.sass */
305
+ /* line 264, ../sass/_byronic.sass */
305
306
  .footnotesize {
306
307
  font-size: 0.8em;
307
308
  }
308
309
 
309
- /* line 262, ../sass/_byronic.sass */
310
+ /* line 267, ../sass/_byronic.sass */
310
311
  .tiny {
311
312
  font-size: 0.7em;
312
313
  }
313
314
 
314
- /* line 265, ../sass/_byronic.sass */
315
+ /* line 270, ../sass/_byronic.sass */
315
316
  .noborder {
316
317
  border: none;
317
318
  }
@@ -114,6 +114,7 @@ module Prophecy
114
114
 
115
115
  @type = config['type'] || nil
116
116
  @title = config['title'] || self.first_header_text || ""
117
+ @title = CGI.escapeHTML(@title)
117
118
  @class = config['class'] || ""
118
119
  @class += " #{@type}" if @type
119
120
  @id = config['id'] || 'chapter_' + @title.downcase.gsub(/[^a-z0-9-]/, '-').gsub(/--+/, '-')
@@ -212,6 +213,9 @@ module Prophecy
212
213
  ret = text
213
214
  when '.md', '.mkd', '.markdown'
214
215
  ret = Kramdown::Document.new(text).to_html
216
+ # Rewrite footnote IDs and refs, otherwise Epubcheck complains
217
+ # about colon
218
+ ret = ret.gsub('id="fn:', 'id="fn_').gsub('href="#fn:', 'href="#fn_').gsub('id="fnref:', 'id="fnref_').gsub('href="#fnref:', 'href="#fnref_')
215
219
  when '.tex'
216
220
  # Is Pandoc installed?
217
221
  unless system("pandoc --version > /dev/null 2>&1")
data/lib/prophecy/cli.rb CHANGED
@@ -70,6 +70,27 @@ module Prophecy
70
70
  #cmd = system("epubcheck builds/epub/book.epub")
71
71
  end
72
72
 
73
+ desc "epub_check FILE", "Validate an EPUB file with Epubcheck."
74
+ def epub_check(filepath)
75
+
76
+ unless File.exist?(filepath)
77
+ warn "File not found: #{filepath}"
78
+ exit 2
79
+ end
80
+
81
+ print "Validating Epub with Epubcheck... "
82
+
83
+ binpath = File.expand_path(File.join(__FILE__, '..', '..', '..', 'epubcheck_dir/epubcheck.jar'))
84
+ cmd = "java -jar #{binpath} #{filepath}"
85
+
86
+ if system(cmd)
87
+ puts "OK"
88
+ else
89
+ puts "There was an error."
90
+ exit 2
91
+ end
92
+ end
93
+
73
94
  desc "mobi", "Generate new MOBI with Kindlegen from sources. This calls assets_compile, mobi_clean_dir, mobi_build, mobi_compile."
74
95
  def mobi
75
96
  mobi_init
@@ -193,24 +214,40 @@ module Prophecy
193
214
  end
194
215
  end
195
216
 
196
- # desc "to_markdown", "convert .tex files to markdown"
197
- # def to_markdown
198
- # @book = latex_init_book
199
- #
200
- # Dir[File.join(@book.tex_dir, '*.tex')].each do |f|
201
- # dest = File.expand_path(File.join(@book.markdown_dir, File.basename(f).sub(/\.tex$/, '.md')))
202
- # if File.exist?(dest)
203
- # print "WARNING: destination exists: #{dest}\nOverwrite? [yN] "
204
- # a = STDIN.gets.chomp()
205
- # if a.downcase != 'y'
206
- # puts "OK, skipping file"
207
- # next
208
- # end
209
- # end
210
- # r = system "/bin/bash #{File.join(@book.assets_dir, 'helpers/tex2md.sh')} '#{File.expand_path(f)}' '#{dest}'"
211
- # warn "WARNING: tex2md.sh returned non-zero for #{f}" unless r
212
- # end
213
- # end
217
+ desc "latex_to_markdown", "convert build/tex/*.tex files to build/markdown/*.md"
218
+ def latex_to_markdown
219
+ latex_init
220
+
221
+ tex_dir = File.join("manuscript", "tex")
222
+ markdown_dir = File.join("manuscript", "markdown")
223
+
224
+ unless Dir.exists?(tex_dir)
225
+ puts "Could not find: #{tex_dir}."
226
+ exit 2
227
+ else
228
+ if Dir[File.join(tex_dir, '*.tex')].size == 0
229
+ puts "No .tex files found in #{tex_dir}"
230
+ exit 2
231
+ end
232
+ end
233
+
234
+ FileUtils.mkdir(markdown_dir) unless Dir.exists?(markdown_dir)
235
+
236
+ Dir[File.join(tex_dir, '*.tex')].each do |f|
237
+
238
+ dest = File.expand_path(File.join(markdown_dir, File.basename(f).sub(/\.tex$/, '.md')))
239
+ if File.exist?(dest)
240
+ print "WARNING: destination exists: #{dest}\nOverwrite? [yN] "
241
+ a = STDIN.gets.chomp()
242
+ if a.downcase != 'y'
243
+ puts "OK, skipping file"
244
+ next
245
+ end
246
+ end
247
+ r = system "/bin/bash #{File.join(@book.assets_dir, 'helpers/tex2md.sh')} '#{File.expand_path(f)}' '#{dest}'"
248
+ warn "WARNING: tex2md.sh returned non-zero for #{f}" unless r
249
+ end
250
+ end
214
251
 
215
252
  desc "assets_compile", "Compile assets (run compass, etc.) if there is a local assets folder"
216
253
  def assets_compile
@@ -0,0 +1,13 @@
1
+
2
+ # Add local extensions to Prophecy here.
3
+ # This file will be loaded by the CLI.
4
+
5
+ # module Prophecy
6
+ # class CLI < Thor
7
+ # desc "hello WORLD", "Hello World"
8
+ # def hello(world = "World")
9
+ # puts "Hello #{world}"
10
+ # end
11
+ # end
12
+ # end
13
+
@@ -1,3 +1,3 @@
1
1
  module Prophecy
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prophecy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gambhiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-30 00:00:00.000000000 Z
11
+ date: 2013-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -217,9 +217,6 @@ files:
217
217
  - bin/kindlestrip.py
218
218
  - bin/prophecy
219
219
  - bin/zip.exe
220
- - docs/licenses/epubcheck/COPYING.txt
221
- - docs/licenses/epubcheck/README.txt
222
- - docs/licenses/epubcheck/jing_license.txt
223
220
  - docs/licenses/kindlegen/.empty_directory
224
221
  - docs/licenses/kindlegen/EULA.txt
225
222
  - docs/licenses/kindlegen/KindleGen Legal Notices 2009-11-10 Linux.txt
@@ -233,9 +230,19 @@ files:
233
230
  - docs/licenses/zip/WHERE
234
231
  - docs/licenses/zip/zip.txt
235
232
  - docs/licenses/zip/zip30.ann
233
+ - epubcheck_dir/COPYING.txt
234
+ - epubcheck_dir/README.txt
235
+ - epubcheck_dir/THIRD-PARTY.txt
236
236
  - epubcheck_dir/epubcheck.jar
237
- - epubcheck_dir/lib/jing.jar
238
- - epubcheck_dir/lib/saxon.jar
237
+ - epubcheck_dir/lib/Saxon-HE-9.4.0.6.jar
238
+ - epubcheck_dir/lib/commons-compress-1.4.1.jar
239
+ - epubcheck_dir/lib/guava-13.0.1.jar
240
+ - epubcheck_dir/lib/jing-20120724.0.0.jar
241
+ - epubcheck_dir/lib/sac-1.3.jar
242
+ - epubcheck_dir/licenses/Apache-2.0.txt
243
+ - epubcheck_dir/licenses/BSD-3-Clause.txt
244
+ - epubcheck_dir/licenses/MPL-1.0.txt
245
+ - epubcheck_dir/licenses/W3C.txt
239
246
  - features/assets.feature
240
247
  - features/book.feature
241
248
  - features/generator.feature
@@ -322,6 +329,7 @@ files:
322
329
  - lib/prophecy/generators/book/.gitignore
323
330
  - lib/prophecy/generators/book/LICENSE.txt
324
331
  - lib/prophecy/generators/book/README.md.tt
332
+ - lib/prophecy/generators/book/book.rb
325
333
  - lib/prophecy/generators/book/book.yml.tt
326
334
  - lib/prophecy/generators/book/build/epub/.empty_directory
327
335
  - lib/prophecy/generators/book/build/latex/.empty_directory
@@ -1,12 +0,0 @@
1
- Jing Copying Conditions
2
-
3
- Copyright (c) 2001-2003 Thai Open Source Software Center Ltd
4
- All rights reserved.
5
-
6
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7
-
8
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9
- * 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.
10
- * Neither the name of the Thai Open Source Software Center Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
-
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Binary file