kitabu 1.0.6 → 2.0.0

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 (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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ef382447f8d4fb0eef52e1d9e6ffa6ffd9733d2
4
- data.tar.gz: 77062a208f61b31f2a1b79575c094f5f8f64800a
3
+ metadata.gz: cc4c26926c9593f2b8e97479bafef553a97adad2
4
+ data.tar.gz: 388956fdff69380c6bc9d5698ab6b37851f92fba
5
5
  SHA512:
6
- metadata.gz: 4f5737248a3a0fdf2aca5ee16c88e5484d5cc124aa2d86472c75fb21dfd47a6569a838e694e9d51091ffcd2c2952cb6755bb11b6af7763123c32cdfd518e78e4
7
- data.tar.gz: 7c106d90e9d1c4a5d122b669dfb2f7c70d5a0234edeca6a0fa8c66e3653158f46be8d25f16b3728b3173c9a5241ee6a93de440c85879c17ca313c7c8eedfa16d
6
+ metadata.gz: 4f4bbbd287feb60d0c0a0ced3f1bf1a1d9945d51b217f137b2e65cb3c356a9a56117ed077a6e836a4b4af83f262bad8a0fcd712820d3770bd14d78ac0e8f6e1a
7
+ data.tar.gz: 34d1ae48a3b6071e9b63595c37724816e445ba22896d013d204fe3f7caae2f1936dfdbdf841410c0ff257d5a6d06740dd817944fb3e8676ffe8b8e54b820d078
data/.gitignore CHANGED
@@ -1,4 +1,6 @@
1
1
  .DS_Store
2
- pkg
3
- tmp
4
- spec/support/mybook/output/mybook.*
2
+ /pkg
3
+ /tmp
4
+ /spec/support/mybook/output
5
+ /coverage
6
+ .sass-cache
@@ -0,0 +1,18 @@
1
+ language: ruby
2
+ cache: bundler
3
+ sudo: true
4
+ script: bundle exec rspec
5
+ before_install:
6
+ - wget http://www.princexml.com/download/prince_9.0-5_ubuntu12.04_amd64.deb
7
+ - sudo apt-get install -yqq fontconfig-config libfontconfig1 libgif4 libjpeg-turbo8 libjpeg8 libtiff4 ttf-dejavu-core html2text
8
+ - sudo dpkg -i prince_9.0-5_ubuntu12.04_amd64.deb
9
+ rvm:
10
+ - '2.0'
11
+ - '2.1'
12
+ - '2.2'
13
+ notifications:
14
+ email: false
15
+ addons:
16
+ code_climate:
17
+ repo_token:
18
+ secure: "WvgB6WqwxgwLvNCR/dFtm9JkQfaLMLuqaFs2nKKsw92BL4qi3rk3m3GxVR+LoODWx0Tsdl9zCWF3fFBwmgiM7eFdqSJ4dmy3iTH7fHOu/iruP6yDV9+iyI6oNXLGlyx4kZdxGvjOh95AFBMQ1KQis/0ibzA5Ax2qg19JUcB3+ao="
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ - Remove support for different markdown processors; now using Redcarpet.
6
+ - Remove support for other file types like textile and html.
7
+ - Remove support for pygments.rb highlighter; now using Rouge.
8
+ - Add support for .erb files; helpers can be defined within the `Kitabu::Helpers` module.
9
+ - Add support for media format stylesheets (print, pdf, html, epub).
@@ -1,90 +1,107 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kitabu (1.0.6)
5
- RedCloth
4
+ kitabu (2.0.0)
6
5
  activesupport
7
- coderay
8
6
  eeepub-with-cover-support
9
7
  i18n
10
8
  nokogiri
11
9
  notifier
12
- rdiscount
10
+ redcarpet
11
+ rouge
13
12
  rubyzip
13
+ sass
14
+ sass-globbing
14
15
  thor
15
16
  zip-zip
16
17
 
17
18
  GEM
18
19
  remote: https://rubygems.org/
19
20
  specs:
20
- RedCloth (4.2.9)
21
- activesupport (4.0.4)
22
- i18n (~> 0.6, >= 0.6.9)
23
- minitest (~> 4.2)
24
- multi_json (~> 1.3)
25
- thread_safe (~> 0.1)
26
- tzinfo (~> 0.3.37)
27
- atomic (1.1.16)
28
- awesome_print (1.2.0)
21
+ activesupport (4.2.0)
22
+ i18n (~> 0.7)
23
+ json (~> 1.7, >= 1.7.7)
24
+ minitest (~> 5.1)
25
+ thread_safe (~> 0.3, >= 0.3.4)
26
+ tzinfo (~> 1.1)
27
+ awesome_print (1.6.1)
29
28
  builder (3.2.2)
29
+ byebug (3.5.1)
30
+ columnize (~> 0.8)
31
+ debugger-linecache (~> 1.2)
32
+ slop (~> 3.6)
33
+ codeclimate-test-reporter (0.4.7)
34
+ simplecov (>= 0.7.1, < 1.0.0)
30
35
  coderay (1.1.0)
31
- columnize (0.3.6)
32
- debugger (1.6.6)
33
- columnize (>= 0.3.1)
34
- debugger-linecache (~> 1.2.0)
35
- debugger-ruby_core_source (~> 1.3.2)
36
+ columnize (0.9.0)
36
37
  debugger-linecache (1.2.0)
37
- debugger-ruby_core_source (1.3.2)
38
38
  diff-lcs (1.2.5)
39
+ docile (1.1.5)
39
40
  eeepub-with-cover-support (0.8.8)
40
41
  builder
41
42
  rubyzip
42
- i18n (0.6.9)
43
+ i18n (0.7.0)
44
+ json (1.8.2)
43
45
  method_source (0.8.2)
44
- mini_portile (0.5.3)
45
- minitest (4.7.5)
46
- multi_json (1.9.2)
47
- nokogiri (1.6.1)
48
- mini_portile (~> 0.5.0)
49
- notifier (0.4.1)
50
- pry (0.9.12.6)
51
- coderay (~> 1.0)
52
- method_source (~> 0.8)
46
+ mini_portile (0.6.2)
47
+ minitest (5.5.1)
48
+ multi_json (1.11.0)
49
+ nokogiri (1.6.6.2)
50
+ mini_portile (~> 0.6.0)
51
+ notifier (0.5.0)
52
+ pry (0.10.1)
53
+ coderay (~> 1.1.0)
54
+ method_source (~> 0.8.1)
53
55
  slop (~> 3.4)
54
- pry-debugger (0.2.2)
55
- debugger (~> 1.3)
56
- pry (~> 0.9.10)
57
- pry-meta (0.0.6)
56
+ pry-byebug (3.0.1)
57
+ byebug (~> 3.4)
58
+ pry (~> 0.10)
59
+ pry-meta (0.0.10)
58
60
  awesome_print
59
61
  pry
60
- pry-debugger
62
+ pry-byebug
61
63
  pry-remote
62
64
  pry-remote (0.1.8)
63
65
  pry (~> 0.9)
64
66
  slop (~> 3.0)
65
- rake (10.2.2)
66
- rdiscount (2.1.7)
67
- rspec (2.14.1)
68
- rspec-core (~> 2.14.0)
69
- rspec-expectations (~> 2.14.0)
70
- rspec-mocks (~> 2.14.0)
71
- rspec-core (2.14.8)
72
- rspec-expectations (2.14.5)
73
- diff-lcs (>= 1.1.3, < 2.0)
74
- rspec-mocks (2.14.6)
75
- rubyzip (1.1.2)
76
- slop (3.5.0)
67
+ rake (10.4.2)
68
+ redcarpet (3.2.2)
69
+ rouge (1.8.0)
70
+ rspec (3.2.0)
71
+ rspec-core (~> 3.2.0)
72
+ rspec-expectations (~> 3.2.0)
73
+ rspec-mocks (~> 3.2.0)
74
+ rspec-core (3.2.2)
75
+ rspec-support (~> 3.2.0)
76
+ rspec-expectations (3.2.0)
77
+ diff-lcs (>= 1.2.0, < 2.0)
78
+ rspec-support (~> 3.2.0)
79
+ rspec-mocks (3.2.1)
80
+ diff-lcs (>= 1.2.0, < 2.0)
81
+ rspec-support (~> 3.2.0)
82
+ rspec-support (3.2.2)
83
+ rubyzip (1.1.7)
84
+ sass (3.4.13)
85
+ sass-globbing (1.1.1)
86
+ sass (>= 3.1)
87
+ simplecov (0.9.2)
88
+ docile (~> 1.1.0)
89
+ multi_json (~> 1.0)
90
+ simplecov-html (~> 0.9.0)
91
+ simplecov-html (0.9.0)
92
+ slop (3.6.0)
77
93
  thor (0.19.1)
78
- thread_safe (0.3.1)
79
- atomic (>= 1.1.7, < 2)
80
- tzinfo (0.3.39)
81
- zip-zip (0.2)
94
+ thread_safe (0.3.5)
95
+ tzinfo (1.2.2)
96
+ thread_safe (~> 0.1)
97
+ zip-zip (0.3)
82
98
  rubyzip (>= 1.0.0)
83
99
 
84
100
  PLATFORMS
85
101
  ruby
86
102
 
87
103
  DEPENDENCIES
104
+ codeclimate-test-reporter
88
105
  kitabu!
89
106
  pry-meta
90
107
  rake
@@ -0,0 +1,235 @@
1
+ # kitabu
2
+
3
+ [![Build Status](https://travis-ci.org/fnando/kitabu.svg)](https://travis-ci.org/fnando/kitabu)
4
+ [![Code Climate](https://codeclimate.com/github/fnando/kitabu/badges/gpa.svg)](https://codeclimate.com/github/fnando/kitabu)
5
+ [![Test Coverage](https://codeclimate.com/github/fnando/kitabu/badges/coverage.svg)](https://codeclimate.com/github/fnando/kitabu)
6
+
7
+ While Prince is too expensive (495USD for a single user license), the free version available at <http://www.princexml.com/download> generates a PDF with a small logo on the first page, which is removed when sent to a printer.
8
+
9
+ ## Features
10
+
11
+ * Write using Markdown
12
+ * Book layout support
13
+ * Syntax highlight
14
+ * Generate HTML, PDF, e-Pub, Mobi and Text files
15
+ * Table of Contents automatically generated from chapter titles
16
+
17
+ ## Installation
18
+
19
+ To install Kitabu, you’ll need a working Ruby 1.9+ installation.
20
+ If you’re cool with it, just run the following command to install it.
21
+
22
+ gem install kitabu
23
+
24
+ After installing Kitabu, run the following command to check your external
25
+ dependencies.
26
+
27
+ $ kitabu check
28
+
29
+ Prince XML: Converts HTML files into PDF files.
30
+ Installed.
31
+
32
+ KindleGen: Converts ePub e-books into .mobi files.
33
+ Installed.
34
+
35
+ html2text: Converts HTML documents into plain text.
36
+ Not installed.
37
+
38
+ There are no hard requirements here; just make sure you cleared the correct dependency based on the formats you want to export to.
39
+
40
+ ## Usage
41
+
42
+ To create a new e-book, just run
43
+
44
+ $ kitabu new mybook
45
+
46
+ This command creates a directory `mybook` with the following structure:
47
+
48
+ .
49
+ ├── Gemfile
50
+ ├── Gemfile.lock
51
+ ├── Guardfile
52
+ ├── config
53
+ │   ├── helper.rb
54
+ │   └── kitabu.yml
55
+ ├── images
56
+ │   ├── kitabu-icon.png
57
+ │   ├── kitabu-icon.svg
58
+ │   ├── kitabu-word.png
59
+ │   ├── kitabu-word.svg
60
+ │   ├── kitabu.png
61
+ │   └── kitabu.svg
62
+ ├── output
63
+ ├── templates
64
+ │   ├── epub
65
+ │   │   ├── cover.erb
66
+ │   │   ├── cover.png
67
+ │   │   └── page.erb
68
+ │   ├── html
69
+ │   │   └── layout.erb
70
+ │   └── styles
71
+ │   ├── epub.scss
72
+ │   ├── files
73
+ │   │   └── _normalize.scss
74
+ │   ├── html.scss
75
+ │   ├── pdf.scss
76
+ │   └── print.scss
77
+ └── text
78
+ ├── 01_Getting_Started.md
79
+ ├── 02_Creating_Chapters.md
80
+ ├── 03_Syntax_Highlighting.erb
81
+ ├── 04_Dynamic_Content.erb
82
+ └── 05_Exporting_Files.md
83
+
84
+ The `config/kitabu.yml` file holds some information about your book; so you'll always change it.
85
+
86
+ The generated structure is actually a good example. So make sure you try it!
87
+
88
+ ![Kitabu - Sample Book](https://github.com/fnando/kitabu/raw/master/attachments/cover.png)
89
+
90
+ There's a generated sample available on the [attachments directory](https://github.com/fnando/kitabu/tree/master/attachments) •
91
+ [PDF](https://github.com/fnando/kitabu/raw/master/attachments/kitabu.pdf) /
92
+ [EPUB](https://github.com/fnando/kitabu/raw/master/attachments/kitabu.epub) /
93
+ [MOBI](https://github.com/fnando/kitabu/raw/master/attachments/kitabu.mobi) /
94
+ [HTML](https://github.com/fnando/kitabu/raw/master/attachments/browser-version.png).
95
+
96
+ Now it's time to write your e-book. All your book content will be placed on the text directory. Kitabu requires you to separate your book into chapters. A chapter is nothing but a directory that holds lots of text files. The e-book will be generated using every folder/file alphabetically. So be sure to use a sequential numbering as the name. Here's a sample:
97
+
98
+ * text
99
+ * 01_Introduction
100
+ * 01_introduction.md
101
+ * 02_What_is_Ruby_on_Rails
102
+ * 01_MVC.md
103
+ * 02_DRY.md
104
+ * 03_Convention_Over_Configuration.md
105
+ * 03_Installing_Ruby_on_Rails
106
+ * 01_Installing.md
107
+ * 02_Mac_OS_X_instructions.md
108
+ * 03_Windows_instructions.md
109
+ * 04_Ubuntu_Linux_instructions.md
110
+
111
+ If you prefer, you can add a chapter per file:
112
+
113
+ * text
114
+ * 01_Introduction.md
115
+ * 02_What_is_Ruby_on_Rails.md
116
+ * 03_Installing_Ruby_on_Rails.md
117
+
118
+ You'll want to see your progress eventually; it's time for you to generate the book PDF. Just run the command `kitabu export` and your book will be created on the `output` directory.
119
+
120
+ Kitabu can generate a Table of Contents (TOC) based on your h2-h6 tags. The h1 tag is discarded because it's meant to be the book title.
121
+
122
+ To print the TOC, you need to print a variable called +toc+, using the eRb tag.
123
+
124
+ <%= toc %>
125
+
126
+ #### Using ERB
127
+
128
+ You can also have .erb files. You can mix Markdown and HTML, like the following:
129
+
130
+ ## This the chapter title
131
+
132
+ <% note do %>
133
+ Make sure you try .erb files!
134
+ <% end %>
135
+
136
+ The above content must be placed in a `.erb` file. The generated content will be something like this:
137
+
138
+ ```html
139
+ <div class="note info">
140
+ <p>
141
+ Make sure you try .erb files!
142
+ </p>
143
+ </div>
144
+ ```
145
+
146
+ The `note` helper is built-in and can accept a different note type.
147
+
148
+ ```erb
149
+ <% note :warning do %>
150
+ Make sure you write valid ERB code.
151
+ <% end %>
152
+ ```
153
+
154
+ You can see available helpers on <https://github.com/fnando/kitabu/blob/master/lib/kitabu/markdown.rb>.
155
+
156
+ ### Syntax Highlighting
157
+
158
+ To highlight code, use fenced code blocks.
159
+
160
+ ``` ruby
161
+ class User < ActiveRecord::Base
162
+ validates_presence_of :login, :password, :email
163
+ validates_uniqueness_of :login, :email
164
+ end
165
+ ```
166
+
167
+ You can even provide options:
168
+
169
+ ```php?start_inline=1&line_numbers=1
170
+ echo "Hello World";
171
+ ```
172
+
173
+ - We use [Redcarpet](https://rubygems.org/gems/redcarpet) for Markdown processing.
174
+ - We use [Rouge](https://rubygems.org/gems/rouge) for syntax highlighting.
175
+
176
+ The following Redcarpet options are enabled:
177
+
178
+ * `autolink`
179
+ * `fenced_code_blocks`
180
+ * `footnotes`
181
+ * `hard_wrap`
182
+ * `highlight`
183
+ * `no_intra_emphasis`
184
+ * `safe_links_only`
185
+ * `space_after_headers`
186
+ * `strikethrough`
187
+ * `superscript`
188
+ * `tables`
189
+
190
+ ### References
191
+
192
+ * Markdown: <http://daringfireball.net/projects/markdown/syntax>
193
+ * Markdown PHP: <https://michelf.ca/projects/php-markdown/extra/>
194
+
195
+ ## Legal Notes
196
+
197
+ * KindleGen: [license](http://www.amazon.com/gp/feature.html?docId=1000599251).
198
+ * PrinceXML: [license](http://www.princexml.com/license/)
199
+
200
+ Alternatives:
201
+
202
+ - If you're planning to to sell your e-book, consider using [Calibre](http://calibre-ebook.com/) to convert from `.epub` to `.mobi`.
203
+ - If you're not planning to buy PrinceXML, consider using [DocRaptor](http://docraptor.com). Here's how you can easily do it:
204
+
205
+ ```bash
206
+ curl -H "Content-Type:application/json" -d'{"user_credentials":"YOUR_CREDENTIALS_HERE", "doc":{"name":"kitabu.pdf", "document_type":"pdf", "test":"false", "document_url":"https://dl.dropboxusercontent.com/u/123456789/output/kitabu.pdf.html"}}' http://docraptor.com/docs > kitabu.pdf
207
+ ```
208
+
209
+ ## Maintainer
210
+
211
+ * [Nando Vieira](http://nandovieira.com.br)
212
+ * [Jesse Storimer](http://jstorimer.com)
213
+
214
+ ## License
215
+
216
+ (The MIT License)
217
+
218
+ Permission is hereby granted, free of charge, to any person obtaining
219
+ a copy of this software and associated documentation files (the
220
+ 'Software'), to deal in the Software without restriction, including
221
+ without limitation the rights to use, copy, modify, merge, publish,
222
+ distribute, sublicense, and/or sell copies of the Software, and to
223
+ permit persons to whom the Software is furnished to do so, subject to
224
+ the following conditions:
225
+
226
+ The above copyright notice and this permission notice shall be
227
+ included in all copies or substantial portions of the Software.
228
+
229
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
230
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
231
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
232
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
233
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
234
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
235
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file