bookbinder 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5ff331a45d77240065dd23e0139986a4ff8e8831
4
+ data.tar.gz: 9065317c158365847af21a639dbd5d241a829757
5
+ SHA512:
6
+ metadata.gz: 9605359ded0cae08c84e15a4b8efa92570454737bde6b19672b6fc323be3d3651dde0ae6c15a6103d4d958c992a9db56e85b0d25591ec998cf3081d3aedf707b
7
+ data.tar.gz: fdb07c5974b785688b5047da17e06dc7b4f664ee94adfe583520ac06d7d454ac8f6fa2180e0cedd187d748f163268010fbd3b8c5a7cd97ba883c1c51a7d0320e
data/README.md CHANGED
@@ -1,40 +1,47 @@
1
1
  # Bookbinder
2
2
 
3
- Ebook format conversion.
3
+ With Bookbinder you can convert content to common ebook formats.
4
4
 
5
5
 
6
6
  ## Basic use
7
7
 
8
- Display the contents of an EPUB as a JSON "map":
8
+ Out of the box, Bookbinder supports only its native format: Openbook.
9
+ Openbook is a simple JSON-based format that acts as a superset of all
10
+ the information in other formats.
9
11
 
10
- $ bookbinder map path/to/file.epub
12
+ So, you should install some more formats, by adding other gems to your
13
+ `Gemfile`:
11
14
 
15
+ ```ruby
16
+ gem 'bookbinder'
17
+ gem 'bb-epub'
18
+ gem 'bb-pdf'
19
+ ```
12
20
 
13
- Convert an EPUB to an Openbook directory (the directory need not exist yet):
21
+ Now do this:
14
22
 
15
- $ bookbinder convert path/to/file.epub path/to/dir
23
+ $ bundle console
16
24
 
17
- Convert an EPUB to an Openbook archive:
25
+ >> puts Bookbinder::Operations.map('test.epub')
18
26
 
19
- $ bookbinder convert path/to/file.epub path/to/file.openbook
27
+ This displays the contents of the test EPUB as a JSON "map".
28
+ (Supply your own test EPUB file.)
20
29
 
21
- Convert an Openbook to an EPUB (...is not yet fully implemented!)
30
+ Convert an EPUB to an Openbook directory (the directory need not exist yet):
22
31
 
32
+ >> Bookbinder::Operations.convert('test.epub', 'test-output')
23
33
 
24
- ## Use as a Ruby library
34
+ Convert an EPUB to an Openbook archive:
25
35
 
26
- EPUB to Openbook:
36
+ >> Bookbinder::Operations.convert('test.epub', 'test.openbook')
27
37
 
28
- require 'bookbinder'
29
- epub = Bookbinder::Package::EPUB.read('book.epub')
30
- openbook = epub.export(Bookbinder::Package::Openbook)
31
- openbook.write('book.openbook')
38
+ Convert an Openbook to an EPUB (...is not yet fully implemented!)
32
39
 
33
- For other basic actions, take a look at `lib/bookbinder/operations.rb`. This
34
- class provides a basic layer of convenience, such as reducing the above to:
40
+ Convert a PDF to an Openbook archive:
35
41
 
36
- require 'bookbinder'
37
- Bookbinder::Operations.convert('book.epub', 'book.openbook')
42
+ >> Bookbinder::Operations.convert('test.pdf', 'test.openbook')
43
+
44
+ Convert an openbook to a PDF (..is not yet fully implemented!)
38
45
 
39
46
 
40
47
  ## Improving Bookbinder
@@ -48,37 +55,29 @@ currently maintained here:
48
55
 
49
56
  The key to Bookbinder is this: for every feature of an ebook format, we create
50
57
  a "transform" class that does two things:
58
+
51
59
  - parses the raw config from the package into standard Openbook properties
52
60
  on the map; and
53
61
  - generates raw config into the package from those same standard Openbook
54
62
  properties on the map
55
63
 
56
- Basically, for every feature, the transform class describes how to read it,
64
+ Basically, for every feature, the transform class describes how to read it,
57
65
  and how to write it.
58
66
 
59
67
  The nice thing about this set-up is that if multiple package formats
60
- support the same feature, their transform classes work on the same map. Say
61
- you are converting from EPUB3 to Openbook - the book's title is parsed out of
62
- the EPUB file into the map using the transform at
63
- `lib/bookbinder/transform/epub/title.rb`. Then the map is handed over to
64
- the Openbook package, and the transform at
65
- `lib/bookbinder/transform/openbook/title.rb` would write it out to the
66
- new package file.
68
+ support the same feature, their transform classes work on the same map.
69
+ Say you are converting from EPUB3 to Openbook - the book's title is
70
+ parsed out of the EPUB file into the map using the 'Title' transform
71
+ in the `bb-epub` gem. Then the map is handed over to the Openbook
72
+ package, and the transform in the Bookbinder package writes it out
73
+ to the new package file.
67
74
 
68
75
  You can of course convert a package to its own format: in this case the same
69
76
  transform class does both the reading and the writing out -- the effect of
70
77
  this is to "tidy" the package.
71
78
 
72
- To add a package format Bookbinder, you should create the package class in
73
- `lib/bookbinder/package`, then create directory of transforms in
74
- `lib/bookbinder/transform`. You can borrow transforms from other packages. For
75
- instance, it might make sense for a DAISY package to share some of the
76
- transforms in EPUB, or for a hPub package to borrow some transforms
77
- from Openbook.
78
-
79
- If you are adding a new feature to Bookbinder, you create the
80
- appropriate transform class for each package that supports the feature, and
81
- then add the equivalent tests.
79
+ To add a package format to Bookbinder, you can borrow the simple structure
80
+ of the `bb-epub` and `bb-pdf` gems.
82
81
 
83
82
 
84
83
  ## Planned format support
@@ -86,9 +85,9 @@ then add the equivalent tests.
86
85
  * Openbook
87
86
  * EPUB3
88
87
  * EPUB2
89
- * hPub
90
88
  * PDF
91
- * ...
89
+ * MP3 audiobooks
90
+ * hPub
92
91
 
93
92
 
94
93
  ## Attribution and licensing
@@ -14,6 +14,7 @@ class Bookbinder::Transform::Organizer < Bookbinder::Transform
14
14
  pisbn
15
15
  publisher
16
16
  subject
17
+ i18n-*
17
18
  rendition-*
18
19
  audio-*
19
20
  spine
@@ -1,5 +1,5 @@
1
1
  module Bookbinder
2
2
 
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
 
5
5
  end
metadata CHANGED
@@ -1,69 +1,78 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bookbinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
5
- prerelease:
4
+ version: 0.4.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Joseph Pearson
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-03-17 00:00:00.000000000 Z
11
+ date: 2015-06-15 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: nokogiri
16
- requirement: &20788320 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *20788320
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: rubyzip
27
- requirement: &20794420 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - =
31
+ - - '='
31
32
  - !ruby/object:Gem::Version
32
33
  version: 1.0.0
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *20794420
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: mime-types
38
- requirement: &20809240 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - '>='
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :runtime
45
49
  prerelease: false
46
- version_requirements: *20809240
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: rake
49
- requirement: &20804560 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  type: :development
56
63
  prerelease: false
57
- version_requirements: *20804560
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
58
69
  description: Convert easily between common ebook formats.
59
70
  email:
60
71
  - jpearson@overdrive.com
61
- executables:
62
- - bookbinder
72
+ executables: []
63
73
  extensions: []
64
74
  extra_rdoc_files: []
65
75
  files:
66
- - bin/bookbinder
67
76
  - lib/bookbinder/document_proxy.rb
68
77
  - lib/bookbinder/file.rb
69
78
  - lib/bookbinder/file_system/directory.rb
@@ -85,26 +94,25 @@ files:
85
94
  - README.md
86
95
  homepage: http://github.com/bksh/bookbinder
87
96
  licenses: []
97
+ metadata: {}
88
98
  post_install_message:
89
99
  rdoc_options: []
90
100
  require_paths:
91
101
  - lib
92
102
  required_ruby_version: !ruby/object:Gem::Requirement
93
- none: false
94
103
  requirements:
95
- - - ! '>='
104
+ - - '>='
96
105
  - !ruby/object:Gem::Version
97
106
  version: '0'
98
107
  required_rubygems_version: !ruby/object:Gem::Requirement
99
- none: false
100
108
  requirements:
101
- - - ! '>='
109
+ - - '>='
102
110
  - !ruby/object:Gem::Version
103
111
  version: '0'
104
112
  requirements: []
105
113
  rubyforge_project:
106
- rubygems_version: 1.8.11
114
+ rubygems_version: 2.0.14
107
115
  signing_key:
108
- specification_version: 3
116
+ specification_version: 4
109
117
  summary: Ebook format conversion.
110
118
  test_files: []
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bookbinder'
4
-
5
- if ARGV[0] == 'map'
6
- puts Bookbinder::Operations.map(ARGV[1])
7
- elsif ARGV[0] == 'validate'
8
- puts('Validate: not yet implemented.')
9
- elsif ARGV[0] == 'normalize'
10
- puts('Normalize: still too dangerous.')
11
- elsif ARGV[0] == 'convert'
12
- src_path = ARGV[1]
13
- dest_path = ARGV[2]
14
- src_pkg, dest_pkg = Bookbinder::Operations.convert(src_path, dest_path)
15
- puts("Converted #{src_pkg.class} at #{src_path}")
16
- puts("------ to #{dest_pkg.class} at #{dest_path}")
17
- end