gepub 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -20,3 +20,6 @@ pkg
20
20
 
21
21
  ## PROJECT::SPECIFIC
22
22
  *.epub
23
+
24
+ ## BUNDLER
25
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source :rubygems
2
+
3
+ gem 'bundler', '>= 1.0.7', :require => 'bundle', :group => [:test, :development]
4
+ gem 'rspec', '< 2', '>= 1.2.9', :require => 'spec', :group => :test
5
+ gem 'epubcheck', '>= 0.1.0', :group => :test
6
+ gem 'jeweler', '>= 1.5.1', :group => :development
7
+ gem 'libxml-ruby', '>= 1.1.4'
8
+ gem 'rubyzip', '>= 0.9.4'
data/README.rdoc CHANGED
@@ -14,7 +14,6 @@ a good-enough EPUB generator library.
14
14
  * opf: can't specify date with event
15
15
  * opf: unique-identifier's scheme is fixed to 'URL'
16
16
  * ncx: can't nest navPoint elements
17
- * opf: oops!! it specifies lang='ja'. it's hardcoded. (*sigh*)
18
17
  * ...and many other restrictions
19
18
 
20
19
  * note: GEPUB::Generator is now obsolete. use GEPUB::Book.
@@ -34,6 +33,7 @@ a good-enough EPUB generator library.
34
33
  epub.publisher="the publisher"
35
34
  epub.date = "2010-11-27"
36
35
  epub.identifier = "http://www.skoji.jp/testepub/2010-06-26"
36
+ epub.locale = 'ja' #defaults to 'en'
37
37
 
38
38
  # create test contents files
39
39
  contents = {}
data/Rakefile CHANGED
@@ -10,10 +10,12 @@ begin
10
10
  gem.email = "skoji@skoji.jp"
11
11
  gem.homepage = "http://github.com/skoji/gepub"
12
12
  gem.authors = ["KOJIMA Satoshi"]
13
- gem.add_development_dependency "rspec", ">= 1.2.9"
13
+ gem.add_development_dependency "rspec", ">= 1.2.9", "< 2"
14
14
  gem.add_development_dependency "epubcheck", ">= 0.1.0"
15
- gem.add_dependency('libxml-ruby', ">= 1.1.4")
16
- gem.add_dependency('rubyzip', ">= 0.9.4")
15
+ gem.add_development_dependency "bundler", ">= 1.0.7"
16
+ gem.add_development_dependency "jeweler", ">= 1.5.1"
17
+ gem.add_dependency('libxml-ruby', ">= 1.1.4")
18
+ gem.add_dependency('rubyzip', ">= 0.9.4")
17
19
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
20
  end
19
21
  Jeweler::GemcutterTasks.new
@@ -33,8 +35,6 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
33
35
  spec.rcov = true
34
36
  end
35
37
 
36
- task :spec => :check_dependencies
37
-
38
38
  task :default => :spec
39
39
 
40
40
  require 'rake/rdoctask'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.2.0
data/gepub.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gepub}
8
- s.version = "0.1.3"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["KOJIMA Satoshi"]
12
- s.date = %q{2010-11-27}
12
+ s.date = %q{2011-01-01}
13
13
  s.description = %q{an easy-to-use (and easy-to-implement) EPUB generator.}
14
14
  s.email = %q{skoji@skoji.jp}
15
15
  s.extra_rdoc_files = [
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.files = [
19
19
  ".document",
20
20
  ".gitignore",
21
+ "Gemfile",
21
22
  "README.rdoc",
22
23
  "Rakefile",
23
24
  "VERSION",
@@ -47,19 +48,25 @@ Gem::Specification.new do |s|
47
48
  s.specification_version = 3
48
49
 
49
50
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
51
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9", "< 2"])
51
52
  s.add_development_dependency(%q<epubcheck>, [">= 0.1.0"])
53
+ s.add_development_dependency(%q<bundler>, [">= 1.0.7"])
54
+ s.add_development_dependency(%q<jeweler>, [">= 1.5.1"])
52
55
  s.add_runtime_dependency(%q<libxml-ruby>, [">= 1.1.4"])
53
56
  s.add_runtime_dependency(%q<rubyzip>, [">= 0.9.4"])
54
57
  else
55
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
58
+ s.add_dependency(%q<rspec>, [">= 1.2.9", "< 2"])
56
59
  s.add_dependency(%q<epubcheck>, [">= 0.1.0"])
60
+ s.add_dependency(%q<bundler>, [">= 1.0.7"])
61
+ s.add_dependency(%q<jeweler>, [">= 1.5.1"])
57
62
  s.add_dependency(%q<libxml-ruby>, [">= 1.1.4"])
58
63
  s.add_dependency(%q<rubyzip>, [">= 0.9.4"])
59
64
  end
60
65
  else
61
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
66
+ s.add_dependency(%q<rspec>, [">= 1.2.9", "< 2"])
62
67
  s.add_dependency(%q<epubcheck>, [">= 0.1.0"])
68
+ s.add_dependency(%q<bundler>, [">= 1.0.7"])
69
+ s.add_dependency(%q<jeweler>, [">= 1.5.1"])
63
70
  s.add_dependency(%q<libxml-ruby>, [">= 1.1.4"])
64
71
  s.add_dependency(%q<rubyzip>, [">= 0.9.4"])
65
72
  end
data/lib/gepub/book.rb CHANGED
@@ -20,6 +20,7 @@ module GEPUB
20
20
  @contents_prefix = contents_prefix # may insert "OEBPS"
21
21
  @contents_prefix = @contents_prefix + "/" if contents_prefix != ""
22
22
  @itemcount = 0
23
+ @locale = 'en'
23
24
  end
24
25
 
25
26
  def title
@@ -71,6 +72,14 @@ module GEPUB
71
72
  @main_identifier = id
72
73
  end
73
74
 
75
+ def locale
76
+ @locale
77
+ end
78
+
79
+ def locale=(locale)
80
+ @locale = locale
81
+ end
82
+
74
83
  def setIdentifier(scheme, identfier)
75
84
  @metadata[:identifier] << { :scheme => scheme, :identifier => identifier }
76
85
  end
@@ -159,7 +168,7 @@ EOF
159
168
  XML::Namespace.new(metadataelem, 'opf', 'http://www.idpf.org/2007/opf')
160
169
  XML::Namespace.new(metadataelem, 'dc', "http://purl.org/dc/elements/1.1/")
161
170
 
162
- metadataelem << XML::Node.new('dc:language', 'ja')
171
+ metadataelem << XML::Node.new('dc:language', @locale)
163
172
 
164
173
  @metadata.each { | k, v |
165
174
  if (k == :cover)
@@ -19,6 +19,7 @@ module GEPUB
19
19
  @metadata[:title] = title
20
20
  @manifest['ncx'] = { :href => 'toc.ncx', :mediatype => 'application/x-dtbncx+xml' }
21
21
  @contents_prefix = "" # may insert "OEBPS/"
22
+ @locale = 'en'
22
23
  end
23
24
 
24
25
  def contents_prefix=(prefix)
@@ -72,6 +73,14 @@ module GEPUB
72
73
  def identifier=(id)
73
74
  @metadata[:identifier] = id
74
75
  end
76
+
77
+ def locale
78
+ @locale
79
+ end
80
+
81
+ def locale=(locale)
82
+ @locale = locale
83
+ end
75
84
 
76
85
  def addManifest(id, href, mediatype)
77
86
  @manifest[id] = { :href => href, :mediatype => mediatype }
@@ -165,7 +174,7 @@ EOF
165
174
  XML::Namespace.new(metadataelem, 'opf', 'http://www.idpf.org/2007/opf')
166
175
  XML::Namespace.new(metadataelem, 'dc', "http://purl.org/dc/elements/1.1/")
167
176
 
168
- metadataelem << XML::Node.new('dc:language', 'ja')
177
+ metadataelem << XML::Node.new('dc:language', @locale)
169
178
 
170
179
  @metadata.each { | k, v |
171
180
  if (k == :cover)
data/spec/gepub_spec.rb CHANGED
@@ -38,6 +38,7 @@ describe GEPUB::Book do
38
38
  @generator.publisher = "thepublisher"
39
39
  @generator.date = "2010-05-05"
40
40
  @generator.identifier = "http://example.jp/foobar/"
41
+ @generator.locale = 'ja'
41
42
  item1 = @generator.add_ref_to_item('text/foobar.html','c1')
42
43
  item1.add_content(StringIO.new('<html xmlns="http://www.w3.org/1999/xhtml"><head><title>c1</title></head><body><p>the first page</p></body></html>'))
43
44
  @generator.spine.push(item1)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gepub
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 3
10
- version: 0.1.3
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - KOJIMA Satoshi
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-27 00:00:00 +09:00
18
+ date: 2011-01-01 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -32,6 +32,12 @@ dependencies:
32
32
  - 2
33
33
  - 9
34
34
  version: 1.2.9
35
+ - - <
36
+ - !ruby/object:Gem::Version
37
+ hash: 7
38
+ segments:
39
+ - 2
40
+ version: "2"
35
41
  type: :development
36
42
  version_requirements: *id001
37
43
  - !ruby/object:Gem::Dependency
@@ -51,9 +57,41 @@ dependencies:
51
57
  type: :development
52
58
  version_requirements: *id002
53
59
  - !ruby/object:Gem::Dependency
54
- name: libxml-ruby
60
+ name: bundler
55
61
  prerelease: false
56
62
  requirement: &id003 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ hash: 25
68
+ segments:
69
+ - 1
70
+ - 0
71
+ - 7
72
+ version: 1.0.7
73
+ type: :development
74
+ version_requirements: *id003
75
+ - !ruby/object:Gem::Dependency
76
+ name: jeweler
77
+ prerelease: false
78
+ requirement: &id004 !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 1
84
+ segments:
85
+ - 1
86
+ - 5
87
+ - 1
88
+ version: 1.5.1
89
+ type: :development
90
+ version_requirements: *id004
91
+ - !ruby/object:Gem::Dependency
92
+ name: libxml-ruby
93
+ prerelease: false
94
+ requirement: &id005 !ruby/object:Gem::Requirement
57
95
  none: false
58
96
  requirements:
59
97
  - - ">="
@@ -65,11 +103,11 @@ dependencies:
65
103
  - 4
66
104
  version: 1.1.4
67
105
  type: :runtime
68
- version_requirements: *id003
106
+ version_requirements: *id005
69
107
  - !ruby/object:Gem::Dependency
70
108
  name: rubyzip
71
109
  prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
110
+ requirement: &id006 !ruby/object:Gem::Requirement
73
111
  none: false
74
112
  requirements:
75
113
  - - ">="
@@ -81,7 +119,7 @@ dependencies:
81
119
  - 4
82
120
  version: 0.9.4
83
121
  type: :runtime
84
- version_requirements: *id004
122
+ version_requirements: *id006
85
123
  description: an easy-to-use (and easy-to-implement) EPUB generator.
86
124
  email: skoji@skoji.jp
87
125
  executables: []
@@ -93,6 +131,7 @@ extra_rdoc_files:
93
131
  files:
94
132
  - .document
95
133
  - .gitignore
134
+ - Gemfile
96
135
  - README.rdoc
97
136
  - Rakefile
98
137
  - VERSION