ebps 1.0.2 → 1.0.4

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.
@@ -1,4 +1,8 @@
1
+ #! /usr/bin/env ruby19
1
2
  # encoding: utf-8
3
+ # EBPS::Conversion::FachinfoXml::Specs -- ebps -- 27.09.2011 -- mhatakeyama@ywesee.com
4
+ # EBPS::Conversion::FachinfoXml::Specs -- ebps -- 12.03.2010 -- hwyss@ywesee.com
5
+
2
6
  $: << File.expand_path('../../lib', File.dirname(__FILE__))
3
7
 
4
8
  require 'ebps/conversion/fachinfo_xml'
@@ -46,6 +50,21 @@ module EBPS
46
50
  @listener.end_paragraph
47
51
  @listener.current_chapter.should == nil
48
52
  end
53
+ it "the monid tag generates a new chapter and paragraph" do
54
+ document = @listener.start_fi({})
55
+ target = @listener.start_monid({})
56
+ target.should be_a(EBPS::Text::Paragraph)
57
+ @listener.current_target.should == target
58
+ end
59
+ it "the monid tag generate a table and insert photos" do
60
+ EBPS.config.photos = 'photos'
61
+ Dir.should_receive(:glob).and_return(['123_test.jpg'])
62
+ File.should_receive(:read).and_return('read')
63
+ document = @listener.start_fi({})
64
+ target = @listener.start_monid({})
65
+ @listener.end_monid
66
+ @listener.current_target.should be_nil
67
+ end
49
68
  it "the paragraphTitle tag targets the current chapter's heading" do
50
69
  document = @listener.start_fi({})
51
70
  chapter = @listener.start_paragraph({})
@@ -1,4 +1,8 @@
1
+ #! /usr/bin/env ruby19
1
2
  # - encoding:utf-8
3
+ # EBPS::Conversion::Specs -- ebps -- 26.09.2011 -- mhatakeyama@ywesee.com
4
+ # EBPS::Conversion::Specs -- ebps -- 26.02.2010 -- hwyss@ywesee.com
5
+
2
6
  $: << File.expand_path('../../lib', File.dirname(__FILE__))
3
7
 
4
8
  require 'ebps/conversion/oebps'
@@ -48,17 +52,18 @@ module EBPS
48
52
  result = StringIO.new
49
53
  Oebps.export [@doc1, @doc2], result, @var do
50
54
  Dir.entries(@var).should == [
51
- ".", "..",
52
- "1_Much_Shorter.html",
53
- "2_My_Title.html",
54
- "m.html",
55
- "toc.html",
55
+ ".",
56
+ "..",
57
+ "1_Much_Shorter.html",
58
+ "2_My_Title.html",
59
+ "4c71d4170591f67d0e6d348057fb853b.gif",
60
+ "Much_Shorter.opf",
61
+ "appendix.html",
62
+ "default_cover.jpg",
63
+ "m.html",
64
+ "stylesheet.css",
65
+ "toc.html",
56
66
  "toc.ncx",
57
- "default_cover.jpg",
58
- "stylesheet.css",
59
- "4c71d4170591f67d0e6d348057fb853b.gif",
60
- "appendix.html",
61
- "Much_Shorter.opf",
62
67
  ]
63
68
  end
64
69
  end
@@ -162,7 +167,7 @@ module EBPS
162
167
  @doc.add_chapter c1
163
168
  ids = []
164
169
  html, uid = Oebps.document_to_html @doc, ids, @var
165
- uid.should == "ideed7da47dbb8450b2f78767219133740"
170
+ uid.should == "id51584f40d923ea229bd8ff3e5c3231fe"
166
171
  doc = REXML::Document.new html
167
172
  doc.should be_instance_of(REXML::Document)
168
173
  html.should == <<-EOS
@@ -175,7 +180,7 @@ module EBPS
175
180
  <link type="text/css" rel="stylesheet" href="stylesheet.css"/>
176
181
  </head>
177
182
  <body>
178
- <h1 id="ideed7da47dbb8450b2f78767219133740">My Title</h1>
183
+ <h1 id="id51584f40d923ea229bd8ff3e5c3231fe">My Title</h1>
179
184
  <p class="ebps">
180
185
  <img src="51584f40d923ea229bd8ff3e5c3231fe.gif" alt=""/>
181
186
  </p>
@@ -339,9 +344,9 @@ module EBPS
339
344
  <manifest>
340
345
  <item id="part1" href="chapter1.html" media-type="application/xhtml+xml"/>
341
346
  <item id="part2" href="chapter2.htm" media-type="application/xhtml+xml"/>
342
- <item id="toc" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
343
347
  <item id="image1" href="image1.gif" media-type="image/gif"/>
344
348
  <item id="image2" href="image2.jpeg" media-type="image/jpeg"/>
349
+ <item id="toc" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
345
350
  </manifest>
346
351
  <spine toc="toc">
347
352
  <itemref idref="part1"/>
@@ -551,5 +556,78 @@ module EBPS
551
556
  EOS
552
557
  end
553
558
  end
559
+ describe Oebps::HtmlFactory, 'class' do
560
+ before do
561
+ ids = []
562
+ subject = mock('subject')
563
+ @factory = Oebps::HtmlFactory.new(subject, ids, 'tmpdir')
564
+ @builder = @factory.instance_variable_get('@builder')
565
+ end
566
+ it 'format_linked_paragraph should return xhtml for a table celll with a link' do
567
+ linked_paragraph = EBPS::Text::LinkedParagraph.new('http://hogehoge', 'string')
568
+ expected = <<EOS
569
+ <?xml version="1.0" encoding="UTF-8"?>
570
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
571
+ <td>
572
+ <a href="http://hogehoge">
573
+ string
574
+ </a>
575
+ </td>
576
+ EOS
577
+ @factory.format_linked_paragraph(linked_paragraph, @builder).should == expected
578
+ end
579
+ it 'format_picture should return xhtml for a picutre' do
580
+ image = mock('image', :write => nil)
581
+ picture = EBPS::Text::Picture.new
582
+ Magick::Image.should_receive(:from_blob).and_return([image])
583
+ expected = <<EOS
584
+ <?xml version="1.0" encoding="UTF-8"?>
585
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
586
+ <td>
587
+ <p class="ebps">
588
+ <img src="d41d8cd98f00b204e9800998ecf8427e.gif" alt=""/>
589
+ </p>
590
+ </td>
591
+ EOS
592
+ @factory.format_picture(picture, @builder).should == expected
593
+ end
594
+ it 'format_table should return xhtml for a table' do
595
+ table = EBPS::Text::Table.new
596
+ image = mock('image', :write => nil)
597
+ picture = EBPS::Text::Picture.new
598
+ Magick::Image.should_receive(:from_blob).and_return([image])
599
+ linked_paragraph = EBPS::Text::LinkedParagraph.new('http://hogehoge', 'string')
600
+ # table << linked_paragraph
601
+ table.rows[0][0] = picture
602
+ table.next_cell!
603
+ table.rows[0][1] = linked_paragraph
604
+ table.next_cell!
605
+ table << 'hogehoge'
606
+ expected = <<EOS
607
+ <?xml version="1.0" encoding="UTF-8"?>
608
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
609
+ <table class="ebps">
610
+ <tbody>
611
+ <tr>
612
+ <td>
613
+ <p class="ebps">
614
+ <img src="d41d8cd98f00b204e9800998ecf8427e.gif" alt=""/>
615
+ </p>
616
+ </td>
617
+ <td>
618
+ <a href="http://hogehoge">
619
+ string
620
+ </a>
621
+ </td>
622
+ <td>
623
+ hogehoge
624
+ </td>
625
+ </tr>
626
+ </tbody>
627
+ </table>
628
+ EOS
629
+ @factory.format_table(table).should == expected
630
+ end
631
+ end
554
632
  end
555
633
  end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ # suite.rb -- migel -- 07.09.2011 -- mhatakeyama@ywesee.com
3
+
4
+ require 'find'
5
+
6
+ here = File.expand_path(File.dirname(__FILE__))
7
+
8
+ $: << here
9
+
10
+ Find.find(here) { |file|
11
+ if /.*_spec\.rb$/o.match(file)
12
+ require file
13
+ end
14
+ }
metadata CHANGED
@@ -1,63 +1,79 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
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
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.4
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
13
- - Masaomi Hatakeyama, Zeno R.R. Davatz
7
+ authors:
8
+ - Yasuhiro Asaka, Zeno R.R. Davatz
14
9
  autorequire:
15
10
  bindir: bin
16
11
  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
12
+ date: 2013-06-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rdoc
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.10'
22
+ type: :development
23
23
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.10'
30
+ - !ruby/object:Gem::Dependency
31
+ name: hoe
32
+ requirement: !ruby/object:Gem::Requirement
25
33
  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
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '2.13'
35
38
  type: :development
36
- version_requirements: *id001
37
- description: |-
38
- This software will create an ebook for Kindle, Stanza, Firefox and any other
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '2.13'
46
+ description: ! 'This software will create an ebook for Kindle, Stanza, Firefox and
47
+ any other
48
+
39
49
  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:
50
+
51
+ file found at http://ch.oddb.org/de/gcc/download_export/'
52
+ email:
53
+ - yasaka@ywesee.com, zdavatz@ywesee.com
54
+ executables:
44
55
  - ebps
45
56
  extensions: []
46
-
47
- extra_rdoc_files:
57
+ extra_rdoc_files:
58
+ - Guide.txt
48
59
  - History.txt
49
60
  - LICENSE.txt
50
61
  - Manifest.txt
51
62
  - README.txt
52
- files:
63
+ files:
64
+ - Guide.txt
53
65
  - History.txt
54
- - InstalledFiles
55
66
  - LICENSE.txt
56
67
  - Manifest.txt
57
68
  - README.txt
58
69
  - Rakefile
59
- - SetupConfig
60
70
  - bin/ebps
71
+ - data/css/emediat.css
72
+ - data/css/oddb.css
73
+ - decorators/ch_oddb_de.rb
74
+ - decorators/ch_oddb_fr.rb
75
+ - decorators/just_medical_de.rb
76
+ - decorators/just_medical_fr.rb
61
77
  - example/config.yml
62
78
  - example/converter_for_firefox.rb
63
79
  - example/data.yml
@@ -88,6 +104,7 @@ files:
88
104
  - lib/ebps/text/table.rb
89
105
  - lib/ebps/util/mail.rb
90
106
  - lib/ebps/util/smtp_tls.rb
107
+ - setup.rb
91
108
  - spec/conversion/data/DF_15164_1_3.gif
92
109
  - spec/conversion/data/DF_15164_2_3.gif
93
110
  - spec/conversion/data/appendix.png
@@ -103,43 +120,36 @@ files:
103
120
  - spec/conversion/fachinfo_yaml_spec.rb
104
121
  - spec/conversion/mobi_pocket_spec.rb
105
122
  - spec/conversion/oebps_spec.rb
123
+ - spec/suite.rb
106
124
  - spec/text/chapter_spec.rb
107
125
  - spec/text/document_spec.rb
108
126
  - spec/text/paragraph_spec.rb
109
- has_rdoc: true
127
+ - .gemtest
110
128
  homepage: http://scm.ywesee.com/?p=ebps/.git;a=summary
111
129
  licenses: []
112
-
113
130
  post_install_message:
114
- rdoc_options:
131
+ rdoc_options:
115
132
  - --main
116
133
  - README.txt
117
- require_paths:
134
+ require_paths:
118
135
  - lib
119
- required_ruby_version: !ruby/object:Gem::Requirement
136
+ required_ruby_version: !ruby/object:Gem::Requirement
120
137
  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
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
143
  none: false
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- hash: 3
134
- segments:
135
- - 0
136
- version: "0"
144
+ requirements:
145
+ - - ! '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
137
148
  requirements: []
138
-
139
149
  rubyforge_project: ebps
140
- rubygems_version: 1.3.7
150
+ rubygems_version: 1.8.25
141
151
  signing_key:
142
152
  specification_version: 3
143
- summary: This software will create an ebook for Kindle, Stanza, Firefox and any other ebook Reader out there
153
+ summary: This software will create an ebook for Kindle, Stanza, Firefox and any other
154
+ ebook Reader out there
144
155
  test_files: []
145
-
@@ -1,36 +0,0 @@
1
- /usr/bin/ebps
2
- /usr
3
- /usr/lib
4
- /usr/lib/ruby
5
- /usr/lib/ruby/site_ruby
6
- /usr/lib/ruby/site_ruby/1.8
7
- /usr/lib/ruby/site_ruby/1.8/ebps
8
- /usr/lib/ruby/site_ruby/1.8/ebps/config.rb
9
- /usr/lib/ruby/site_ruby/1.8/ebps/conversion
10
- /usr/lib/ruby/site_ruby/1.8/ebps/conversion/de_fachinfo_yaml.rb
11
- /usr/lib/ruby/site_ruby/1.8/ebps/conversion/epub.rb
12
- /usr/lib/ruby/site_ruby/1.8/ebps/conversion/fachinfo_xml.rb
13
- /usr/lib/ruby/site_ruby/1.8/ebps/conversion/fachinfo_yaml.rb
14
- /usr/lib/ruby/site_ruby/1.8/ebps/conversion/mobi_pocket.rb
15
- /usr/lib/ruby/site_ruby/1.8/ebps/conversion/oebps.rb
16
- /usr/lib/ruby/site_ruby/1.8/ebps/data
17
- /usr/lib/ruby/site_ruby/1.8/ebps/data/default_cover.jpg
18
- /usr/lib/ruby/site_ruby/1.8/ebps/data/stylesheet.css
19
- /usr/lib/ruby/site_ruby/1.8/ebps/postprocess
20
- /usr/lib/ruby/site_ruby/1.8/ebps/postprocess/bookworm.rb
21
- /usr/lib/ruby/site_ruby/1.8/ebps/postprocess/copy.rb
22
- /usr/lib/ruby/site_ruby/1.8/ebps/postprocess/system_call.rb
23
- /usr/lib/ruby/site_ruby/1.8/ebps/preprocess
24
- /usr/lib/ruby/site_ruby/1.8/ebps/preprocess/copy.rb
25
- /usr/lib/ruby/site_ruby/1.8/ebps/preprocess/system_call.rb
26
- /usr/lib/ruby/site_ruby/1.8/ebps/text
27
- /usr/lib/ruby/site_ruby/1.8/ebps/text/chapter.rb
28
- /usr/lib/ruby/site_ruby/1.8/ebps/text/document.rb
29
- /usr/lib/ruby/site_ruby/1.8/ebps/text/format.rb
30
- /usr/lib/ruby/site_ruby/1.8/ebps/text/paragraph.rb
31
- /usr/lib/ruby/site_ruby/1.8/ebps/text/picture.rb
32
- /usr/lib/ruby/site_ruby/1.8/ebps/text/table.rb
33
- /usr/lib/ruby/site_ruby/1.8/ebps/util
34
- /usr/lib/ruby/site_ruby/1.8/ebps/util/mail.rb
35
- /usr/lib/ruby/site_ruby/1.8/ebps/util/smtp_tls.rb
36
- /usr/lib/ruby/site_ruby/1.8/ebps.rb
@@ -1,30 +0,0 @@
1
- ---
2
- install_prefix:
3
- localstatedir: /var/lib
4
- prefix: /usr
5
- rubyprog: /usr/bin/ruby18
6
- rubypath: /usr/bin/ruby18
7
- siterubyverarch: /usr/lib/ruby/site_ruby/1.8/i686-linux
8
- no_ext: false
9
- no_ri: true
10
- extconfopt: ""
11
- type: site
12
- no_doc: false
13
- librubyverarch: /usr/lib/ruby/1.8/i686-linux
14
- installdirs: site
15
- no_test: true
16
- siteruby: /usr/lib/ruby/site_ruby
17
- root:
18
- siterubyver: /usr/lib/ruby/site_ruby/1.8
19
- sysconfdir: /etc
20
- rbdir: /usr/lib/ruby/site_ruby/1.8
21
- datadir: /usr/share
22
- shebang: ruby
23
- makeprog: make
24
- librubyver: /usr/lib/ruby/1.8
25
- mandir: /usr/share/man
26
- libdir: /usr/lib
27
- libruby: /usr/lib/ruby
28
- sodir: /usr/lib/ruby/site_ruby/1.8/i686-linux
29
- docdir: /usr/share/doc
30
- bindir: /usr/bin