gepub 0.6.8 → 0.6.8.3

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.
data/.gitattributes ADDED
@@ -0,0 +1,49 @@
1
+ *.doc diff=astextplain
2
+ *.DOC diff=astextplain
3
+ *.docx diff=astextplain
4
+ *.DOCX diff=astextplain
5
+ *.dot diff=astextplain
6
+ *.DOT diff=astextplain
7
+ *.pdf diff=astextplain
8
+ *.PDF diff=astextplain
9
+ *.rtf diff=astextplain
10
+ *.RTF diff=astextplain
11
+
12
+ *.jpg binary
13
+ *.png binary
14
+ *.gif binary
15
+
16
+ *.cs text=auto diff=csharp
17
+ *.vb text=auto
18
+ *.c text=auto
19
+ *.cpp text=auto
20
+ *.cxx text=auto
21
+ *.h text=auto
22
+ *.hxx text=auto
23
+ *.py text=auto
24
+ *.rb text=auto
25
+ *.java text=auto
26
+ *.html text=auto
27
+ *.htm text=auto
28
+ *.css text=auto
29
+ *.scss text=auto
30
+ *.sass text=auto
31
+ *.less text=auto
32
+ *.js text=auto
33
+ *.lisp text=auto
34
+ *.clj text=auto
35
+ *.sql text=auto
36
+ *.php text=auto
37
+ *.lua text=auto
38
+ *.m text=auto
39
+ *.asm text=auto
40
+ *.erl text=auto
41
+ *.fs text=auto
42
+ *.fsx text=auto
43
+ *.hs text=auto
44
+
45
+ *.csproj text=auto merge=union
46
+ *.vbproj text=auto merge=union
47
+ *.fsproj text=auto merge=union
48
+ *.dbproj text=auto merge=union
49
+ *.sln text=auto eol=crlf merge=union
@@ -84,7 +84,7 @@ module GEPUB
84
84
  @oldstyle_meta = []
85
85
  end
86
86
 
87
- CONTENT_NODE_LIST = ['identifier','title', 'language', 'contributor', 'creator', 'coverage', 'date','description','format ','publisher','relation','rights','source','subject','type'].each {
87
+ CONTENT_NODE_LIST = ['identifier','title', 'language', 'contributor', 'creator', 'coverage', 'date','description','format','publisher','relation','rights','source','subject','type'].each {
88
88
  |node|
89
89
  define_method(node + '_list') { @content_nodes[node].dup }
90
90
  define_method(node + '_clear') {
data/lib/gepub/package.rb CHANGED
@@ -5,7 +5,14 @@ module GEPUB
5
5
  # Holds data in opf file.
6
6
  class Package
7
7
  include XMLUtil
8
+ extend Forwardable
8
9
  attr_accessor :path, :metadata, :manifest, :spine, :bindings, :epub_backward_compat, :contents_prefix
10
+ def_delegators :@manifest, :item_by_href
11
+ def_delegators :@metadata, *Metadata::CONTENT_NODE_LIST.map {
12
+ |x|
13
+ ["#{x}", "#{x}_list", "set_#{x}", "#{x}=", "add_#{x}"]
14
+ }.flatten
15
+
9
16
 
10
17
  class IDPool
11
18
  def initialize
@@ -152,18 +159,6 @@ module GEPUB
152
159
  @manifest.item_list
153
160
  end
154
161
 
155
- def method_missing(name, *args)
156
- return @manifest.send(name.to_sym, *args) if [:item_by_href].member? name
157
- Metadata::CONTENT_NODE_LIST.each {
158
- |x|
159
- case name.to_s
160
- when x, "#{x}_list", "set_#{x}", "#{x}=", "add_#{x}"
161
- return @metadata.send(name, *args)
162
- end
163
- }
164
- super
165
- end
166
-
167
162
  def author=(val)
168
163
  warn 'author= is deprecated. please use #creator'
169
164
  @metadata.creator= val
@@ -96,6 +96,10 @@ module GEPUB
96
96
  @dir_prefix = dir_prefix_org
97
97
  end
98
98
 
99
+ def add_resource_dir(name)
100
+ import "#{name}/resources.conf", :dir_prefix => name
101
+ end
102
+
99
103
  def cover_image(val)
100
104
  file(val)
101
105
  @last_defined_item.cover_image
data/lib/gepub/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module GEPUB
2
2
  # GEPUB gem version
3
- VERSION = "0.6.8"
3
+ VERSION = "0.6.8.3"
4
4
  end
data/lib/gepub.rb CHANGED
@@ -17,6 +17,7 @@ else
17
17
  end
18
18
  end
19
19
  end
20
+ require 'forwardable'
20
21
  require 'gepub/version'
21
22
  require 'gepub/xml_util'
22
23
  require 'gepub/meta'
@@ -8,8 +8,10 @@
8
8
  <dc:date>2010-05-05</dc:date>
9
9
  <dc:identifier id="BookId">http://example.jp/foobar/</dc:identifier>
10
10
  <dc:language>ja</dc:language>
11
+ <meta name="cover" content="cover-image" />
11
12
  </metadata>
12
13
  <manifest>
14
+ <item id="cover-image" href="img/cover.jpg" properties="cover-image" media-type="image/jpeg" />
13
15
  <item id="c1" href="text/foobar.xhtml" media-type="application/xhtml+xml"/>
14
16
  <item id="c2" href="text/barbar.xhtml" media-type="application/xhtml+xml"/>
15
17
  <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
@@ -62,7 +62,13 @@ describe GEPUB::Metadata do
62
62
  it 'should parse title' do
63
63
  @metadata.main_title.should == 'thetitle'
64
64
  @metadata.title_list.size.should == 1
65
- end
65
+ end
66
+ it 'should parse OPF2.0 meta node' do
67
+ @metadata.oldstyle_meta.size.should == 1
68
+ @metadata.oldstyle_meta[0].name == 'meta'
69
+ @metadata.oldstyle_meta[0]['name'] == 'cover'
70
+ @metadata.oldstyle_meta[0]['content'] == 'cover-image'
71
+ end
66
72
  end
67
73
 
68
74
  context 'Generate New OPF' do
data/spec/package_spec.rb CHANGED
@@ -16,6 +16,7 @@ describe GEPUB::Package do
16
16
  opf['unique-identifier'].should == 'pub-id'
17
17
  opf['xml:lang'].should == 'ja'
18
18
  end
19
+
19
20
  end
20
21
  context 'generate new opf' do
21
22
  it 'should generate opf' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gepub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.6.8.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-21 00:00:00.000000000 Z
12
+ date: 2012-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70190075871760 !ruby/object:Gem::Requirement
16
+ requirement: &70101613986380 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70190075871760
24
+ version_requirements: *70101613986380
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &70190075871260 !ruby/object:Gem::Requirement
27
+ requirement: &70101613984580 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.5.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70190075871260
35
+ version_requirements: *70101613984580
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rubyzip
38
- requirement: &70190075870800 !ruby/object:Gem::Requirement
38
+ requirement: &70101613994180 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 0.9.7
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70190075870800
46
+ version_requirements: *70101613994180
47
47
  description: gepub is a generic EPUB parser/generator. Generates and parse EPUB2 and
48
48
  EPUB3
49
49
  email:
@@ -54,6 +54,7 @@ executables:
54
54
  extensions: []
55
55
  extra_rdoc_files: []
56
56
  files:
57
+ - .gitattributes
57
58
  - .gitignore
58
59
  - .travis.yml
59
60
  - Gemfile