ebps 1.0.2

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.
Files changed (57) hide show
  1. data/History.txt +3 -0
  2. data/InstalledFiles +36 -0
  3. data/LICENSE.txt +339 -0
  4. data/Manifest.txt +56 -0
  5. data/README.txt +28 -0
  6. data/Rakefile +28 -0
  7. data/SetupConfig +30 -0
  8. data/bin/ebps +86 -0
  9. data/example/config.yml +12 -0
  10. data/example/converter_for_firefox.rb +59 -0
  11. data/example/data.yml +60 -0
  12. data/example/example.sh +3 -0
  13. data/example/sample.epub +0 -0
  14. data/lib/ebps.rb +5 -0
  15. data/lib/ebps/config.rb +61 -0
  16. data/lib/ebps/conversion/de_fachinfo_yaml.rb +81 -0
  17. data/lib/ebps/conversion/epub.rb +38 -0
  18. data/lib/ebps/conversion/fachinfo_xml.rb +170 -0
  19. data/lib/ebps/conversion/fachinfo_yaml.rb +113 -0
  20. data/lib/ebps/conversion/import_module_sample.rb +86 -0
  21. data/lib/ebps/conversion/mobi_pocket.rb +30 -0
  22. data/lib/ebps/conversion/oebps.rb +537 -0
  23. data/lib/ebps/conversion/patinfo_yaml.rb +107 -0
  24. data/lib/ebps/data/default_cover.jpg +0 -0
  25. data/lib/ebps/data/stylesheet.css +16 -0
  26. data/lib/ebps/postprocess/bookworm.rb +16 -0
  27. data/lib/ebps/postprocess/copy.rb +28 -0
  28. data/lib/ebps/postprocess/system_call.rb +18 -0
  29. data/lib/ebps/preprocess/copy.rb +28 -0
  30. data/lib/ebps/preprocess/system_call.rb +18 -0
  31. data/lib/ebps/text/chapter.rb +36 -0
  32. data/lib/ebps/text/document.rb +36 -0
  33. data/lib/ebps/text/format.rb +34 -0
  34. data/lib/ebps/text/paragraph.rb +63 -0
  35. data/lib/ebps/text/picture.rb +41 -0
  36. data/lib/ebps/text/table.rb +65 -0
  37. data/lib/ebps/util/mail.rb +47 -0
  38. data/lib/ebps/util/smtp_tls.rb +62 -0
  39. data/spec/conversion/data/DF_15164_1_3.gif +0 -0
  40. data/spec/conversion/data/DF_15164_2_3.gif +0 -0
  41. data/spec/conversion/data/appendix.png +0 -0
  42. data/spec/conversion/data/fachinfo.xml +1151 -0
  43. data/spec/conversion/data/fachinfo.yaml +1214 -0
  44. data/spec/conversion/data/fachinfo_with_image.xml +334 -0
  45. data/spec/conversion/data/fachinfo_with_table.xml +1101 -0
  46. data/spec/conversion/data/fachinfos.de.oddb.yaml +5789 -0
  47. data/spec/conversion/data/images/5c/5c54d52c8132230e8c40c37a428fe761.png +0 -0
  48. data/spec/conversion/de_fachinfo_yaml_spec.rb +86 -0
  49. data/spec/conversion/epub_spec.rb +59 -0
  50. data/spec/conversion/fachinfo_xml_spec.rb +245 -0
  51. data/spec/conversion/fachinfo_yaml_spec.rb +52 -0
  52. data/spec/conversion/mobi_pocket_spec.rb +55 -0
  53. data/spec/conversion/oebps_spec.rb +555 -0
  54. data/spec/text/chapter_spec.rb +65 -0
  55. data/spec/text/document_spec.rb +78 -0
  56. data/spec/text/paragraph_spec.rb +77 -0
  57. metadata +145 -0
@@ -0,0 +1,65 @@
1
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
2
+
3
+ require 'ebps/text/chapter'
4
+
5
+ module EBPS
6
+ module Text
7
+ describe Chapter, "#paragraphs" do
8
+ it "initially returns an empty array" do
9
+ chp = Chapter.new
10
+ chp.paragraphs.should == []
11
+ end
12
+ end
13
+ describe Chapter, "#add_paragraph" do
14
+ before :each do
15
+ @chp = Chapter.new
16
+ end
17
+ it "checks for type" do
18
+ @chp.paragraphs.should == []
19
+ lambda do
20
+ @chp.add_paragraph("not a paragraph")
21
+ end.should raise_error TypeError
22
+ @chp.paragraphs.should == []
23
+ end
24
+ it "adds the paragraph" do
25
+ @chp.paragraphs.should == []
26
+ par = Paragraph.new 'nonempty'
27
+ @chp.add_paragraph(par).should == par
28
+ @chp.paragraphs.should == [par]
29
+ end
30
+ it "adds pictures" do
31
+ @chp.paragraphs.should == []
32
+ par = Picture.new
33
+ par << 'bogus but nonempty'
34
+ @chp.add_paragraph(par).should == par
35
+ @chp.paragraphs.should == [par]
36
+ end
37
+ it "adds tables" do
38
+ @chp.paragraphs.should == []
39
+ par = Table.new
40
+ par.next_cell!
41
+ @chp.add_paragraph(par).should == par
42
+ @chp.paragraphs.should == [par]
43
+ end
44
+ it "does not add duplicate paragraphs" do
45
+ @chp.paragraphs.should == []
46
+ par = Paragraph.new 'nonempty'
47
+ @chp.add_paragraph(par).should == par
48
+ @chp.add_paragraph(par).should == nil
49
+ @chp.paragraphs.should == [par]
50
+ end
51
+ end
52
+ describe Chapter, "#to_s" do
53
+ before :each do
54
+ @chp = Chapter.new
55
+ end
56
+ it "should add all paragraphs" do
57
+ @chp.to_s.should == ''
58
+ @chp.heading << 'the heading'
59
+ @chp.to_s.should == 'the heading'
60
+ @chp.paragraphs.concat %w{foo bar baz}
61
+ @chp.to_s.should == "the heading\nfoo\nbar\nbaz"
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,78 @@
1
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
2
+
3
+ require 'ebps/text/document'
4
+
5
+ module EBPS
6
+ module Text
7
+ describe Document, "#title" do
8
+ it "has a title" do
9
+ doc = Document.new
10
+ doc.title.should == ''
11
+ end
12
+ end
13
+ describe Document, "#chapters" do
14
+ it "initially returns an empty array" do
15
+ doc = Document.new
16
+ doc.chapters.should == []
17
+ end
18
+ end
19
+ describe Document, "#add_chapter" do
20
+ before :each do
21
+ @doc = Document.new
22
+ end
23
+ it "checks for type" do
24
+ @doc.chapters.should == []
25
+ lambda do
26
+ @doc.add_chapter("not a chapter")
27
+ end.should raise_error TypeError
28
+ @doc.chapters.should == []
29
+ end
30
+ it "adds the chapter" do
31
+ @doc.chapters.should == []
32
+ chp = Chapter.new
33
+ @doc.add_chapter(chp).should == chp
34
+ @doc.chapters.should == [chp]
35
+ end
36
+ it "does not add duplicate chapters" do
37
+ @doc.chapters.should == []
38
+ chp = Chapter.new
39
+ @doc.add_chapter(chp).should == chp
40
+ @doc.add_chapter(chp).should == nil
41
+ @doc.chapters.should == [chp]
42
+ end
43
+ end
44
+ describe Document, "#chapter" do
45
+ before :each do
46
+ @doc = Document.new
47
+ end
48
+ it "returns nil for unknown chapters" do
49
+ @doc.chapter(0).should == nil
50
+ chp = Chapter.new
51
+ @doc.add_chapter chp
52
+ @doc.chapter(0).should == chp
53
+ @doc.chapter(1).should == nil
54
+ end
55
+ end
56
+ describe Document, "#remove_chapter" do
57
+ before :each do
58
+ @doc = Document.new
59
+ end
60
+ it "removes the chapter" do
61
+ chp = Chapter.new
62
+ @doc.add_chapter chp
63
+ @doc.remove_chapter chp
64
+ @doc.chapters.should == []
65
+ end
66
+ end
67
+ describe Document, "#to_s" do
68
+ before :each do
69
+ @doc = Document.new
70
+ end
71
+ it "should add all chapters" do
72
+ @doc.to_s.should == ''
73
+ @doc.chapters.concat %w{foo bar baz}
74
+ @doc.to_s.should == "foo\nbar\nbaz"
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,77 @@
1
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
2
+
3
+ require 'ebps/text/paragraph'
4
+
5
+ module EBPS
6
+ module Text
7
+ describe Paragraph, "#<<" do
8
+ before :each do
9
+ @par = Paragraph.new
10
+ end
11
+ it "can start out with text" do
12
+ par = Paragraph.new 'with text'
13
+ par.text[par.formats.first.range].should == 'with text'
14
+ end
15
+ it "appends text" do
16
+ @par.text.should == ''
17
+ @par << 'some text'
18
+ @par.text.should == 'some text'
19
+ @par << ' leading and trailing space '
20
+ @par.text.should == 'some text leading and trailing space '
21
+ @par << 'or only trailing space '
22
+ @par.text.should == 'some text leading and trailing space or only trailing space '
23
+ end
24
+ it "formats text" do
25
+ @par.formats.size.should == 1
26
+ fmt = @par.formats.at(0)
27
+ fmt.values.should == []
28
+ fmt.start.should == 0
29
+ fmt.end.should == -1
30
+ @par.set_format 'b'
31
+ fmt = @par.formats.at(0)
32
+ fmt.values.should == ['b']
33
+ fmt.start.should == 0
34
+ fmt.end.should == -1
35
+ @par.formats.size.should == 1
36
+ @par << 'bold '
37
+ fmt = @par.formats.at(0)
38
+ fmt.values.should == ['b']
39
+ fmt.start.should == 0
40
+ fmt.end.should == -1
41
+ @par.set_format 'i'
42
+ @par.formats.size.should == 2
43
+ fmt = @par.formats.at(0)
44
+ fmt.values.should == ['b']
45
+ fmt.start.should == 0
46
+ fmt.end.should == 4
47
+ fmt = @par.formats.at(1)
48
+ fmt.values.should == ['i']
49
+ fmt.start.should == 5
50
+ fmt.end.should == -1
51
+ @par << 'italic '
52
+ fmt = @par.formats.at(0)
53
+ fmt.values.should == ['b']
54
+ fmt.start.should == 0
55
+ fmt.end.should == 4
56
+ fmt = @par.formats.at(1)
57
+ fmt.values.should == ['i']
58
+ fmt.start.should == 5
59
+ fmt.end.should == -1
60
+ @par.set_format('b', 'i')
61
+ @par.formats.size.should == 3
62
+ fmt = @par.formats.at(0)
63
+ fmt.values.should == ['b']
64
+ fmt.start.should == 0
65
+ fmt.end.should == 4
66
+ fmt = @par.formats.at(1)
67
+ fmt.values.should == ['i']
68
+ fmt.start.should == 5
69
+ fmt.end.should == 11
70
+ fmt = @par.formats.at(2)
71
+ fmt.values.should == ['b', 'i']
72
+ fmt.start.should == 12
73
+ fmt.end.should == -1
74
+ end
75
+ end
76
+ end
77
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ebps
3
+ version: !ruby/object:Gem::Version
4
+ hash: 19
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 2
10
+ version: 1.0.2
11
+ platform: ruby
12
+ authors:
13
+ - Masaomi Hatakeyama, Zeno R.R. Davatz
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-12-17 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: hoe
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 47
30
+ segments:
31
+ - 2
32
+ - 8
33
+ - 0
34
+ version: 2.8.0
35
+ type: :development
36
+ version_requirements: *id001
37
+ description: |-
38
+ This software will create an ebook for Kindle, Stanza, Firefox and any other
39
+ ebook Reader out there. It will create the ebook from the ywesee Fachinfo.yaml
40
+ file found at http://ch.oddb.org/de/gcc/download_export/
41
+ email:
42
+ - mhatakeyama@ywesee.com, zdavatz@ywesee.com
43
+ executables:
44
+ - ebps
45
+ extensions: []
46
+
47
+ extra_rdoc_files:
48
+ - History.txt
49
+ - LICENSE.txt
50
+ - Manifest.txt
51
+ - README.txt
52
+ files:
53
+ - History.txt
54
+ - InstalledFiles
55
+ - LICENSE.txt
56
+ - Manifest.txt
57
+ - README.txt
58
+ - Rakefile
59
+ - SetupConfig
60
+ - bin/ebps
61
+ - example/config.yml
62
+ - example/converter_for_firefox.rb
63
+ - example/data.yml
64
+ - example/example.sh
65
+ - example/sample.epub
66
+ - lib/ebps.rb
67
+ - lib/ebps/config.rb
68
+ - lib/ebps/conversion/de_fachinfo_yaml.rb
69
+ - lib/ebps/conversion/epub.rb
70
+ - lib/ebps/conversion/fachinfo_xml.rb
71
+ - lib/ebps/conversion/fachinfo_yaml.rb
72
+ - lib/ebps/conversion/import_module_sample.rb
73
+ - lib/ebps/conversion/mobi_pocket.rb
74
+ - lib/ebps/conversion/oebps.rb
75
+ - lib/ebps/conversion/patinfo_yaml.rb
76
+ - lib/ebps/data/default_cover.jpg
77
+ - lib/ebps/data/stylesheet.css
78
+ - lib/ebps/postprocess/bookworm.rb
79
+ - lib/ebps/postprocess/copy.rb
80
+ - lib/ebps/postprocess/system_call.rb
81
+ - lib/ebps/preprocess/copy.rb
82
+ - lib/ebps/preprocess/system_call.rb
83
+ - lib/ebps/text/chapter.rb
84
+ - lib/ebps/text/document.rb
85
+ - lib/ebps/text/format.rb
86
+ - lib/ebps/text/paragraph.rb
87
+ - lib/ebps/text/picture.rb
88
+ - lib/ebps/text/table.rb
89
+ - lib/ebps/util/mail.rb
90
+ - lib/ebps/util/smtp_tls.rb
91
+ - spec/conversion/data/DF_15164_1_3.gif
92
+ - spec/conversion/data/DF_15164_2_3.gif
93
+ - spec/conversion/data/appendix.png
94
+ - spec/conversion/data/fachinfo.xml
95
+ - spec/conversion/data/fachinfo.yaml
96
+ - spec/conversion/data/fachinfo_with_image.xml
97
+ - spec/conversion/data/fachinfo_with_table.xml
98
+ - spec/conversion/data/fachinfos.de.oddb.yaml
99
+ - spec/conversion/data/images/5c/5c54d52c8132230e8c40c37a428fe761.png
100
+ - spec/conversion/de_fachinfo_yaml_spec.rb
101
+ - spec/conversion/epub_spec.rb
102
+ - spec/conversion/fachinfo_xml_spec.rb
103
+ - spec/conversion/fachinfo_yaml_spec.rb
104
+ - spec/conversion/mobi_pocket_spec.rb
105
+ - spec/conversion/oebps_spec.rb
106
+ - spec/text/chapter_spec.rb
107
+ - spec/text/document_spec.rb
108
+ - spec/text/paragraph_spec.rb
109
+ has_rdoc: true
110
+ homepage: http://scm.ywesee.com/?p=ebps/.git;a=summary
111
+ licenses: []
112
+
113
+ post_install_message:
114
+ rdoc_options:
115
+ - --main
116
+ - README.txt
117
+ require_paths:
118
+ - lib
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ hash: 3
125
+ segments:
126
+ - 0
127
+ version: "0"
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ hash: 3
134
+ segments:
135
+ - 0
136
+ version: "0"
137
+ requirements: []
138
+
139
+ rubyforge_project: ebps
140
+ rubygems_version: 1.3.7
141
+ signing_key:
142
+ specification_version: 3
143
+ summary: This software will create an ebook for Kindle, Stanza, Firefox and any other ebook Reader out there
144
+ test_files: []
145
+