kitabu 1.0.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -3
  3. data/.travis.yml +18 -0
  4. data/CHANGELOG.md +9 -0
  5. data/Gemfile.lock +67 -50
  6. data/README.md +235 -0
  7. data/attachments/browser-version.png +0 -0
  8. data/attachments/cover.png +0 -0
  9. data/attachments/kitabu.epub +0 -0
  10. data/attachments/kitabu.mobi +0 -0
  11. data/attachments/kitabu.pdf +0 -0
  12. data/{spec/support/mybook/output → examples/kitabu/output/epub/images}/.gitkeep +0 -0
  13. data/examples/kitabu/output/epub/images/kitabu-icon.png +0 -0
  14. data/examples/kitabu/output/epub/images/kitabu-icon.svg +19 -0
  15. data/examples/kitabu/output/epub/images/kitabu-word.png +0 -0
  16. data/examples/kitabu/output/epub/images/kitabu-word.svg +14 -0
  17. data/examples/kitabu/output/epub/images/kitabu.png +0 -0
  18. data/examples/kitabu/output/epub/images/kitabu.svg +20 -0
  19. data/examples/kitabu/output/epub/section_0.html +266 -0
  20. data/examples/kitabu/output/epub/section_1.html +246 -0
  21. data/examples/kitabu/output/epub/section_2.html +520 -0
  22. data/examples/kitabu/output/epub/section_3.html +282 -0
  23. data/examples/kitabu/output/epub/section_4.html +276 -0
  24. data/examples/kitabu/output/epub/styles/epub.css +437 -0
  25. data/examples/kitabu/output/epub/styles/html.css +712 -0
  26. data/examples/kitabu/output/epub/styles/pdf.css +840 -0
  27. data/examples/kitabu/output/epub/styles/print.css +1278 -0
  28. data/examples/kitabu/output/epub/toc.html +37 -0
  29. data/{spec/support/mybook/templates/epub/style.css → examples/kitabu/output/images/.gitkeep} +0 -0
  30. data/examples/kitabu/output/images/kitabu-icon.png +0 -0
  31. data/examples/kitabu/output/images/kitabu-icon.svg +19 -0
  32. data/examples/kitabu/output/images/kitabu-word.png +0 -0
  33. data/examples/kitabu/output/images/kitabu-word.svg +14 -0
  34. data/examples/kitabu/output/images/kitabu.png +0 -0
  35. data/examples/kitabu/output/images/kitabu.svg +20 -0
  36. data/examples/kitabu/output/kitabu.epub +0 -0
  37. data/examples/kitabu/output/kitabu.html +513 -0
  38. data/examples/kitabu/output/kitabu.mobi +0 -0
  39. data/examples/kitabu/output/kitabu.pdf +0 -0
  40. data/examples/kitabu/output/kitabu.pdf.html +729 -0
  41. data/examples/kitabu/output/kitabu.print.html +729 -0
  42. data/examples/kitabu/output/kitabu.print.pdf +0 -0
  43. data/examples/kitabu/output/kitabu.txt +440 -0
  44. data/examples/kitabu/output/styles/epub.css +437 -0
  45. data/examples/kitabu/output/styles/html.css +712 -0
  46. data/examples/kitabu/output/styles/pdf.css +840 -0
  47. data/examples/kitabu/output/styles/print.css +1278 -0
  48. data/kitabu.gemspec +7 -5
  49. data/lib/kitabu.rb +10 -20
  50. data/lib/kitabu/cli.rb +0 -5
  51. data/lib/kitabu/dependency.rb +0 -4
  52. data/lib/kitabu/exporter.rb +2 -0
  53. data/lib/kitabu/extensions/rouge.rb +9 -0
  54. data/lib/kitabu/generator.rb +9 -21
  55. data/lib/kitabu/helpers.rb +47 -0
  56. data/lib/kitabu/markdown.rb +31 -0
  57. data/lib/kitabu/parser.rb +21 -3
  58. data/lib/kitabu/parser/epub.rb +31 -18
  59. data/lib/kitabu/parser/html.rb +48 -29
  60. data/lib/kitabu/parser/mobi.rb +1 -1
  61. data/lib/kitabu/parser/pdf.rb +52 -8
  62. data/lib/kitabu/version.rb +2 -2
  63. data/spec/kitabu/cli/export_spec.rb +4 -4
  64. data/spec/kitabu/cli/new_spec.rb +2 -2
  65. data/spec/kitabu/markdown_spec.rb +24 -0
  66. data/spec/kitabu/parser/html_spec.rb +20 -25
  67. data/spec/kitabu/parser/mobi_spec.rb +14 -0
  68. data/spec/kitabu/parser/pdf_spec.rb +18 -1
  69. data/spec/kitabu/parser/txt_spec.rb +14 -0
  70. data/spec/spec_helper.rb +10 -6
  71. data/spec/support/mybook/config/helper.rb +4 -29
  72. data/spec/support/mybook/config/kitabu.yml +0 -10
  73. data/spec/support/mybook/templates/epub/cover.erb +4 -3
  74. data/{templates → spec/support/mybook/templates/epub}/cover.png +0 -0
  75. data/spec/support/mybook/templates/epub/page.erb +3 -2
  76. data/spec/support/mybook/templates/html/layout.erb +10 -13
  77. data/spec/support/mybook/templates/styles/epub.scss +3 -0
  78. data/spec/support/mybook/templates/styles/html.scss +3 -0
  79. data/spec/support/mybook/templates/styles/pdf.scss +3 -0
  80. data/spec/support/mybook/templates/styles/print.scss +3 -0
  81. data/spec/support/mybook/text/{01_Markdown_Chapter.markdown → 01_Markdown_Chapter.md} +2 -3
  82. data/spec/support/mybook/text/02_ERB_Chapter.md.erb +7 -0
  83. data/spec/support/mybook/text/{04_With_Directory/Some_Chapter.mkdn → 03_With_Directory/Some_Chapter.md} +0 -0
  84. data/spec/support/mybook/text/{CHANGELOG.textile → CHANGELOG.md} +2 -2
  85. data/spec/support/mybook/text/{TOC.textile → TOC.md} +0 -0
  86. data/spec/support/mybook/text/{_00_Introduction.markdown → _00_Introduction.md} +0 -0
  87. data/spec/support/shared.rb +14 -10
  88. data/templates/Gemfile +3 -3
  89. data/templates/Guardfile +1 -5
  90. data/templates/config.erb +5 -5
  91. data/templates/cover.erb +4 -3
  92. data/templates/epub.erb +3 -2
  93. data/templates/helper.rb +28 -29
  94. data/templates/images/.gitkeep +0 -0
  95. data/templates/images/kitabu-icon.png +0 -0
  96. data/templates/images/kitabu-icon.svg +19 -0
  97. data/templates/images/kitabu-word.png +0 -0
  98. data/templates/images/kitabu-word.svg +14 -0
  99. data/templates/images/kitabu.png +0 -0
  100. data/templates/images/kitabu.svg +20 -0
  101. data/{examples/RailsGuides/templates → templates/templates/epub}/cover.erb +4 -3
  102. data/templates/templates/epub/cover.png +0 -0
  103. data/templates/templates/epub/page.erb +16 -0
  104. data/templates/{layout.erb → templates/html/layout.erb} +22 -11
  105. data/templates/templates/styles/epub.scss +1 -0
  106. data/templates/templates/styles/files/_normalize.scss +427 -0
  107. data/templates/templates/styles/html.scss +252 -0
  108. data/templates/templates/styles/pdf.scss +371 -0
  109. data/templates/templates/styles/print.scss +2 -0
  110. data/templates/text/01_Getting_Started.md +26 -0
  111. data/templates/text/02_Creating_Chapters.md +22 -0
  112. data/templates/text/03_Syntax_Highlighting.erb +69 -0
  113. data/templates/text/04_Dynamic_Content.erb +64 -0
  114. data/templates/text/05_Exporting_Files.md +49 -0
  115. metadata +143 -83
  116. data/README.rdoc +0 -218
  117. data/examples/RailsGuides/config/helper.rb +0 -29
  118. data/examples/RailsGuides/config/kitabu.yml +0 -44
  119. data/examples/RailsGuides/images/challenge.png +0 -0
  120. data/examples/RailsGuides/images/posts_index.png +0 -0
  121. data/examples/RailsGuides/images/rails_welcome.png +0 -0
  122. data/examples/RailsGuides/output/RailsGuides.epub +0 -0
  123. data/examples/RailsGuides/output/RailsGuides.html +0 -1556
  124. data/examples/RailsGuides/output/RailsGuides.pdf +3 -4934
  125. data/examples/RailsGuides/templates/layout.css +0 -352
  126. data/examples/RailsGuides/templates/layout.erb +0 -43
  127. data/examples/RailsGuides/templates/syntax.css +0 -62
  128. data/examples/RailsGuides/templates/user.css +0 -19
  129. data/examples/RailsGuides/text/01_Guide_Assumptions.mkdn +0 -13
  130. data/examples/RailsGuides/text/02_What_is_Rails.mkdn +0 -106
  131. data/examples/RailsGuides/text/03_Creating_a_new_Rails_project.mkdn +0 -200
  132. data/examples/RailsGuides/text/04_Hello_Rails.mkdn +0 -62
  133. data/examples/RailsGuides/text/05_Getting_Up_and_Running_Quickly_with_Scaffolding.mkdn +0 -4
  134. data/examples/RailsGuides/text/06_Creating_a_resource.mkdn +0 -503
  135. data/examples/RailsGuides/text/07_Adding_a_second_model.mkdn +0 -232
  136. data/examples/RailsGuides/text/08_Refactoring.mkdn +0 -123
  137. data/examples/RailsGuides/text/09_Deleting_comments.mkdn +0 -57
  138. data/examples/RailsGuides/text/09_Security.mkdn +0 -56
  139. data/examples/RailsGuides/text/10_Building_a_multi_model_form.mkdn +0 -130
  140. data/examples/RailsGuides/text/11_View_helpers.mkdn +0 -50
  141. data/examples/RailsGuides/text/12_Whats_next.mkdn +0 -14
  142. data/examples/RailsGuides/text/13_Configuration_gotchas.mkdn +0 -10
  143. data/lib/kitabu/adapters/markdown.rb +0 -34
  144. data/lib/kitabu/extensions/redcloth.rb +0 -69
  145. data/lib/kitabu/syntax.rb +0 -130
  146. data/spec/kitabu/extensions/redcloth_spec.rb +0 -57
  147. data/spec/kitabu/syntax_spec.rb +0 -106
  148. data/spec/support/mybook/templates/html/layout.css +0 -353
  149. data/spec/support/mybook/templates/html/syntax.css +0 -58
  150. data/spec/support/mybook/templates/html/user.css +0 -1
  151. data/spec/support/mybook/text/02_Textile_Chapter.textile +0 -3
  152. data/spec/support/mybook/text/03_HTML_Chapter.html +0 -3
  153. data/templates/epub.css +0 -500
  154. data/templates/layout.css +0 -353
  155. data/templates/sample.md +0 -6
  156. data/templates/syntax.css +0 -58
  157. data/templates/user.css +0 -1
@@ -1,353 +0,0 @@
1
- /* ============ */
2
- /* = DEFAULTS = */
3
- /* ============ */
4
- html * {
5
- font: normal normal normal 12pt/normal Constantia, Palatino, "Palatino Linotype", "Palatino LT STD", Georgia, serif;
6
- }
7
-
8
- /* ========= */
9
- /* = PAGES = */
10
- /* ========= */
11
- @page {
12
- margin: 12mm 16mm 10mm 16mm;
13
- size: 7in 9.25in landscape;
14
-
15
- @footnotes {
16
- border-top: thin solid black;
17
- margin-left: 30%;
18
- margin-top: 0.6em;
19
- padding-top: 0.3em;
20
- }
21
-
22
- @bottom-right {
23
- color: #000;
24
- content: counter(page);
25
- font-family: helvetica, arial, sans-serif;
26
- font-size: 12px;
27
- margin-top: -10px;
28
- margin-right: -40px;
29
- }
30
- }
31
-
32
- @page toc {
33
- margin-right: 6mm;
34
-
35
- @bottom-right {
36
- content: "";
37
- }
38
- }
39
-
40
- @page cover {
41
- margin: 0;
42
-
43
- @bottom-right {
44
- content: "";
45
- }
46
- }
47
-
48
- /* ============= */
49
- /* = BOOKMARKS = */
50
- /* ============= */
51
- h1, h2, h3, h4, h5, h6 {
52
- prince-bookmark-level: none;
53
- }
54
-
55
- .frontcover h1 { prince-bookmark-level: 1; }
56
- .chapter h2 { prince-bookmark-level: 2; }
57
- .chapter h3 { prince-bookmark-level: 3; }
58
- .chapter h4 { prince-bookmark-level: 4; }
59
- .chapter h5 { prince-bookmark-level: 5; }
60
- .chapter h6 { prince-bookmark-level: 6; }
61
-
62
- /* ============= */
63
- /* = CONTAINER = */
64
- /* ============= */
65
- div.container {
66
- height: 7in;
67
- left: 0;
68
- page: cover;
69
- position: absolute;
70
- top: 0;
71
- width: 9.25in;
72
- z-index: -1;
73
- }
74
-
75
- /* ============== */
76
- /* = FRONTCOVER = */
77
- /* ============== */
78
- div.frontcover {
79
- background: #fff;
80
- }
81
-
82
- div.frontcover div {
83
- left: 1in;
84
- padding-top: 0.25in;
85
- position: absolute;
86
- top: 2.5in;
87
- width: 7.25in;
88
- }
89
-
90
- div.frontcover h1 {
91
- color: #f00;
92
- font-size: 46pt;
93
- }
94
-
95
- div.frontcover p {
96
- font-size: 18pt;
97
- }
98
-
99
- div.frontcover p.description {
100
- color: #666;
101
- font: italic normal normal 14pt/normal Baskerville, "Hoefler Text", Garamond, "Times New Roman", serif;
102
- margin-top: -.1in;
103
- }
104
-
105
- div.frontcover p.authors {
106
- color: #000;
107
- font-style: italic;
108
- position: absolute;
109
- top: 0;
110
- }
111
-
112
- div.frontcover * {
113
- margin: 0;
114
- }
115
-
116
- /* =========== */
117
- /* = CHAPTER = */
118
- /* =========== */
119
- #chapters {
120
- counter-reset: page 1;
121
- counter-reset: chapter;
122
- page-break-before: always;
123
- }
124
-
125
- .chapter {
126
- color: #444;
127
- counter-reset: footnote 0;
128
- page-break-after: always;
129
- }
130
-
131
- .chapter a {
132
- color: #0AE;
133
- text-decoration: none;
134
- }
135
-
136
- .chapter h2,
137
- .chapter h3,
138
- .chapter h4,
139
- .chapter h5 {
140
- margin: 25pt 0 15pt 0;
141
- }
142
-
143
- .chapter h2 {
144
- color: #222;
145
- counter-increment: chapter;
146
- font-size: 36pt;
147
- line-height: 1;
148
- string-set: header "Chapter " counter(chapter) ": " content();
149
- }
150
-
151
- .chapter h2::before {
152
- content: "Chapter " counter(chapter);
153
- color: #999;
154
- display: block;
155
- font-size: 18pt;
156
- letter-spacing: 0;
157
- margin-bottom: .2em;
158
- white-space: pre;
159
- }
160
-
161
- .chapter h3,
162
- .chapter h5 {
163
- font-family: "helvetica", arial, sans-serif;
164
- }
165
-
166
- .chapter h3 {
167
- color: #b62f32;
168
- font-size: 28px;
169
- }
170
-
171
- .chapter h4 {
172
- font-size: 18px;
173
- font-family: "helvetica neue", "arial narrow", sans-serif;
174
- }
175
-
176
- .chapter h5 {
177
- font-size: 15px;
178
- }
179
-
180
- .chapter h6 {
181
- font-size: 15px;
182
- font-weight: normal;
183
- text-transform: uppercase;
184
- }
185
-
186
- /* =========== */
187
- /* = IMPRINT = */
188
- /* =========== */
189
- .imprint {
190
- background: #E2E7E2;
191
- page: cover;
192
- string-set: header "";
193
- }
194
-
195
- .imprint, .imprint * {
196
- color: #5b5b5b;
197
- }
198
-
199
- .imprint * {
200
- font-family: "Lucida Grande", arial, sans-serif;
201
- font-size: 10pt;
202
- margin: 0 0 2pt 0;
203
- }
204
-
205
- .imprint div {
206
- left: 0.5in;
207
- position: absolute;
208
- bottom: 0.3in;
209
- }
210
-
211
- /* ========== */
212
- /* = CODING = */
213
- /* ========== */
214
- pre, code {
215
- color: #090;
216
- font-family: monaco, monospace;
217
- font-size: 9pt;
218
- }
219
-
220
- pre, pre code {
221
- font-size: 8pt;
222
- line-height: 1.4;
223
- padding-left: 25pt;
224
- }
225
-
226
- /* ========= */
227
- /* = TABLE = */
228
- /* ========= */
229
- table {
230
- border-collapse: collapse;
231
- }
232
-
233
- thead th {
234
- background: #e9e9e9;
235
- }
236
-
237
- th, td {
238
- border: 1px solid #ccc;
239
- font-size: 11pt;
240
- padding: 5pt;
241
- }
242
-
243
- /* ========= */
244
- /* = LISTS = */
245
- /* ========= */
246
- li {
247
- margin-bottom: 8pt;
248
- }
249
-
250
- li ul,
251
- li ol {
252
- margin-left: 15pt;
253
- }
254
-
255
- /* ========== */
256
- /* = FIGURE = */
257
- /* ========== */
258
- .figure img:after {
259
- content: attr("alt");
260
- display: block;
261
- font-size: 10pt;
262
- }
263
-
264
- img {
265
- max-width: none;
266
- prince-image-resolution: 96dpi;
267
- }
268
-
269
- .figure {
270
- float: right;
271
- margin: 0 0 20pt 20pt;
272
- overflow: auto;
273
- text-align: center;
274
- }
275
-
276
- /* ===================== */
277
- /* = TABLE OF CONTENTS = */
278
- /* ===================== */
279
- div.table-of-contents {
280
- page: toc;
281
- }
282
-
283
- div.table-of-contents h2 {
284
- font-size: 36pt;
285
- }
286
-
287
- div.table-of-contents a {
288
- font-size: 11pt;
289
- text-decoration: none;
290
- }
291
-
292
- div.table-of-contents div.level2 a {
293
- color: #000;
294
- font-weight: bold;
295
- }
296
-
297
- div.table-of-contents #toc {
298
- column-count: 2;
299
- column-fill: auto;
300
- column-gap: 5%;
301
- column-rule: none;
302
- column-width: 45%;
303
- }
304
-
305
- div.table-of-contents #toc div {
306
- padding-bottom: 10px;
307
- }
308
-
309
- div.table-of-contents div.level3 {
310
- margin-left: 20px;
311
- }
312
-
313
- div.table-of-contents #toc div.level3 a {
314
- color: #555;
315
- }
316
-
317
- div.table-of-contents div a::before {
318
- color: #888;
319
- content: target-counter(attr(href), page) " ";
320
- float: left;
321
- font-weight: normal;
322
- font-size: 11pt !important;
323
- margin-right: 4px;
324
- width: 40px;
325
- }
326
-
327
- div.table-of-contents div.level3 a::before {
328
- width: 20px;
329
- }
330
-
331
- div.table-of-contents div.level4,
332
- div.table-of-contents div.level5,
333
- div.table-of-contents div.level6 {
334
- display: none;
335
- }
336
-
337
- /* ===================== */
338
- /* = OTHER TEXT TWEAKS = */
339
- /* ===================== */
340
- acronym:after {
341
- content: " (" attr(title) ")";
342
- }
343
-
344
- /* ============= */
345
- /* = HIGHLIGHT = */
346
- /* ============= */
347
- .highlight {
348
- font-size: 20pt;
349
- }
350
-
351
- .highlight strong {
352
- color: #b62f32;
353
- }
@@ -1,6 +0,0 @@
1
- Welcome to Kitabu
2
- -----------------
3
-
4
- [Kitabu](http://github.com/fnando/kitabu) is easy-to-use e-book framework. You can generate PDF, e-Pub and Mobi files from [Markdown](http://en.wikipedia.org/wiki/Markdown), [Textile](http://en.wikipedia.org/wiki/Textile_(markup_language)) or plain HTML files.
5
-
6
- You can safely remove this page and start writing your own novel.
@@ -1,58 +0,0 @@
1
- .hll { background-color: #ffffcc }
2
- .c { color: #aaaaaa; } /* Comment */
3
- .err { color: #F00000; background-color: #F0A0A0 } /* Error */
4
- .k { color: #0000aa } /* Keyword */
5
- .cm { color: #aaaaaa; } /* Comment.Multiline */
6
- .cp { color: #4c8317 } /* Comment.Preproc */
7
- .c1 { color: #aaaaaa; } /* Comment.Single */
8
- .cs { color: #0000aa; } /* Comment.Special */
9
- .gd { color: #aa0000 } /* Generic.Deleted */
10
- .ge { } /* Generic.Emph */
11
- .gr { color: #aa0000 } /* Generic.Error */
12
- .gh { color: #000080; font-weight: bold } /* Generic.Heading */
13
- .gi { color: #00aa00 } /* Generic.Inserted */
14
- .go { color: #888888 } /* Generic.Output */
15
- .gp { color: #555555 } /* Generic.Prompt */
16
- .gs { font-weight: bold } /* Generic.Strong */
17
- .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
18
- .gt { color: #aa0000 } /* Generic.Traceback */
19
- .kc { color: #0000aa } /* Keyword.Constant */
20
- .kd { color: #0000aa } /* Keyword.Declaration */
21
- .kn { color: #0000aa } /* Keyword.Namespace */
22
- .kp { color: #0000aa } /* Keyword.Pseudo */
23
- .kr { color: #0000aa } /* Keyword.Reserved */
24
- .kt { color: #00aaaa } /* Keyword.Type */
25
- .m { color: #009999 } /* Literal.Number */
26
- .s { color: #aa5500 } /* Literal.String */
27
- .na { color: #1e90ff } /* Name.Attribute */
28
- .nb { color: #00aaaa } /* Name.Builtin */
29
- .nc { color: #00aa00; } /* Name.Class */
30
- .no { color: #aa0000 } /* Name.Constant */
31
- .nd { color: #888888 } /* Name.Decorator */
32
- .ni { color: #800000; font-weight: bold } /* Name.Entity */
33
- .nf { color: #00aa00 } /* Name.Function */
34
- .nn { color: #00aaaa; } /* Name.Namespace */
35
- .nt { color: #1e90ff; font-weight: bold } /* Name.Tag */
36
- .nv { color: #aa0000 } /* Name.Variable */
37
- .ow { color: #0000aa } /* Operator.Word */
38
- .w { color: #bbbbbb } /* Text.Whitespace */
39
- .mf { color: #009999 } /* Literal.Number.Float */
40
- .mh { color: #009999 } /* Literal.Number.Hex */
41
- .mi { color: #009999 } /* Literal.Number.Integer */
42
- .mo { color: #009999 } /* Literal.Number.Oct */
43
- .sb { color: #aa5500 } /* Literal.String.Backtick */
44
- .sc { color: #aa5500 } /* Literal.String.Char */
45
- .sd { color: #aa5500 } /* Literal.String.Doc */
46
- .s2 { color: #aa5500 } /* Literal.String.Double */
47
- .se { color: #aa5500 } /* Literal.String.Escape */
48
- .sh { color: #aa5500 } /* Literal.String.Heredoc */
49
- .si { color: #aa5500 } /* Literal.String.Interpol */
50
- .sx { color: #aa5500 } /* Literal.String.Other */
51
- .sr { color: #009999 } /* Literal.String.Regex */
52
- .s1 { color: #aa5500 } /* Literal.String.Single */
53
- .ss { color: #0000aa } /* Literal.String.Symbol */
54
- .bp { color: #00aaaa } /* Name.Builtin.Pseudo */
55
- .vc { color: #aa0000 } /* Name.Variable.Class */
56
- .vg { color: #aa0000 } /* Name.Variable.Global */
57
- .vi { color: #aa0000 } /* Name.Variable.Instance */
58
- .il { color: #009999 } /* Literal.Number.Integer.Long */
@@ -1 +0,0 @@
1
- /* add custom CSS */