gepub 1.0.14 → 1.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/gepub.gemspec +1 -1
- data/lib/gepub/bindings.rb +2 -0
- data/lib/gepub/book.rb +2 -0
- data/lib/gepub/inspect_mixin.rb +26 -0
- data/lib/gepub/item.rb +8 -4
- data/lib/gepub/manifest.rb +2 -0
- data/lib/gepub/meta.rb +6 -4
- data/lib/gepub/metadata.rb +2 -0
- data/lib/gepub/package.rb +8 -5
- data/lib/gepub/spine.rb +9 -5
- data/lib/gepub/version.rb +1 -1
- data/lib/gepub.rb +1 -0
- data/tools/generate_function.rb +1 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19218e13519e47532dee8d0a4f1c45a3acaa65dd105b4fcd1b09774f9f482bd6
|
4
|
+
data.tar.gz: abeb56bc8baa0d505f75af8403eb4e59a86aa386aeac83040c2dcf9fc2f5b45e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1c20a5567c1033fceafbe660f8bc2b227b3a269125d1da4b58d2183fb13f24a4f7e56242100e37b662f03a17ebb744fc686151782ef2d8fb36c9d94ef39275b
|
7
|
+
data.tar.gz: 6dcf08c29ca933edba399cd1ffbb001196d8d8ef74cb62bcb8619135eddec743975b1654b5c3ce57342d91da7c8166949057591da1d3e429c1f326967544077e
|
data/gepub.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.add_runtime_dependency "nokogiri", ">= 1.8.2", "<
|
19
|
+
s.add_runtime_dependency "nokogiri", ">= 1.8.2", "< 2.0"
|
20
20
|
s.add_runtime_dependency "rubyzip", "> 1.1.1", "< 2.4"
|
21
21
|
s.add_development_dependency "epubcheck-ruby"
|
22
22
|
s.add_development_dependency "rake"
|
data/lib/gepub/bindings.rb
CHANGED
data/lib/gepub/book.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
module GEPUB
|
2
|
+
module InspectMixin
|
3
|
+
def inspect
|
4
|
+
result = instance_variables.each
|
5
|
+
.with_object({}) { |name, h| h[name] = instance_variable_get(name) }
|
6
|
+
.reject { |name, value| value.nil? }
|
7
|
+
.map { |name, value|
|
8
|
+
case value
|
9
|
+
when true, false, Symbol, Numeric, Array, Hash
|
10
|
+
"#{name}=#{value.inspect}"
|
11
|
+
when String
|
12
|
+
if value.length > 80
|
13
|
+
"#{name}=(omitted)"
|
14
|
+
else
|
15
|
+
"#{name}=#{value.inspect}"
|
16
|
+
end
|
17
|
+
else
|
18
|
+
"#{name}=#<#{value.class.name}>"
|
19
|
+
end
|
20
|
+
}
|
21
|
+
.join(' ')
|
22
|
+
|
23
|
+
"#<#{self.class.name} " + result + '>'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/gepub/item.rb
CHANGED
@@ -6,6 +6,8 @@ module GEPUB
|
|
6
6
|
# #id, #id=, #set_id, #href, #href=, #set_href, #media_type, #media_type=, #set_media_type,
|
7
7
|
# #fallback, #fallback=, #set_fallback, #media_overlay, #media_overlay=, #set_media_overlay
|
8
8
|
class Item
|
9
|
+
include InspectMixin
|
10
|
+
|
9
11
|
attr_accessor :content
|
10
12
|
def self.create(parent, attributes = {})
|
11
13
|
Item.new(attributes['id'], attributes['href'], attributes['media-type'], parent,
|
@@ -46,12 +48,14 @@ module GEPUB
|
|
46
48
|
media_type
|
47
49
|
end
|
48
50
|
|
49
|
-
|
50
|
-
|
51
|
+
# get +attribute+
|
52
|
+
def [](attribute)
|
53
|
+
@attributes[attribute]
|
51
54
|
end
|
52
55
|
|
53
|
-
|
54
|
-
|
56
|
+
# set +attribute+
|
57
|
+
def []=(attribute, value)
|
58
|
+
@attributes[attribute] = value
|
55
59
|
end
|
56
60
|
|
57
61
|
# add value to properties attribute.
|
data/lib/gepub/manifest.rb
CHANGED
data/lib/gepub/meta.rb
CHANGED
@@ -16,12 +16,14 @@ module GEPUB
|
|
16
16
|
@parent.register_meta(self) unless @parent.nil?
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
# get +attribute+
|
20
|
+
def [](attribute)
|
21
|
+
@attributes[attribute]
|
21
22
|
end
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
# set +attribute+
|
25
|
+
def []=(attribute, value)
|
26
|
+
@attributes[attribute] = value
|
25
27
|
end
|
26
28
|
|
27
29
|
def refiner_list(name)
|
data/lib/gepub/metadata.rb
CHANGED
@@ -18,6 +18,8 @@ module GEPUB
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
include XMLUtil, DSLUtil
|
21
|
+
include InspectMixin
|
22
|
+
|
21
23
|
attr_accessor :opf_version
|
22
24
|
# parse metadata element. metadata_xml should be Nokogiri::XML::Node object.
|
23
25
|
def self.parse(metadata_xml, opf_version = '3.0', id_pool = Package::IDPool.new)
|
data/lib/gepub/package.rb
CHANGED
@@ -6,6 +6,8 @@ module GEPUB
|
|
6
6
|
# Holds data in opf file.
|
7
7
|
class Package
|
8
8
|
include XMLUtil, DSLUtil
|
9
|
+
include InspectMixin
|
10
|
+
|
9
11
|
extend Forwardable
|
10
12
|
attr_accessor :path, :metadata, :manifest, :spine, :bindings, :epub_backward_compat, :contents_prefix, :prefixes
|
11
13
|
def_delegators :@manifest, :item_by_href
|
@@ -142,15 +144,16 @@ module GEPUB
|
|
142
144
|
})
|
143
145
|
}
|
144
146
|
|
145
|
-
|
146
|
-
|
147
|
+
# get +attribute+
|
148
|
+
def [](attribute)
|
149
|
+
@attributes[attribute]
|
147
150
|
end
|
148
151
|
|
149
|
-
|
150
|
-
|
152
|
+
# set +attribute+
|
153
|
+
def []=(attribute, value)
|
154
|
+
@attributes[attribute] = value
|
151
155
|
end
|
152
156
|
|
153
|
-
|
154
157
|
def identifier(identifier=UNASSIGNED)
|
155
158
|
if unassigned?(identifier)
|
156
159
|
@metadata.identifier_by_id(unique_identifier)
|
data/lib/gepub/spine.rb
CHANGED
@@ -3,6 +3,8 @@ require 'nokogiri'
|
|
3
3
|
module GEPUB
|
4
4
|
class Spine
|
5
5
|
include XMLUtil
|
6
|
+
include InspectMixin
|
7
|
+
|
6
8
|
attr_accessor :opf_version
|
7
9
|
class Itemref
|
8
10
|
def self.create(parent, attributes = {})
|
@@ -26,14 +28,16 @@ module GEPUB
|
|
26
28
|
define_method(methodbase) { @attributes[name] }
|
27
29
|
}
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
+
# get +attribute+
|
32
|
+
def [](attribute)
|
33
|
+
@attributes[attribute]
|
31
34
|
end
|
32
35
|
|
33
|
-
|
34
|
-
|
36
|
+
# set +attribute+
|
37
|
+
def []=(attribute, value)
|
38
|
+
@attributes[attribute] = value
|
35
39
|
end
|
36
|
-
|
40
|
+
|
37
41
|
def add_property(property)
|
38
42
|
(@attributes['properties'] ||=[]) << property
|
39
43
|
end
|
data/lib/gepub/version.rb
CHANGED
data/lib/gepub.rb
CHANGED
data/tools/generate_function.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gepub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KOJIMA Satoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 1.8.2
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '2.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 1.8.2
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '2.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rubyzip
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- lib/gepub/builder_mixin.rb
|
144
144
|
- lib/gepub/datemeta.rb
|
145
145
|
- lib/gepub/dsl_util.rb
|
146
|
+
- lib/gepub/inspect_mixin.rb
|
146
147
|
- lib/gepub/item.rb
|
147
148
|
- lib/gepub/manifest.rb
|
148
149
|
- lib/gepub/meta.rb
|