gepub 1.0.0rc1 → 1.0.0

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: 6ea54f631081444844a163f58cb499a6dd92e32a310f80fa957a2fd8344126e0
4
- data.tar.gz: 677cf3da9d50aea36764d24f55e3ba3d30ff4caef08b7f722807b181d839dbcd
3
+ metadata.gz: 877e717beb44a21df9afc0a5427d5576a162e27dfad1cb562cb5b36bd2adcdc9
4
+ data.tar.gz: 2ea4a07ae25bf2a85af439a1b49b429ce70961e958a8deba1882f2f46075ec55
5
5
  SHA512:
6
- metadata.gz: 2c9858b1ce776c22fabe0dec16f44bd5c5c228cec894c876439c4a66abd617ef718731f5ff960820c634f8e48d8185cf2fa26b309a8f7d637fe18be3190992ac
7
- data.tar.gz: ee051d198cfe11f1a824b3a8aefb03cf7046fae837429d6820fe633eb178aa54a43172532840c3c87a14ede39b2e0315191976c12bed3d358d4ca25422c82fb0
6
+ metadata.gz: 7e58686f88c0d9e80dd4db6c3749a571ba53b2b4d92579fde57af40802438d64e344629d59d2d6667da83eca35bf2202616ac4097e2c5caca7bc833ad188874e
7
+ data.tar.gz: 59065a6eea1f705bda13722f677928730e7b23565dbd778a1c9174e3f0919880f9a504c90f0ba86c3d75bdeb914207473f13f6ad64596420d382090d5517f4c1
data/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/skoji/gepub?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
4
  [<img src="https://secure.travis-ci.org/skoji/gepub.png" />](http://travis-ci.org/skoji/gepub)
5
5
  [![Coverage Status](https://coveralls.io/repos/skoji/gepub/badge.png?branch=master)](https://coveralls.io/r/skoji/gepub?branch=master)
6
- [![Dependency Status](https://gemnasium.com/skoji/gepub.png)](https://gemnasium.com/skoji/gepub)
7
6
  [![Gem Version](https://badge.fury.io/rb/gepub.png)](http://badge.fury.io/rb/gepub)
8
7
 
9
8
  * http://rdoc.info/github/skoji/gepub/master/frames
@@ -16,57 +15,97 @@ a generic EPUB parser/generator library.
16
15
 
17
16
  * GEPUB::Book provides functionality to create EPUB file, and parsing EPUB files
18
17
  * Handle every metadata in EPUB2/EPUB3.
19
- * GEPUB::Builder provides an easy and powerful way to create EPUB3 files
20
18
 
21
19
  * See [issues](https://github.com/skoji/gepub/issues/) for known problems.
22
20
 
23
- If you are using GEPUB::Builder from your code and do not like its behaviour(e.g. the block inside is evaluated as inside the Builder instance), please consider using GEPUB::Book directly.
24
-
25
- **GEPUB::Builder will be obsolete in gepub 0.7. GEPUB::Book#new will be enhanced instead of Builder DSL.**
26
-
21
+ If you are using GEPUB::Builder and do not like its behaviour(e.g. the block inside is evaluated as inside the Builder instance), please consider using GEPUB::Book directly.
27
22
 
28
23
  ## SYNOPSIS:
29
24
 
30
25
  ### Builder Example
31
26
 
32
27
  ```ruby
33
- require 'rubygem'
28
+ require 'rubygems'
34
29
  require 'gepub'
35
- builder = GEPUB::Builder.new {
36
- language 'en'
37
- unique_identifier 'http:/example.jp/bookid_in_url', 'BookID', 'URL'
38
- title 'GEPUB Sample Book'
39
- subtitle 'This book is just a sample'
40
-
41
- creator 'KOJIMA Satoshi'
42
-
43
- contributors 'Denshobu', 'Asagaya Densho', 'Shonan Densho Teidan', 'eMagazine Torutaru'
44
-
45
- date '2012-02-29T00:00:00Z'
46
30
 
47
- resources(:workdir => '~/epub/sample_book_source/') {
48
- cover_image 'img/image1.jpg' => 'image1.jpg'
49
- ordered {
50
- file 'text/chap1.xhtml'
51
- heading 'Chapter 1'
52
-
53
- file 'text/chap1-1.xhtml'
54
-
55
- file 'text/chap2.html'
56
- heading 'Chapter 2'
57
- }
58
- }
31
+ book = GEPUB::Book.new
32
+ book.primary_identifier('http://example.jp/bookid_in_url', 'BookID', 'URL')
33
+ book.language = 'ja'
34
+
35
+ book.add_title 'GEPUBサンプル文書',
36
+ title_type: GEPUB::TITLE_TYPE::MAIN,
37
+ lang: 'ja',
38
+ file_as: 'GEPUB Sample Book',
39
+ display_seq: 1,
40
+ alternates: {
41
+ 'en' => 'GEPUB Sample Book (Japanese)',
42
+ 'el' => 'GEPUB δείγμα (Ιαπωνικά)',
43
+ 'th' => 'GEPUB ตัวอย่าง (ญี่ปุ่น)' }
44
+
45
+ # you can do the same thing using method chain
46
+ book.add_title('これはあくまでサンプルです', title_type: GEPUB::TITLE_TYPE::SUBTITLE).display_seq(1).add_alternates('en' => 'this book is just a sample.')
47
+
48
+ # use arguments
49
+ book.add_creator '小嶋智',
50
+ display_seq:1,
51
+ alternates: { 'en' => 'KOJIMA Satoshi' }
52
+ book.add_contributor '電書部',
53
+ display_seq: 1,
54
+ alternates: {'en' => 'Denshobu'}
55
+ book.add_contributor 'アサガヤデンショ',
56
+ display_seq: 2,
57
+ alternates: {'en' => 'Asagaya Densho'}
58
+ # you can also use method chain
59
+ book.add_contributor('湘南電書鼎談').display_seq(3).add_alternates('en' => 'Shonan Densho Teidan')
60
+ book.add_contributor('電子雑誌トルタル').display_seq(4).add_alternates('en' => 'eMagazine Torutaru')
61
+
62
+ imgfile = File.join(File.dirname(__FILE__), 'image1.jpg')
63
+ File.open(imgfile) do
64
+ |io|
65
+ book.add_item('img/image1.jpg',content: io).cover_image
66
+ end
67
+
68
+ # within ordered block, add_item will be added to spine.
69
+ book.ordered {
70
+ book.add_item('text/cover.xhtml',
71
+ content: StringIO.new(<<-COVER)).landmark(type: 'cover', title: 'cover page')
72
+ <html xmlns="http://www.w3.org/1999/xhtml">
73
+ <head>
74
+ <title>cover page</title>
75
+ </head>
76
+ <body>
77
+ <h1>The Book</h1>
78
+ <img src="../img/image1.jpg" />
79
+ </body></html>
80
+ COVER
81
+ book.add_item('text/chap1.xhtml').add_content(StringIO.new(<<-CHAP_ONE)).toc_text('Chapter 1').landmark(type: 'bodymatter', title: '本文')
82
+ <html xmlns="http://www.w3.org/1999/xhtml">
83
+ <head><title>c1</title></head>
84
+ <body><p>the first page</p></body></html>
85
+ CHAP_ONE
86
+ book.add_item('text/chap1-1.xhtml').add_content(StringIO.new(<<-SEC_ONE_ONE)) # do not appear on table of contents
87
+ <html xmlns="http://www.w3.org/1999/xhtml">
88
+ <head><title>c2</title></head>
89
+ <body><p>the second page</p></body></html>
90
+ SEC_ONE_ONE
91
+ book.add_item('text/chap2.xhtml').add_content(StringIO.new(<<-CHAP_TWO)).toc_text('Chapter 2')
92
+ <html xmlns="http://www.w3.org/1999/xhtml">
93
+ <head><title>c3</title></head>
94
+ <body><p>the third page</p></body></html>
95
+ CHAP_TWO
96
+ # to add nav file:
97
+ # book.add_item('path/to/nav').add_content(nav_html_content).add_property('nav')
59
98
  }
60
- epubname = File.join(File.dirname(__FILE__), 'example_test_with_builder.epub')
61
- builder.generate_epub(epubname)
99
+ epubname = File.join(File.dirname(__FILE__), 'example_test.epub')
100
+
101
+ # if you do not specify your own nav document with add_item,
102
+ # simple navigation text will be generated in generate_epub.
103
+ # auto-generated nav file will not appear on spine.
104
+ book.generate_epub(epubname)
62
105
  ```
63
- [more builder examples](https://gist.github.com/1878995)
64
- [examples in this repository](https://github.com/skoji/gepub/tree/master/examples/)
106
+ * [examples in this repository](https://github.com/skoji/gepub/tree/master/examples/)
65
107
 
66
108
  ## INSTALL:
67
109
 
68
110
  * gem install gepub
69
111
 
70
-
71
-
72
- [![endorse](http://api.coderwall.com/skoji/endorse.png)](http://coderwall.com/skoji)
@@ -1,4 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # We will continue to support GEPUB::Builder works fine on version 1.x, but Builder will not be updated any more. For example, landmarks are not supported with Builder.
3
+
2
4
  require 'rubygems'
3
5
  require 'gepub'
4
6
  workdir = 'epub/example/'
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  require 'rubygems'
3
2
  require 'gepub'
4
3
 
@@ -6,40 +5,67 @@ book = GEPUB::Book.new
6
5
  book.primary_identifier('http://example.jp/bookid_in_url', 'BookID', 'URL')
7
6
  book.language = 'ja'
8
7
 
9
- # you can add metadata and its property using block
10
- book.add_title('GEPUBサンプル文書', title_type: GEPUB::TITLE_TYPE::MAIN) {
11
- |title|
12
- title.lang = 'ja'
13
- title.file_as = 'GEPUB Sample Book'
14
- title.display_seq = 1
15
- title.add_alternates(
8
+ book.add_title 'GEPUBサンプル文書',
9
+ title_type: GEPUB::TITLE_TYPE::MAIN,
10
+ lang: 'ja',
11
+ file_as: 'GEPUB Sample Book',
12
+ display_seq: 1,
13
+ alternates: {
16
14
  'en' => 'GEPUB Sample Book (Japanese)',
17
15
  'el' => 'GEPUB δείγμα (Ιαπωνικά)',
18
- 'th' => 'GEPUB ตัวอย่าง (ญี่ปุ่น)')
19
- }
16
+ 'th' => 'GEPUB ตัวอย่าง (ญี่ปุ่น)' }
17
+
20
18
  # you can do the same thing using method chain
21
19
  book.add_title('これはあくまでサンプルです', title_type: GEPUB::TITLE_TYPE::SUBTITLE).display_seq(1).add_alternates('en' => 'this book is just a sample.')
22
- book.add_creator('小嶋智') {
23
- |creator|
24
- creator.display_seq = 1
25
- creator.add_alternates('en' => 'KOJIMA Satoshi')
26
- }
27
- book.add_contributor('電書部').display_seq(1).add_alternates('en' => 'Denshobu')
28
- book.add_contributor('アサガヤデンショ').display_seq(2).add_alternates('en' => 'Asagaya Densho')
20
+
21
+ # use arguments
22
+ book.add_creator '小嶋智',
23
+ display_seq:1,
24
+ alternates: { 'en' => 'KOJIMA Satoshi' }
25
+ book.add_contributor '電書部',
26
+ display_seq: 1,
27
+ alternates: {'en' => 'Denshobu'}
28
+ book.add_contributor 'アサガヤデンショ',
29
+ display_seq: 2,
30
+ alternates: {'en' => 'Asagaya Densho'}
31
+ # you can also use method chain
29
32
  book.add_contributor('湘南電書鼎談').display_seq(3).add_alternates('en' => 'Shonan Densho Teidan')
30
33
  book.add_contributor('電子雑誌トルタル').display_seq(4).add_alternates('en' => 'eMagazine Torutaru')
31
34
 
32
35
  imgfile = File.join(File.dirname(__FILE__), 'image1.jpg')
33
36
  File.open(imgfile) do
34
37
  |io|
35
- book.add_item('img/image1.jpg',io).cover_image
38
+ book.add_item('img/image1.jpg',content: io).cover_image
36
39
  end
37
40
 
38
41
  # within ordered block, add_item will be added to spine.
39
42
  book.ordered {
40
- book.add_item('text/chap1.xhtml').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>')).toc_text('Chapter 1')
41
- book.add_item('text/chap1-1.xhtml').add_content(StringIO.new('<html xmlns="http://www.w3.org/1999/xhtml"><head><title>c2</title></head><body><p>the second page</p></body></html>')) # do not appear on table of contents
42
- book.add_item('text/chap2.xhtml').add_content(StringIO.new('<html xmlns="http://www.w3.org/1999/xhtml"><head><title>c3</title></head><body><p>the third page</p></body></html>')).toc_text('Chapter 2')
43
+ book.add_item('text/cover.xhtml',
44
+ content: StringIO.new(<<-COVER)).landmark(type: 'cover', title: 'cover page')
45
+ <html xmlns="http://www.w3.org/1999/xhtml">
46
+ <head>
47
+ <title>cover page</title>
48
+ </head>
49
+ <body>
50
+ <h1>The Book</h1>
51
+ <img src="../img/image1.jpg" />
52
+ </body></html>
53
+ COVER
54
+ book.add_item('text/chap1.xhtml').add_content(StringIO.new(<<-CHAP_ONE)).toc_text('Chapter 1').landmark(type: 'bodymatter', title: '本文')
55
+ <html xmlns="http://www.w3.org/1999/xhtml">
56
+ <head><title>c1</title></head>
57
+ <body><p>the first page</p></body></html>
58
+ CHAP_ONE
59
+ book.add_item('text/chap1-1.xhtml').add_content(StringIO.new(<<-SEC_ONE_ONE)) # do not appear on table of contents
60
+ <html xmlns="http://www.w3.org/1999/xhtml">
61
+ <head><title>c2</title></head>
62
+ <body><p>the second page</p></body></html>
63
+ SEC_ONE_ONE
64
+ book.add_item('text/chap2.xhtml').add_content(StringIO.new(<<-CHAP_TWO)).toc_text('Chapter 2')
65
+ <html xmlns="http://www.w3.org/1999/xhtml">
66
+ <head><title>c3</title></head>
67
+ <body><p>the third page</p></body></html>
68
+ CHAP_TWO
43
69
  # to add nav file:
44
70
  # book.add_item('path/to/nav').add_content(nav_html_content).add_property('nav')
45
71
  }
@@ -0,0 +1,51 @@
1
+ require 'rubygems'
2
+ require 'gepub'
3
+
4
+ book = GEPUB::Book.new
5
+ book.primary_identifier('http://example.jp/bookid_in_url', 'BookID', 'URL')
6
+ book.language = 'ja'
7
+
8
+ # you can add metadata and its property using block
9
+ book.add_title('GEPUBサンプル文書', title_type: GEPUB::TITLE_TYPE::MAIN) {
10
+ |title|
11
+ title.lang = 'ja'
12
+ title.file_as = 'GEPUB Sample Book'
13
+ title.display_seq = 1
14
+ title.add_alternates(
15
+ 'en' => 'GEPUB Sample Book (Japanese)',
16
+ 'el' => 'GEPUB δείγμα (Ιαπωνικά)',
17
+ 'th' => 'GEPUB ตัวอย่าง (ญี่ปุ่น)')
18
+ }
19
+ # you can do the same thing using method chain
20
+ book.add_title('これはあくまでサンプルです', title_type: GEPUB::TITLE_TYPE::SUBTITLE).display_seq(1).add_alternates('en' => 'this book is just a sample.')
21
+ book.add_creator('小嶋智') {
22
+ |creator|
23
+ creator.display_seq = 1
24
+ creator.add_alternates('en' => 'KOJIMA Satoshi')
25
+ }
26
+ book.add_contributor('電書部').display_seq(1).add_alternates('en' => 'Denshobu')
27
+ book.add_contributor('アサガヤデンショ').display_seq(2).add_alternates('en' => 'Asagaya Densho')
28
+ book.add_contributor('湘南電書鼎談').display_seq(3).add_alternates('en' => 'Shonan Densho Teidan')
29
+ book.add_contributor('電子雑誌トルタル').display_seq(4).add_alternates('en' => 'eMagazine Torutaru')
30
+
31
+ imgfile = File.join(File.dirname(__FILE__), 'image1.jpg')
32
+ File.open(imgfile) do
33
+ |io|
34
+ book.add_item('img/image1.jpg',io).cover_image
35
+ end
36
+
37
+ # within ordered block, add_item will be added to spine.
38
+ book.ordered {
39
+ book.add_item('text/chap1.xhtml').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>')).toc_text('Chapter 1')
40
+ book.add_item('text/chap1-1.xhtml').add_content(StringIO.new('<html xmlns="http://www.w3.org/1999/xhtml"><head><title>c2</title></head><body><p>the second page</p></body></html>')) # do not appear on table of contents
41
+ book.add_item('text/chap2.xhtml').add_content(StringIO.new('<html xmlns="http://www.w3.org/1999/xhtml"><head><title>c3</title></head><body><p>the third page</p></body></html>')).toc_text('Chapter 2')
42
+ # to add nav file:
43
+ # book.add_item('path/to/nav').add_content(nav_html_content).add_property('nav')
44
+ }
45
+ epubname = File.join(File.dirname(__FILE__), 'example_test.epub')
46
+
47
+ # if you do not specify your own nav document with add_item,
48
+ # simple navigation text will be generated in generate_epub.
49
+ # auto-generated nav file will not appear on spine.
50
+ book.generate_epub(epubname)
51
+
@@ -1,4 +1,4 @@
1
1
  module GEPUB
2
2
  # GEPUB gem version
3
- VERSION = "1.0.0rc1"
3
+ VERSION = "1.0.0"
4
4
  end
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.0rc1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - KOJIMA Satoshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-06 00:00:00.000000000 Z
11
+ date: 2018-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -91,8 +91,9 @@ files:
91
91
  - Rakefile
92
92
  - bin/genepub
93
93
  - bin/gepuber
94
- - examples/builder_example.rb
94
+ - examples/deprecated_builder_example.rb
95
95
  - examples/generate_example.rb
96
+ - examples/generate_example_legacy_apis.rb
96
97
  - examples/image1.jpg
97
98
  - examples/new_book_example.rb
98
99
  - gepub.gemspec
@@ -180,9 +181,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
181
  version: '0'
181
182
  required_rubygems_version: !ruby/object:Gem::Requirement
182
183
  requirements:
183
- - - ">"
184
+ - - ">="
184
185
  - !ruby/object:Gem::Version
185
- version: 1.3.1
186
+ version: '0'
186
187
  requirements: []
187
188
  rubyforge_project: gepub
188
189
  rubygems_version: 2.7.6