epubber 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 054611e5caa73165a0033e77320b5f3382226fec
4
- data.tar.gz: f5daa10b8e040f4904c28c6eae772b7c59c90957
3
+ metadata.gz: 76429913c62496698719265f293d923e73470b40
4
+ data.tar.gz: 7b29b2bfe6142cc238b1fbf973dd009f36745325
5
5
  SHA512:
6
- metadata.gz: a0561c9a2afdbaf26ff71b83875361f7908b5a7a9398d75f97dff0dcda3de3d6753d52fb575bea3ae891d54dd4c23db30a5fac374df8dd87cd0ef2c1ca98c7cc
7
- data.tar.gz: ba7fadf75790e51e1756ba2abd74b40a8b54caae84b82b976807f69ab0bd76dcdc72c633912069da361bfebcac2b58443fbef6495e04f9e444ce16142d9e1708
6
+ metadata.gz: 83faa5f556544b8f6f2fbebe77cf76bbf27ac051c4c4b545990d902da43ec070cea258defafe62749aaf98b5b969a3d1e06e5228d7ef01abc46528d1e17f4cd5
7
+ data.tar.gz: 1050cc0d622bee5a9fc7b067214e8520fe14051238b219deb39074757473413720b47f293207903636056bf761ae90f5555897031966c829aefe93038f6906cb
data/epubber.gemspec CHANGED
@@ -24,4 +24,5 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.add_runtime_dependency "liquid", "~> 3.0"
26
26
  spec.add_runtime_dependency "rubyzip", ">= 1.0.0"
27
+ spec.add_runtime_dependency "nokogiri", "~> 1.6"
27
28
  end
@@ -14,7 +14,6 @@ module Epubber::Models
14
14
  def initialize
15
15
  @title = not_specified
16
16
  @author = not_specified
17
- @description = not_specified
18
17
  @publisher = not_specified
19
18
  @language = 'en'
20
19
  @url = not_specified
@@ -36,10 +35,6 @@ module Epubber::Models
36
35
  @publisher = text
37
36
  end
38
37
 
39
- def description(text)
40
- @description = text
41
- end
42
-
43
38
  def language(lang)
44
39
  @language = lang
45
40
  end
@@ -62,7 +57,6 @@ module Epubber::Models
62
57
  # Attributes
63
58
  "title" => @title,
64
59
  "author" => @author,
65
- "description" => @description,
66
60
  "publisher" => @publisher,
67
61
  "language" => @language,
68
62
  "url" => @url,
@@ -1,6 +1,10 @@
1
+ require 'epubber/models/concerns/has_endnotes'
2
+
1
3
  # Represents a book's chapter
2
4
  module Epubber::Models
3
5
  class Chapter
6
+ include Epubber::Models::Concerns::HasHTML
7
+
4
8
  def initialize
5
9
  @id = 0
6
10
  @title = 'Not specified'
@@ -16,7 +20,7 @@ module Epubber::Models
16
20
  end
17
21
 
18
22
  def content(text)
19
- @content = text
23
+ @content = clean_html(text)
20
24
  end
21
25
 
22
26
  def contextify
@@ -0,0 +1,10 @@
1
+ require 'epubber/models/chapter'
2
+ require 'nokogiri'
3
+
4
+ module Epubber::Models::Concerns
5
+ module HasHTML
6
+ def clean_html(html)
7
+ Nokogiri::XML::DocumentFragment.parse(html).to_s
8
+ end
9
+ end
10
+ end
@@ -1,12 +1,16 @@
1
+ require 'epubber/models/concerns/has_endnotes'
2
+
1
3
  # Represents a book's introduction
2
4
  module Epubber::Models
3
5
  class Endnotes
6
+ include Epubber::Models::Concerns::HasHTML
7
+
4
8
  def initialize
5
9
  @content = '<p>Not specified</p>'
6
10
  end
7
11
 
8
12
  def content(content)
9
- @content = content
13
+ @content = clean_html(content)
10
14
  end
11
15
 
12
16
  def contextify
@@ -1,12 +1,16 @@
1
+ require 'epubber/models/concerns/has_endnotes'
2
+
1
3
  # Represents a book's introduction
2
4
  module Epubber::Models
3
5
  class Introduction
6
+ include Epubber::Models::Concerns::HasHTML
7
+
4
8
  def initialize
5
9
  @content = '<p>Not specified</p>'
6
10
  end
7
11
 
8
12
  def content(content)
9
- @content = content
13
+ @content = clean_html(content)
10
14
  end
11
15
 
12
16
  def contextify
@@ -1,3 +1,3 @@
1
1
  module Epubber
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epubber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Federico Ramirez
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.0.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: nokogiri
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.6'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.6'
83
97
  description:
84
98
  email:
85
99
  - fedra.arg@gmail.com
@@ -106,6 +120,7 @@ files:
106
120
  - lib/epubber/models/chapter.rb
107
121
  - lib/epubber/models/concerns/has_chapters.rb
108
122
  - lib/epubber/models/concerns/has_endnotes.rb
123
+ - lib/epubber/models/concerns/has_html.rb
109
124
  - lib/epubber/models/concerns/has_introduction.rb
110
125
  - lib/epubber/models/endnotes.rb
111
126
  - lib/epubber/models/introduction.rb