kitabu 2.1.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +5 -5
  2. data/.github/CODEOWNERS +4 -0
  3. data/.github/FUNDING.yml +4 -0
  4. data/.github/ISSUE_TEMPLATE/bug_report.md +41 -0
  5. data/.github/ISSUE_TEMPLATE/config.yml +5 -0
  6. data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
  7. data/.github/PULL_REQUEST_TEMPLATE.md +38 -0
  8. data/.github/dependabot.yml +15 -0
  9. data/.github/workflows/ruby-tests.yml +61 -0
  10. data/.rubocop.yml +17 -0
  11. data/CHANGELOG.md +13 -2
  12. data/CODE_OF_CONDUCT.md +74 -0
  13. data/CONTRIBUTING.md +79 -0
  14. data/Gemfile +2 -0
  15. data/LICENSE.md +20 -0
  16. data/README.md +103 -88
  17. data/Rakefile +7 -0
  18. data/bin/kitabu +4 -0
  19. data/kitabu.gemspec +21 -15
  20. data/lib/kitabu/cli.rb +54 -39
  21. data/lib/kitabu/dependency.rb +11 -5
  22. data/lib/kitabu/errors.rb +2 -0
  23. data/lib/kitabu/exporter/base.rb +11 -11
  24. data/lib/kitabu/exporter/css.rb +6 -15
  25. data/lib/kitabu/exporter/epub.rb +23 -17
  26. data/lib/kitabu/exporter/html.rb +27 -21
  27. data/lib/kitabu/exporter/mobi.rb +7 -1
  28. data/lib/kitabu/exporter/pdf.rb +9 -3
  29. data/lib/kitabu/exporter.rb +15 -16
  30. data/lib/kitabu/extensions/rouge.rb +6 -1
  31. data/lib/kitabu/extensions/string.rb +5 -3
  32. data/lib/kitabu/footnotes/base.rb +2 -0
  33. data/lib/kitabu/footnotes/html.rb +18 -13
  34. data/lib/kitabu/footnotes/pdf.rb +17 -11
  35. data/lib/kitabu/generator.rb +13 -8
  36. data/lib/kitabu/helpers.rb +12 -9
  37. data/lib/kitabu/markdown.rb +12 -10
  38. data/lib/kitabu/source_list.rb +15 -12
  39. data/lib/kitabu/stats.rb +3 -1
  40. data/lib/kitabu/syntax/highlight.rb +4 -11
  41. data/lib/kitabu/toc/epub.rb +5 -2
  42. data/lib/kitabu/toc/html/stream.rb +3 -1
  43. data/lib/kitabu/toc/html.rb +12 -8
  44. data/lib/kitabu/version.rb +4 -2
  45. data/lib/kitabu.rb +8 -10
  46. data/spec/kitabu/cli/export_spec.rb +6 -4
  47. data/spec/kitabu/cli/new_spec.rb +6 -4
  48. data/spec/kitabu/cli/permalinks_spec.rb +4 -2
  49. data/spec/kitabu/cli/stats_spec.rb +19 -15
  50. data/spec/kitabu/cli/version_spec.rb +3 -1
  51. data/spec/kitabu/exporter/css_spec.rb +3 -1
  52. data/spec/kitabu/exporter/epub_spec.rb +2 -0
  53. data/spec/kitabu/exporter/html_spec.rb +11 -9
  54. data/spec/kitabu/exporter/mobi_spec.rb +5 -5
  55. data/spec/kitabu/exporter/pdf_spec.rb +8 -4
  56. data/spec/kitabu/extensions/string_spec.rb +14 -9
  57. data/spec/kitabu/footnotes/html_spec.rb +35 -33
  58. data/spec/kitabu/generator_spec.rb +3 -1
  59. data/spec/kitabu/markdown_spec.rb +8 -6
  60. data/spec/kitabu/source_list_spec.rb +8 -2
  61. data/spec/kitabu/stats_spec.rb +10 -6
  62. data/spec/kitabu/toc/html_spec.rb +37 -21
  63. data/spec/spec_helper.rb +23 -8
  64. data/spec/support/exit_with_code.rb +7 -5
  65. data/spec/support/have_tag.rb +44 -32
  66. data/spec/support/helper.rb +5 -3
  67. data/spec/support/mybook/code/code.rb +2 -0
  68. data/spec/support/mybook/config/helper.rb +2 -0
  69. data/spec/support/shared.rb +8 -6
  70. data/templates/Gemfile +5 -3
  71. data/templates/Guardfile +3 -1
  72. data/templates/helper.rb +8 -6
  73. data/templates/templates/styles/epub.css +1 -0
  74. data/templates/templates/styles/files/normalize.css +351 -0
  75. data/templates/templates/styles/{html.scss → html.css} +28 -26
  76. data/templates/templates/styles/{pdf.scss → pdf.css} +49 -47
  77. data/templates/templates/styles/print.css +2 -0
  78. data/templates/text/01_Getting_Started.md +27 -9
  79. data/templates/text/02_Creating_Chapters.md +9 -3
  80. data/templates/text/{03_Syntax_Highlighting.erb → 03_Syntax_Highlighting.md.erb} +12 -7
  81. data/templates/text/04_Dynamic_Content.md.erb +48 -0
  82. data/templates/text/05_Exporting_Files.md +17 -8
  83. metadata +40 -48
  84. data/.gitmodules +0 -3
  85. data/.travis.yml +0 -18
  86. data/lib/kitabu/exporter/txt.rb +0 -18
  87. data/spec/kitabu/exporter/txt_spec.rb +0 -14
  88. data/templates/ebook.png +0 -0
  89. data/templates/templates/styles/epub.scss +0 -1
  90. data/templates/templates/styles/files/_normalize.scss +0 -427
  91. data/templates/templates/styles/print.scss +0 -2
  92. data/templates/text/04_Dynamic_Content.erb +0 -64
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitabu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-05 00:00:00.000000000 Z
11
+ date: 2022-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: nokogiri
28
+ name: eeepub-with-cover-support
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: thor
56
+ name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: eeepub-with-cover-support
84
+ name: rouge
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,21 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rouge
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '2.0'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '2.0'
111
- - !ruby/object:Gem::Dependency
112
- name: notifier
98
+ name: rubyzip
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - ">="
@@ -123,7 +109,7 @@ dependencies:
123
109
  - !ruby/object:Gem::Version
124
110
  version: '0'
125
111
  - !ruby/object:Gem::Dependency
126
- name: rubyzip
112
+ name: thor
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
115
  - - ">="
@@ -151,13 +137,13 @@ dependencies:
151
137
  - !ruby/object:Gem::Version
152
138
  version: '0'
153
139
  - !ruby/object:Gem::Dependency
154
- name: sass
140
+ name: pry-meta
155
141
  requirement: !ruby/object:Gem::Requirement
156
142
  requirements:
157
143
  - - ">="
158
144
  - !ruby/object:Gem::Version
159
145
  version: '0'
160
- type: :runtime
146
+ type: :development
161
147
  prerelease: false
162
148
  version_requirements: !ruby/object:Gem::Requirement
163
149
  requirements:
@@ -165,13 +151,13 @@ dependencies:
165
151
  - !ruby/object:Gem::Version
166
152
  version: '0'
167
153
  - !ruby/object:Gem::Dependency
168
- name: sass-globbing
154
+ name: rake
169
155
  requirement: !ruby/object:Gem::Requirement
170
156
  requirements:
171
157
  - - ">="
172
158
  - !ruby/object:Gem::Version
173
159
  version: '0'
174
- type: :runtime
160
+ type: :development
175
161
  prerelease: false
176
162
  version_requirements: !ruby/object:Gem::Requirement
177
163
  requirements:
@@ -193,7 +179,7 @@ dependencies:
193
179
  - !ruby/object:Gem::Version
194
180
  version: '0'
195
181
  - !ruby/object:Gem::Dependency
196
- name: rake
182
+ name: rubocop
197
183
  requirement: !ruby/object:Gem::Requirement
198
184
  requirements:
199
185
  - - ">="
@@ -207,7 +193,7 @@ dependencies:
207
193
  - !ruby/object:Gem::Version
208
194
  version: '0'
209
195
  - !ruby/object:Gem::Dependency
210
- name: pry-meta
196
+ name: rubocop-fnando
211
197
  requirement: !ruby/object:Gem::Requirement
212
198
  requirements:
213
199
  - - ">="
@@ -221,7 +207,7 @@ dependencies:
221
207
  - !ruby/object:Gem::Version
222
208
  version: '0'
223
209
  - !ruby/object:Gem::Dependency
224
- name: codeclimate-test-reporter
210
+ name: simplecov
225
211
  requirement: !ruby/object:Gem::Requirement
226
212
  requirements:
227
213
  - - ">="
@@ -244,12 +230,22 @@ executables:
244
230
  extensions: []
245
231
  extra_rdoc_files: []
246
232
  files:
233
+ - ".github/CODEOWNERS"
234
+ - ".github/FUNDING.yml"
235
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
236
+ - ".github/ISSUE_TEMPLATE/config.yml"
237
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
238
+ - ".github/PULL_REQUEST_TEMPLATE.md"
239
+ - ".github/dependabot.yml"
240
+ - ".github/workflows/ruby-tests.yml"
247
241
  - ".gitignore"
248
- - ".gitmodules"
249
242
  - ".rspec"
250
- - ".travis.yml"
243
+ - ".rubocop.yml"
251
244
  - CHANGELOG.md
245
+ - CODE_OF_CONDUCT.md
246
+ - CONTRIBUTING.md
252
247
  - Gemfile
248
+ - LICENSE.md
253
249
  - README.md
254
250
  - Rakefile
255
251
  - attachments/browser-version.png
@@ -270,7 +266,6 @@ files:
270
266
  - lib/kitabu/exporter/html.rb
271
267
  - lib/kitabu/exporter/mobi.rb
272
268
  - lib/kitabu/exporter/pdf.rb
273
- - lib/kitabu/exporter/txt.rb
274
269
  - lib/kitabu/extensions/rouge.rb
275
270
  - lib/kitabu/extensions/string.rb
276
271
  - lib/kitabu/footnotes/base.rb
@@ -296,7 +291,6 @@ files:
296
291
  - spec/kitabu/exporter/html_spec.rb
297
292
  - spec/kitabu/exporter/mobi_spec.rb
298
293
  - spec/kitabu/exporter/pdf_spec.rb
299
- - spec/kitabu/exporter/txt_spec.rb
300
294
  - spec/kitabu/extensions/string_spec.rb
301
295
  - spec/kitabu/footnotes/html_spec.rb
302
296
  - spec/kitabu/generator_spec.rb
@@ -336,7 +330,6 @@ files:
336
330
  - templates/Guardfile
337
331
  - templates/config.erb
338
332
  - templates/cover.erb
339
- - templates/ebook.png
340
333
  - templates/epub.erb
341
334
  - templates/helper.rb
342
335
  - templates/images/.gitkeep
@@ -350,23 +343,24 @@ files:
350
343
  - templates/templates/epub/cover.png
351
344
  - templates/templates/epub/page.erb
352
345
  - templates/templates/html/layout.erb
353
- - templates/templates/styles/epub.scss
354
- - templates/templates/styles/files/_normalize.scss
355
- - templates/templates/styles/html.scss
356
- - templates/templates/styles/pdf.scss
357
- - templates/templates/styles/print.scss
346
+ - templates/templates/styles/epub.css
347
+ - templates/templates/styles/files/normalize.css
348
+ - templates/templates/styles/html.css
349
+ - templates/templates/styles/pdf.css
350
+ - templates/templates/styles/print.css
358
351
  - templates/text/01_Getting_Started.md
359
352
  - templates/text/02_Creating_Chapters.md
360
- - templates/text/03_Syntax_Highlighting.erb
361
- - templates/text/04_Dynamic_Content.erb
353
+ - templates/text/03_Syntax_Highlighting.md.erb
354
+ - templates/text/04_Dynamic_Content.md.erb
362
355
  - templates/text/05_Exporting_Files.md
363
356
  - vendor/bin/tidy5_linux
364
357
  - vendor/bin/tidy5_osx
365
358
  homepage: http://rubygems.org/gems/kitabu
366
359
  licenses:
367
360
  - MIT
368
- metadata: {}
369
- post_install_message:
361
+ metadata:
362
+ rubygems_mfa_required: 'true'
363
+ post_install_message:
370
364
  rdoc_options: []
371
365
  require_paths:
372
366
  - lib
@@ -374,16 +368,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
374
368
  requirements:
375
369
  - - ">="
376
370
  - !ruby/object:Gem::Version
377
- version: '2.0'
371
+ version: '2.7'
378
372
  required_rubygems_version: !ruby/object:Gem::Requirement
379
373
  requirements:
380
374
  - - ">="
381
375
  - !ruby/object:Gem::Version
382
376
  version: '0'
383
377
  requirements: []
384
- rubyforge_project:
385
- rubygems_version: 2.5.1
386
- signing_key:
378
+ rubygems_version: 3.3.7
379
+ signing_key:
387
380
  specification_version: 4
388
381
  summary: A framework for creating e-books from Markdown using Ruby. Using the Prince
389
382
  PDF generator, you'll be able to get high quality PDFs. Also supports EPUB, Mobi,
@@ -399,7 +392,6 @@ test_files:
399
392
  - spec/kitabu/exporter/html_spec.rb
400
393
  - spec/kitabu/exporter/mobi_spec.rb
401
394
  - spec/kitabu/exporter/pdf_spec.rb
402
- - spec/kitabu/exporter/txt_spec.rb
403
395
  - spec/kitabu/extensions/string_spec.rb
404
396
  - spec/kitabu/footnotes/html_spec.rb
405
397
  - spec/kitabu/generator_spec.rb
data/.gitmodules DELETED
@@ -1,3 +0,0 @@
1
- [submodule "lib/kitabu/vendor/colorize"]
2
- path = lib/kitabu/vendor/colorize
3
- url = git://github.com/fnando/colorize.git
data/.travis.yml DELETED
@@ -1,18 +0,0 @@
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="
@@ -1,18 +0,0 @@
1
- module Kitabu
2
- class Exporter
3
- class Txt < Base
4
- def export
5
- spawn_command ["html2text", "-style", "pretty", "-nobs", "-o", txt_file.to_s, html_file.to_s]
6
- end
7
-
8
- def html_file
9
- root_dir.join("output/#{name}.html")
10
- end
11
-
12
- def txt_file
13
- root_dir.join("output/#{name}.txt")
14
- end
15
- end
16
- end
17
- end
18
-
@@ -1,14 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Kitabu::Exporter::Txt, html2text: Kitabu::Dependency.html2text? do
4
- let(:root) { SPECDIR.join("support/mybook") }
5
-
6
- before do
7
- Kitabu::Exporter::HTML.export(root)
8
- Kitabu::Exporter::Txt.export(root)
9
- end
10
-
11
- it "generates text file" do
12
- expect(root.join("output/mybook.txt")).to be_file
13
- end
14
- end
data/templates/ebook.png DELETED
Binary file
@@ -1 +0,0 @@
1
- @import './files/normalize';