kitabu 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7373f8260e5946669b21df6e626ca0742e765b4078a6d739452580cf892cea0b
4
- data.tar.gz: f440520e583e4955bd66903f7ca057c1abaccbf9e30868270ed595318bfb57eb
3
+ metadata.gz: 7a15501f3e1767a56b549ee1ec0362330f1e06f9d09a30f45ee48ee7336b1331
4
+ data.tar.gz: e49ef66fd50e324a611f16671915905baf031fc0dc1d0ff7e0e56a14eaf6b62a
5
5
  SHA512:
6
- metadata.gz: f506160c9264ea90b0dc7e42f8e9530c80376a7ec10dd4d0f1294b15803902ad584b9a3b61cb96b2639729472ed62d1b4030fa2915344014064dd7240d7b61eb
7
- data.tar.gz: acfa26ae9ad539737948607617a424f1af733966b023f5e02dfa4706e9482001e594789eba9ffb6271e6eeb6eb6e53d982944ea16cddf80b1ffc3592a8f35941
6
+ metadata.gz: 65b392f97c0b51b1a5b863476b6d6a18ee5b4acf66e2d31fb48c43ef14044eaf30abe45169da2e52b84541f221435058a59c72b05c309e835f8cf6bd1b495642
7
+ data.tar.gz: d40bd333e9487e20b1467ab554c1d8b3162d02aed3383ec20cb25a6d64ac68e3570609ffae7c4deeb7b6c8a854a98893e088b51815880bd09b74a5d3b4557ed1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v3.0.3
4
+
5
+ - Fix Rouge options keys; symbols are required.
6
+
3
7
  ## v3.0.2
4
8
 
5
9
  - Fix `styles` directory copying.
data/kitabu.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.version = Kitabu::Version::STRING
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.authors = ["Nando Vieira"]
11
- s.email = ["fnando.vieira@gmail.com"]
11
+ s.email = ["me@fnando.com"]
12
12
  s.homepage = "http://rubygems.org/gems/kitabu"
13
13
  s.summary = "A framework for creating e-books from Markdown " \
14
14
  "using Ruby. Using the Prince PDF generator, " \
@@ -20,6 +20,10 @@ module Kitabu
20
20
  @source = root_dir.join("text")
21
21
  end
22
22
 
23
+ def export
24
+ FileUtils.mkdir_p(root_dir.join("output"))
25
+ end
26
+
23
27
  def source_list
24
28
  @source_list ||= SourceList.new(root_dir)
25
29
  end
@@ -6,6 +6,8 @@ module Kitabu
6
6
  attr_reader :root_dir
7
7
 
8
8
  def export
9
+ super
10
+
9
11
  FileUtils.cp_r(
10
12
  root_dir.join("templates/styles").to_s,
11
13
  root_dir.join("output").to_s
@@ -24,6 +24,7 @@ module Kitabu
24
24
  end
25
25
 
26
26
  def export
27
+ super
27
28
  copy_styles!
28
29
  copy_images!
29
30
  set_metadata!
@@ -14,6 +14,7 @@ module Kitabu
14
14
  # to <tt>output/book_name.html</tt>.
15
15
  #
16
16
  def export
17
+ super
17
18
  copy_images!
18
19
  copy_fonts!
19
20
  export_stylesheets!
@@ -4,6 +4,7 @@ module Kitabu
4
4
  class Exporter
5
5
  class Mobi < Base
6
6
  def export
7
+ super
7
8
  spawn_command ["ebook-convert", epub_file.to_s, mobi_file.to_s]
8
9
  true
9
10
  end
@@ -4,6 +4,7 @@ module Kitabu
4
4
  class Exporter
5
5
  class PDF < Base
6
6
  def export
7
+ super
7
8
  apply_footnotes!
8
9
  spawn_command ["prince", html_for_pdf.to_s, "-o", pdf_file.to_s]
9
10
  spawn_command ["prince", html_for_print.to_s, "-o", print_file.to_s]
@@ -5,6 +5,8 @@ module Rouge
5
5
  module Redcarpet
6
6
  def rouge_formatter(lexer)
7
7
  options = lexer.respond_to?(:options) ? lexer.options : {}
8
+ options = options.keys.map(&:to_sym).zip(options.values).to_h
9
+ options[:start_line] = options.fetch(:start_line, 1).to_i
8
10
 
9
11
  Formatters::HTMLLegacy.new(
10
12
  {css_class: "highlight #{lexer.tag}"}.merge(options)
@@ -4,7 +4,7 @@ module Kitabu
4
4
  module Version
5
5
  MAJOR = 3
6
6
  MINOR = 0
7
- PATCH = 2
7
+ PATCH = 3
8
8
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
9
9
  end
10
10
  end
@@ -7,6 +7,7 @@ describe Kitabu::Exporter::Mobi, calibre: Kitabu::Dependency.calibre? do
7
7
  root = SPECDIR.join("support/mybook")
8
8
 
9
9
  Kitabu::Exporter::HTML.export(root)
10
+ Kitabu::Exporter::Epub.export(root)
10
11
  Kitabu::Exporter::Mobi.export(root)
11
12
 
12
13
  expect(root.join("output/mybook.mobi")).to be_file
@@ -24,6 +24,17 @@ describe Kitabu::Markdown do
24
24
  expect(html).to include('<span class="k">echo</span>')
25
25
  end
26
26
 
27
+ it "enables line numbers" do
28
+ html = Kitabu::Markdown.render <<-TEXT.strip_heredoc
29
+ ```ruby?line_numbers=true
30
+ class User
31
+ end
32
+ ```
33
+ TEXT
34
+
35
+ expect(html).to include(%[<table class="rouge-table">])
36
+ end
37
+
27
38
  it "does not raise with unknown lexers" do
28
39
  expect do
29
40
  Kitabu::Markdown.render <<-TEXT.strip_heredoc
data/spec/spec_helper.rb CHANGED
@@ -46,7 +46,7 @@ RSpec.configure do |config|
46
46
  )
47
47
 
48
48
  cleaner = proc do
49
- [TMPDIR].each do |i|
49
+ [TMPDIR, SPECDIR.join("support/mybook/output")].each do |i|
50
50
  FileUtils.rm_rf(i) if File.exist?(i)
51
51
  end
52
52
 
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: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-19 00:00:00.000000000 Z
11
+ date: 2022-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -224,7 +224,7 @@ description: A framework for creating e-books from Markdown using Ruby. Using th
224
224
  Prince PDF generator, you'll be able to get high quality PDFs. Also supports EPUB,
225
225
  Mobi, Text and HTML generation.
226
226
  email:
227
- - fnando.vieira@gmail.com
227
+ - me@fnando.com
228
228
  executables:
229
229
  - kitabu
230
230
  extensions: []