review 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +90 -66
- data/.travis.yml +1 -1
- data/Gemfile +0 -1
- data/NEWS.ja.md +82 -0
- data/NEWS.md +83 -0
- data/README.md +5 -3
- data/Rakefile +8 -8
- data/bin/review +1 -5
- data/bin/review-catalog-converter +22 -27
- data/bin/review-check +36 -43
- data/bin/review-checkdep +10 -15
- data/bin/review-compile +37 -55
- data/bin/review-epubmaker +4 -5
- data/bin/review-index +21 -29
- data/bin/review-init +26 -37
- data/bin/review-pdfmaker +0 -2
- data/bin/review-preproc +25 -45
- data/bin/review-validate +19 -18
- data/bin/review-vol +15 -27
- data/doc/config.yml.sample +5 -2
- data/doc/format.ja.md +20 -1
- data/doc/format.md +21 -5
- data/doc/images/review-generate.png +0 -0
- data/lib/epubmaker.rb +1 -3
- data/lib/epubmaker/content.rb +24 -27
- data/lib/epubmaker/epubcommon.rb +135 -148
- data/lib/epubmaker/epubv2.rb +39 -46
- data/lib/epubmaker/epubv3.rb +93 -103
- data/lib/epubmaker/producer.rb +138 -151
- data/lib/epubmaker/zip_exporter.rb +21 -26
- data/lib/review/book.rb +3 -6
- data/lib/review/book/base.rb +78 -103
- data/lib/review/book/chapter.rb +36 -40
- data/lib/review/book/compilable.rb +28 -31
- data/lib/review/book/image_finder.rb +6 -13
- data/lib/review/book/index.rb +100 -121
- data/lib/review/book/page_metric.rb +2 -7
- data/lib/review/book/part.rb +18 -20
- data/lib/review/book/volume.rb +9 -13
- data/lib/review/builder.rb +81 -116
- data/lib/review/catalog.rb +15 -19
- data/lib/review/compiler.rb +64 -83
- data/lib/review/configure.rb +87 -97
- data/lib/review/converter.rb +2 -7
- data/lib/review/epubbuilder.rb +1 -3
- data/lib/review/epubmaker.rb +213 -205
- data/lib/review/exception.rb +2 -4
- data/lib/review/extentions.rb +0 -1
- data/lib/review/extentions/hash.rb +2 -2
- data/lib/review/extentions/string.rb +5 -30
- data/lib/review/htmlbuilder.rb +320 -375
- data/lib/review/htmltoc.rb +4 -7
- data/lib/review/htmlutils.rb +29 -32
- data/lib/review/i18n.rb +33 -44
- data/lib/review/i18n.yml +3 -3
- data/lib/review/idgxmlbuilder.rb +309 -345
- data/lib/review/latexbuilder.rb +175 -212
- data/lib/review/latexindex.rb +2 -8
- data/lib/review/latexutils.rb +33 -43
- data/lib/review/lineinput.rb +1 -1
- data/lib/review/logger.rb +21 -0
- data/lib/review/makerhelper.rb +1 -4
- data/lib/review/markdownbuilder.rb +44 -53
- data/lib/review/md2inaobuilder.rb +6 -12
- data/lib/review/pdfmaker.rb +143 -173
- data/lib/review/preprocessor.rb +64 -101
- data/lib/review/rstbuilder.rb +126 -158
- data/lib/review/sec_counter.rb +18 -34
- data/lib/review/template.rb +4 -5
- data/lib/review/textbuilder.rb +2 -3
- data/lib/review/textutils.rb +7 -13
- data/lib/review/tocparser.rb +31 -56
- data/lib/review/tocprinter.rb +26 -52
- data/lib/review/topbuilder.rb +219 -247
- data/lib/review/unfold.rb +15 -24
- data/lib/review/version.rb +1 -1
- data/lib/review/webmaker.rb +75 -99
- data/lib/review/webtocprinter.rb +15 -20
- data/lib/review/yamlloader.rb +13 -15
- data/review.gemspec +20 -22
- data/templates/latex/layout.tex.erb +2 -2
- data/templates/opf/epubv2.opf.erb +7 -7
- data/templates/opf/epubv3.opf.erb +7 -7
- data/templates/web/html/layout-html5.html.erb +2 -2
- data/test/assets/black.eps +280 -0
- data/test/assets/fit.png +0 -0
- data/test/assets/large.gif +0 -0
- data/test/assets/large.jpg +0 -0
- data/test/assets/large.png +0 -0
- data/test/assets/large.svg +65 -0
- data/test/assets/test_template.tex +1 -1
- data/test/book_test_helper.rb +2 -2
- data/test/run_test.rb +4 -4
- data/test/sample-book/src/Rakefile +21 -22
- data/test/syntax-book/Gemfile +4 -0
- data/test/syntax-book/Rakefile +72 -0
- data/test/syntax-book/appA.re +22 -0
- data/test/syntax-book/bib.re +6 -0
- data/test/syntax-book/catalog.yml +15 -0
- data/test/syntax-book/ch01.re +136 -0
- data/test/syntax-book/ch02.re +351 -0
- data/test/syntax-book/ch03.re +82 -0
- data/test/syntax-book/config.yml +35 -0
- data/test/syntax-book/images/ball.png +0 -0
- data/test/syntax-book/images/cover.jpg +0 -0
- data/test/syntax-book/images/fractal.png +0 -0
- data/test/syntax-book/images/img3-1.png +0 -0
- data/test/syntax-book/images/inlineicon.jpg +0 -0
- data/test/syntax-book/images/logic.png +0 -0
- data/test/syntax-book/images/logic2.png +0 -0
- data/test/syntax-book/images/puzzle.jpg +0 -0
- data/test/syntax-book/images/table.jpg +0 -0
- data/test/syntax-book/part2.re +6 -0
- data/test/syntax-book/pre01.re +26 -0
- data/test/syntax-book/review-ext.rb +14 -0
- data/test/syntax-book/sty/jumoline.sty +310 -0
- data/test/syntax-book/sty/reviewmacro.sty +39 -0
- data/test/syntax-book/style.css +494 -0
- data/test/syntax-book/syntax.dic +2 -0
- data/test/test_book.rb +106 -111
- data/test/test_book_chapter.rb +21 -22
- data/test/test_book_part.rb +3 -5
- data/test/test_builder.rb +11 -22
- data/test/test_catalog.rb +17 -18
- data/test/test_catalog_converter_cmd.rb +5 -5
- data/test/test_compiler.rb +18 -16
- data/test/test_configure.rb +35 -38
- data/test/test_converter.rb +3 -4
- data/test/test_epub3maker.rb +136 -117
- data/test/test_epubmaker.rb +107 -114
- data/test/test_epubmaker_cmd.rb +2 -4
- data/test/test_extentions_hash.rb +32 -33
- data/test/test_helper.rb +9 -11
- data/test/test_htmlbuilder.rb +454 -420
- data/test/test_htmltoc.rb +8 -12
- data/test/test_htmlutils.rb +0 -2
- data/test/test_i18n.rb +159 -150
- data/test/test_idgxmlbuilder.rb +190 -197
- data/test/test_image_finder.rb +21 -22
- data/test/test_index.rb +24 -29
- data/test/test_latexbuilder.rb +274 -264
- data/test/test_lineinput.rb +7 -10
- data/test/test_location.rb +7 -7
- data/test/test_makerhelper.rb +13 -25
- data/test/test_markdownbuilder.rb +23 -26
- data/test/test_md2inaobuilder.rb +8 -11
- data/test/test_pdfmaker.rb +114 -123
- data/test/test_pdfmaker_cmd.rb +1 -3
- data/test/test_review_ext.rb +3 -5
- data/test/test_rstbuilder.rb +92 -97
- data/test/test_template.rb +3 -7
- data/test/test_textutils.rb +27 -27
- data/test/test_tocparser.rb +2 -2
- data/test/test_topbuilder.rb +98 -103
- data/test/test_webtocprinter.rb +5 -6
- data/test/test_yamlloader.rb +42 -42
- data/test/test_zip_exporter.rb +12 -18
- metadata +86 -9
- data/lib/review/ewbbuilder.rb +0 -382
data/test/test_converter.rb
CHANGED
@@ -9,13 +9,12 @@ class ConverterTest < Test::Unit::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_converter_builder
|
12
|
-
mktmpbookdir('config.yml'=>"bookname: book\n") do |dir,
|
12
|
+
mktmpbookdir('config.yml' => "bookname: book\n") do |dir, _book, _files|
|
13
13
|
@book = Book::Base.new(dir)
|
14
|
-
config_file = File.join(dir,
|
14
|
+
config_file = File.join(dir, 'config.yml')
|
15
15
|
@book.load_config(config_file)
|
16
16
|
@converter = ReVIEW::Converter.new(@book, ReVIEW::LATEXBuilder.new)
|
17
|
-
assert_equal
|
17
|
+
assert_equal 'latex', @book.config['builder']
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
21
20
|
end
|
data/test/test_epub3maker.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'test_helper'
|
4
2
|
require 'epubmaker'
|
5
3
|
require 'review/epubmaker'
|
@@ -9,15 +7,16 @@ class EPUB3MakerTest < Test::Unit::TestCase
|
|
9
7
|
|
10
8
|
def setup
|
11
9
|
@producer = Producer.new
|
12
|
-
@producer.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
@producer.merge_config(
|
11
|
+
'bookname' => 'sample',
|
12
|
+
'title' => 'Sample Book',
|
13
|
+
'epubversion' => 3,
|
14
|
+
'urnid' => 'http://example.jp/',
|
15
|
+
'date' => '2011-01-01',
|
16
|
+
'language' => 'en',
|
17
|
+
'modified' => '2014-12-13T14:15:16Z',
|
18
|
+
'titlepage' => nil
|
19
|
+
)
|
21
20
|
@output = StringIO.new
|
22
21
|
end
|
23
22
|
|
@@ -26,18 +25,18 @@ class EPUB3MakerTest < Test::Unit::TestCase
|
|
26
25
|
end
|
27
26
|
|
28
27
|
def test_resource_en
|
29
|
-
@producer.
|
30
|
-
assert_equal
|
28
|
+
@producer.merge_config('language' => 'en')
|
29
|
+
assert_equal 'Table of Contents', @producer.res.v('toctitle')
|
31
30
|
end
|
32
31
|
|
33
32
|
def test_resource_ja
|
34
|
-
@producer.
|
35
|
-
assert_equal
|
33
|
+
@producer.merge_config('language' => 'ja')
|
34
|
+
assert_equal '目次', @producer.res.v('toctitle')
|
36
35
|
end
|
37
36
|
|
38
37
|
def test_mimetype
|
39
38
|
@producer.mimetype(@output)
|
40
|
-
assert_equal
|
39
|
+
assert_equal 'application/epub+zip', @output.string
|
41
40
|
end
|
42
41
|
|
43
42
|
def test_container
|
@@ -82,7 +81,10 @@ EOT
|
|
82
81
|
end
|
83
82
|
|
84
83
|
def test_stage1_opf_ebpaj
|
85
|
-
@producer.
|
84
|
+
@producer.merge_config(
|
85
|
+
'opf_prefix' => { 'ebpaj' => 'http://www.ebpaj.jp/' },
|
86
|
+
'opf_meta' => { 'ebpaj:guide-version' => '1.1.2' }
|
87
|
+
)
|
86
88
|
@producer.opf(@output)
|
87
89
|
expect = <<EOT
|
88
90
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -112,9 +114,9 @@ EOT
|
|
112
114
|
end
|
113
115
|
|
114
116
|
def test_stage1_opf_fileas
|
115
|
-
@producer.
|
116
|
-
@producer.
|
117
|
-
@producer.
|
117
|
+
@producer.config['title'] = { 'name' => 'これは書籍です', 'file-as' => 'コレハショセキデス' }
|
118
|
+
@producer.config['aut'] = [{ 'name' => '著者A', 'file-as' => 'チョシャA' }, { 'name' => '著者B', 'file-as' => 'チョシャB' }]
|
119
|
+
@producer.config['pbl'] = [{ 'name' => '出版社', 'file-as' => 'シュッパンシャ' }]
|
118
120
|
@producer.opf(@output)
|
119
121
|
expect = <<EOT
|
120
122
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -179,15 +181,15 @@ EOT
|
|
179
181
|
|
180
182
|
def stage2
|
181
183
|
# add one item
|
182
|
-
@producer.contents << Content.new({
|
184
|
+
@producer.contents << Content.new({ 'file' => 'ch01.html', 'title' => 'CH01', 'level' => 1 })
|
183
185
|
end
|
184
186
|
|
185
187
|
def test_stage2_add_l1item
|
186
188
|
stage2
|
187
|
-
expect = EPUBMaker::Content.new(
|
188
|
-
|
189
|
-
|
190
|
-
|
189
|
+
expect = EPUBMaker::Content.new('ch01.html',
|
190
|
+
'ch01-html',
|
191
|
+
'application/xhtml+xml',
|
192
|
+
'CH01',
|
191
193
|
1)
|
192
194
|
assert_equal expect, @producer.contents[0]
|
193
195
|
end
|
@@ -249,49 +251,49 @@ EOT
|
|
249
251
|
|
250
252
|
def stage3
|
251
253
|
# add more items
|
252
|
-
@producer.contents << Content.new({
|
253
|
-
@producer.contents << Content.new({
|
254
|
-
@producer.contents << Content.new({
|
255
|
-
@producer.contents << Content.new({
|
256
|
-
@producer.contents << Content.new({
|
257
|
-
@producer.contents << Content.new({
|
258
|
-
@producer.contents << Content.new({
|
259
|
-
@producer.contents << Content.new({
|
260
|
-
@producer.contents << Content.new({
|
261
|
-
@producer.contents << Content.new({
|
262
|
-
@producer.contents << Content.new({
|
263
|
-
@producer.contents << Content.new({
|
264
|
-
@producer.contents << Content.new({
|
265
|
-
@producer.contents << Content.new({
|
266
|
-
@producer.contents << Content.new({
|
267
|
-
@producer.contents << Content.new({
|
268
|
-
@producer.contents << Content.new({
|
269
|
-
@producer.contents << Content.new({
|
270
|
-
@producer.contents << Content.new({
|
254
|
+
@producer.contents << Content.new({ 'file' => 'ch01.html', 'title' => %Q(CH01<>&"), 'level' => 1 })
|
255
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html', 'title' => 'CH02', 'level' => 1 })
|
256
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html#S1', 'title' => 'CH02.1', 'level' => 2 })
|
257
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html#S1.1', 'title' => 'CH02.1.1', 'level' => 3 })
|
258
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html#S1.1.1', 'title' => 'CH02.1.1.1', 'level' => 4 })
|
259
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html#S1.1.1.1', 'title' => 'CH02.1.1.1.1', 'level' => 5 })
|
260
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html#S1.1.2', 'title' => 'CH02.1.1.2', 'level' => 4 })
|
261
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html#S2', 'title' => 'CH02.2', 'level' => 2 })
|
262
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html#S2.1', 'title' => 'CH02.2.1', 'level' => 3 })
|
263
|
+
@producer.contents << Content.new({ 'file' => 'ch03.html', 'title' => 'CH03', 'level' => 1, 'properties' => ['mathml'] })
|
264
|
+
@producer.contents << Content.new({ 'file' => 'ch03.html#S1', 'title' => 'CH03.1', 'level' => 2 })
|
265
|
+
@producer.contents << Content.new({ 'file' => 'ch03.html#S1.1', 'title' => 'CH03.1.1', 'level' => 3 })
|
266
|
+
@producer.contents << Content.new({ 'file' => 'ch04.html', 'title' => 'CH04', 'level' => 1 })
|
267
|
+
@producer.contents << Content.new({ 'file' => 'sample.png' })
|
268
|
+
@producer.contents << Content.new({ 'file' => 'sample.jpg' })
|
269
|
+
@producer.contents << Content.new({ 'file' => 'sample.JPEG' })
|
270
|
+
@producer.contents << Content.new({ 'file' => 'sample.SvG' })
|
271
|
+
@producer.contents << Content.new({ 'file' => 'sample.GIF' })
|
272
|
+
@producer.contents << Content.new({ 'file' => 'sample.css' })
|
271
273
|
end
|
272
274
|
|
273
275
|
def test_stage3_add_various_items
|
274
276
|
stage3
|
275
277
|
expect = [
|
276
|
-
Content.new(
|
277
|
-
Content.new(
|
278
|
-
Content.new(
|
279
|
-
Content.new(
|
280
|
-
Content.new(
|
281
|
-
Content.new(
|
282
|
-
Content.new(
|
283
|
-
Content.new(
|
284
|
-
Content.new(
|
285
|
-
Content.new(
|
286
|
-
Content.new(
|
287
|
-
Content.new(
|
288
|
-
Content.new(
|
289
|
-
Content.new(
|
290
|
-
Content.new(
|
291
|
-
Content.new(
|
292
|
-
Content.new(
|
293
|
-
Content.new(
|
294
|
-
Content.new(
|
278
|
+
Content.new('ch01.html', 'ch01-html', 'application/xhtml+xml', %Q(CH01<>&"), 1),
|
279
|
+
Content.new('ch02.html', 'ch02-html', 'application/xhtml+xml', 'CH02', 1),
|
280
|
+
Content.new('ch02.html#S1', 'ch02-html#S1', 'html#s1', 'CH02.1', 2),
|
281
|
+
Content.new('ch02.html#S1.1', 'ch02-html#S1-1', '1', 'CH02.1.1', 3),
|
282
|
+
Content.new('ch02.html#S1.1.1', 'ch02-html#S1-1-1', '1', 'CH02.1.1.1', 4),
|
283
|
+
Content.new('ch02.html#S1.1.1.1', 'ch02-html#S1-1-1-1', '1', 'CH02.1.1.1.1', 5),
|
284
|
+
Content.new('ch02.html#S1.1.2', 'ch02-html#S1-1-2', '2', 'CH02.1.1.2', 4),
|
285
|
+
Content.new('ch02.html#S2', 'ch02-html#S2', 'html#s2', 'CH02.2', 2),
|
286
|
+
Content.new('ch02.html#S2.1', 'ch02-html#S2-1', '1', 'CH02.2.1', 3),
|
287
|
+
Content.new('ch03.html', 'ch03-html', 'application/xhtml+xml', 'CH03', 1, nil, ['mathml']),
|
288
|
+
Content.new('ch03.html#S1', 'ch03-html#S1', 'html#s1', 'CH03.1', 2),
|
289
|
+
Content.new('ch03.html#S1.1', 'ch03-html#S1-1', '1', 'CH03.1.1', 3),
|
290
|
+
Content.new('ch04.html', 'ch04-html', 'application/xhtml+xml', 'CH04', 1),
|
291
|
+
Content.new('sample.png', 'sample-png', 'image/png'),
|
292
|
+
Content.new('sample.jpg', 'sample-jpg', 'image/jpeg'),
|
293
|
+
Content.new('sample.JPEG', 'sample-JPEG', 'image/jpeg'),
|
294
|
+
Content.new('sample.SvG', 'sample-SvG', 'image/svg+xml'),
|
295
|
+
Content.new('sample.GIF', 'sample-GIF', 'image/gif'),
|
296
|
+
Content.new('sample.css', 'sample-css', 'text/css')
|
295
297
|
]
|
296
298
|
|
297
299
|
assert_equal expect, @producer.contents
|
@@ -403,7 +405,7 @@ EOT
|
|
403
405
|
end
|
404
406
|
|
405
407
|
def test_stage3_flat
|
406
|
-
@producer.
|
408
|
+
@producer.merge_config('epubmaker' => { 'flattoc' => true, 'flattocindent' => false })
|
407
409
|
stage3
|
408
410
|
@producer.mytoc(@output)
|
409
411
|
expect = <<EOT
|
@@ -454,7 +456,7 @@ EOT
|
|
454
456
|
|
455
457
|
def test_stage3_cover_with_image
|
456
458
|
stage3
|
457
|
-
@producer.
|
459
|
+
@producer.config['coverimage'] = 'sample.png'
|
458
460
|
@producer.cover(@output)
|
459
461
|
expect = <<EOT
|
460
462
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -476,8 +478,8 @@ EOT
|
|
476
478
|
end
|
477
479
|
|
478
480
|
def test_colophon_default
|
479
|
-
@producer.
|
480
|
-
@producer.
|
481
|
+
@producer.config['aut'] = ['Mr.Smith']
|
482
|
+
@producer.config['pbl'] = ['BLUEPRINT']
|
481
483
|
@producer.colophon(@output)
|
482
484
|
expect = <<EOT
|
483
485
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -506,9 +508,9 @@ EOT
|
|
506
508
|
end
|
507
509
|
|
508
510
|
def test_colophon_pht
|
509
|
-
@producer.
|
510
|
-
@producer.
|
511
|
-
@producer.
|
511
|
+
@producer.config['aut'] = ['Mr.Smith']
|
512
|
+
@producer.config['pbl'] = ['BLUEPRINT']
|
513
|
+
@producer.config['pht'] = ['Mrs.Smith']
|
512
514
|
@producer.colophon(@output)
|
513
515
|
expect = <<EOT
|
514
516
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -538,11 +540,11 @@ EOT
|
|
538
540
|
end
|
539
541
|
|
540
542
|
def test_colophon_history
|
541
|
-
@producer.
|
542
|
-
@producer.
|
543
|
-
@producer.
|
544
|
-
@producer.
|
545
|
-
history = @producer.instance_eval{ @epub.colophon_history }
|
543
|
+
@producer.config['aut'] = ['Mr.Smith']
|
544
|
+
@producer.config['pbl'] = ['BLUEPRINT']
|
545
|
+
@producer.config['pht'] = ['Mrs.Smith']
|
546
|
+
@producer.merge_config('language' => 'ja')
|
547
|
+
history = @producer.instance_eval { @epub.colophon_history }
|
546
548
|
expect = <<EOT
|
547
549
|
<div class="pubhistory">
|
548
550
|
<p>2011年1月1日 発行</p>
|
@@ -552,15 +554,14 @@ EOT
|
|
552
554
|
end
|
553
555
|
|
554
556
|
def test_colophon_history_2
|
555
|
-
@producer.
|
556
|
-
@producer.
|
557
|
-
@producer.
|
558
|
-
@producer.
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
history = @producer.instance_eval{ @epub.colophon_history }
|
557
|
+
@producer.config['aut'] = ['Mr.Smith']
|
558
|
+
@producer.config['pbl'] = ['BLUEPRINT']
|
559
|
+
@producer.config['pht'] = ['Mrs.Smith']
|
560
|
+
@producer.merge_config(
|
561
|
+
'language' => 'ja',
|
562
|
+
'history' => [['2011-08-03 v1.0.0版発行', '2012-02-15 v1.1.0版発行']]
|
563
|
+
)
|
564
|
+
history = @producer.instance_eval { @epub.colophon_history }
|
564
565
|
expect = <<EOT
|
565
566
|
<div class="pubhistory">
|
566
567
|
<p>2011年8月3日 v1.0.0版発行</p>
|
@@ -571,15 +572,14 @@ EOT
|
|
571
572
|
end
|
572
573
|
|
573
574
|
def test_colophon_history_date
|
574
|
-
@producer.
|
575
|
-
@producer.
|
576
|
-
@producer.
|
577
|
-
@producer.
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
history = @producer.instance_eval{ @epub.colophon_history }
|
575
|
+
@producer.config['aut'] = ['Mr.Smith']
|
576
|
+
@producer.config['pbl'] = ['BLUEPRINT']
|
577
|
+
@producer.config['pht'] = ['Mrs.Smith']
|
578
|
+
@producer.merge_config(
|
579
|
+
'language' => 'ja',
|
580
|
+
'history' => [['2011-08-03', '2012-02-15']]
|
581
|
+
)
|
582
|
+
history = @producer.instance_eval { @epub.colophon_history }
|
583
583
|
expect = <<EOT
|
584
584
|
<div class="pubhistory">
|
585
585
|
<p>2011年8月3日 初版第1刷 発行</p>
|
@@ -590,19 +590,16 @@ EOT
|
|
590
590
|
end
|
591
591
|
|
592
592
|
def test_colophon_history_date2
|
593
|
-
@producer.
|
594
|
-
@producer.
|
595
|
-
@producer.
|
596
|
-
@producer.
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
"2013-03-01",
|
604
|
-
]] })
|
605
|
-
history = @producer.instance_eval{ @epub.colophon_history }
|
593
|
+
@producer.config['aut'] = ['Mr.Smith']
|
594
|
+
@producer.config['pbl'] = ['BLUEPRINT']
|
595
|
+
@producer.config['pht'] = ['Mrs.Smith']
|
596
|
+
@producer.merge_config(
|
597
|
+
'language' => 'ja',
|
598
|
+
'history' => [['2011-08-03', '2012-02-15'],
|
599
|
+
['2012-10-01'],
|
600
|
+
['2013-03-01']]
|
601
|
+
)
|
602
|
+
history = @producer.instance_eval { @epub.colophon_history }
|
606
603
|
expect = <<EOT
|
607
604
|
<div class="pubhistory">
|
608
605
|
<p>2011年8月3日 初版第1刷 発行</p>
|
@@ -617,7 +614,7 @@ EOT
|
|
617
614
|
def test_detect_mathml
|
618
615
|
Dir.mktmpdir do |dir|
|
619
616
|
epubmaker = ReVIEW::EPUBMaker.new
|
620
|
-
path = File.join(dir,
|
617
|
+
path = File.join(dir, 'test.html')
|
621
618
|
html = <<EOT
|
622
619
|
<?xml version="1.0" encoding="UTF-8"?>
|
623
620
|
<!DOCTYPE html>
|
@@ -629,22 +626,20 @@ EOT
|
|
629
626
|
</head>
|
630
627
|
<body>
|
631
628
|
<div>
|
632
|
-
<p><span class
|
629
|
+
<p><span class="equation"><math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mfrac><mrow><mo stretchy='false'>-</mo><mi>b</mi><mo stretchy='false'>±</mo><msqrt><mrow><msup><mi>b</mi><mn>2</mn></msup><mo stretchy='false'>-</mo><mn>4</mn><mi>a</mi><mi>c</mi></mrow></msqrt></mrow><mrow><mn>2</mn><mi>a</mi></mrow></mfrac></math></span></p>
|
633
630
|
</div>
|
634
631
|
</body>
|
635
632
|
</html>
|
636
633
|
EOT
|
637
|
-
File.open(path,
|
638
|
-
|
639
|
-
end
|
640
|
-
assert_equal ["mathml"], epubmaker.detect_properties(path)
|
634
|
+
File.open(path, 'w') { |f| f.write(html) }
|
635
|
+
assert_equal ['mathml'], epubmaker.detect_properties(path)
|
641
636
|
end
|
642
637
|
end
|
643
638
|
|
644
639
|
def test_detect_mathml_ns
|
645
640
|
Dir.mktmpdir do |dir|
|
646
641
|
epubmaker = ReVIEW::EPUBMaker.new
|
647
|
-
path = File.join(dir,
|
642
|
+
path = File.join(dir, 'test.html')
|
648
643
|
html = <<EOT
|
649
644
|
<?xml version="1.0" encoding="UTF-8"?>
|
650
645
|
<!DOCTYPE html>
|
@@ -656,15 +651,39 @@ EOT
|
|
656
651
|
</head>
|
657
652
|
<body>
|
658
653
|
<div>
|
659
|
-
<p><span class
|
654
|
+
<p><span class="equation"><m:math xmlns:m='http://www.w3.org/1998/Math/MathML' display='inline'><m:mfrac><m:mrow><m:mo stretchy='false'>-</m:mo><m:mi>b</m:mi><m:mo stretchy='false'>±</m:mo><m:msqrt><m:mrow><m:msup><m:mi>b</m:mi><m:mn>2</m:mn></m:msup><m:mo stretchy='false'>-</m:mo><m:mn>4</m:mn><m:mi>a</m:mi><m:mi>c</m:mi></m:mrow></m:msqrt></m:mrow><m:mrow><m:mn>2</m:mn><m:mi>a</m:mi></m:mrow></m:mfrac></m:math></span></p>
|
660
655
|
</div>
|
661
656
|
</body>
|
662
657
|
</html>
|
663
658
|
EOT
|
664
|
-
File.open(path,
|
665
|
-
|
659
|
+
File.open(path, 'w') { |f| f.write(html) }
|
660
|
+
assert_equal ['mathml'], epubmaker.detect_properties(path)
|
661
|
+
end
|
662
|
+
end
|
663
|
+
|
664
|
+
def test_image_size
|
665
|
+
begin
|
666
|
+
require 'image_size'
|
667
|
+
rescue LoadError
|
668
|
+
$stderr.puts 'skip test_image_size (cannot find image_size.rb)'
|
669
|
+
return true
|
670
|
+
end
|
671
|
+
epubmaker = ReVIEW::EPUBMaker.new
|
672
|
+
epubmaker.instance_eval do
|
673
|
+
def warn(msg)
|
674
|
+
$stderr.puts msg
|
666
675
|
end
|
667
|
-
assert_equal ["mathml"], epubmaker.detect_properties(path)
|
668
676
|
end
|
677
|
+
_out, err = capture_output do
|
678
|
+
epubmaker.check_image_size(assets_dir, 5500, %w[png gif jpg jpeg svg ttf woff otf])
|
679
|
+
end
|
680
|
+
|
681
|
+
expected = <<-EOS
|
682
|
+
large.gif: 250x150 exceeds a limit. suggeted value is 95x57
|
683
|
+
large.jpg: 250x150 exceeds a limit. suggeted value is 95x57
|
684
|
+
large.png: 250x150 exceeds a limit. suggeted value is 95x57
|
685
|
+
large.svg: 250x150 exceeds a limit. suggeted value is 95x57
|
686
|
+
EOS
|
687
|
+
assert_equal expected, err
|
669
688
|
end
|
670
689
|
end
|
data/test/test_epubmaker.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'test_helper'
|
4
2
|
require 'epubmaker'
|
5
3
|
|
@@ -8,14 +6,15 @@ class EPUBMakerTest < Test::Unit::TestCase
|
|
8
6
|
|
9
7
|
def setup
|
10
8
|
@producer = Producer.new
|
11
|
-
@producer.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
@producer.merge_config(
|
10
|
+
'bookname' => 'sample',
|
11
|
+
'title' => 'Sample Book',
|
12
|
+
'epubversion' => 2,
|
13
|
+
'urnid' => 'http://example.jp/',
|
14
|
+
'date' => '2011-01-01',
|
15
|
+
'language' => 'en',
|
16
|
+
'titlepage' => nil
|
17
|
+
)
|
19
18
|
@output = StringIO.new
|
20
19
|
end
|
21
20
|
|
@@ -24,18 +23,18 @@ class EPUBMakerTest < Test::Unit::TestCase
|
|
24
23
|
end
|
25
24
|
|
26
25
|
def test_resource_en
|
27
|
-
@producer.
|
28
|
-
assert_equal
|
26
|
+
@producer.merge_config('language' => 'en')
|
27
|
+
assert_equal 'Table of Contents', @producer.res.v('toctitle')
|
29
28
|
end
|
30
29
|
|
31
30
|
def test_resource_ja
|
32
|
-
@producer.
|
33
|
-
assert_equal
|
31
|
+
@producer.merge_config('language' => 'ja')
|
32
|
+
assert_equal '目次', @producer.res.v('toctitle')
|
34
33
|
end
|
35
34
|
|
36
35
|
def test_mimetype
|
37
36
|
@producer.mimetype(@output)
|
38
|
-
assert_equal
|
37
|
+
assert_equal 'application/epub+zip', @output.string
|
39
38
|
end
|
40
39
|
|
41
40
|
def test_container
|
@@ -78,7 +77,7 @@ EOT
|
|
78
77
|
end
|
79
78
|
|
80
79
|
def test_stage1_opf_escape
|
81
|
-
@producer.
|
80
|
+
@producer.config['title'] = 'Sample<>Book'
|
82
81
|
@producer.opf(@output)
|
83
82
|
expect = <<EOT
|
84
83
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -135,7 +134,7 @@ EOT
|
|
135
134
|
end
|
136
135
|
|
137
136
|
def test_stage1_ncx_escape
|
138
|
-
@producer.
|
137
|
+
@producer.config['title'] = 'Sample<>Book'
|
139
138
|
@producer.ncx(@output)
|
140
139
|
expect = <<EOT
|
141
140
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -167,15 +166,15 @@ EOT
|
|
167
166
|
|
168
167
|
def stage2
|
169
168
|
# add one item
|
170
|
-
@producer.contents << Content.new({
|
169
|
+
@producer.contents << Content.new({ 'file' => 'ch01.html', 'title' => 'CH01', 'level' => 1 })
|
171
170
|
end
|
172
171
|
|
173
172
|
def test_stage2_add_l1item
|
174
173
|
stage2
|
175
|
-
expect = EPUBMaker::Content.new(
|
176
|
-
|
177
|
-
|
178
|
-
|
174
|
+
expect = EPUBMaker::Content.new('ch01.html',
|
175
|
+
'ch01-html',
|
176
|
+
'application/xhtml+xml',
|
177
|
+
'CH01',
|
179
178
|
1)
|
180
179
|
assert_equal expect, @producer.contents[0]
|
181
180
|
end
|
@@ -248,49 +247,49 @@ EOT
|
|
248
247
|
|
249
248
|
def stage3
|
250
249
|
# add more items
|
251
|
-
@producer.contents << Content.new({
|
252
|
-
@producer.contents << Content.new({
|
253
|
-
@producer.contents << Content.new({
|
254
|
-
@producer.contents << Content.new({
|
255
|
-
@producer.contents << Content.new({
|
256
|
-
@producer.contents << Content.new({
|
257
|
-
@producer.contents << Content.new({
|
258
|
-
@producer.contents << Content.new({
|
259
|
-
@producer.contents << Content.new({
|
260
|
-
@producer.contents << Content.new({
|
261
|
-
@producer.contents << Content.new({
|
262
|
-
@producer.contents << Content.new({
|
263
|
-
@producer.contents << Content.new({
|
264
|
-
@producer.contents << Content.new({
|
265
|
-
@producer.contents << Content.new({
|
266
|
-
@producer.contents << Content.new({
|
267
|
-
@producer.contents << Content.new({
|
268
|
-
@producer.contents << Content.new({
|
269
|
-
@producer.contents << Content.new({
|
250
|
+
@producer.contents << Content.new({ 'file' => 'ch01.html', 'title' => %Q(CH01<>&"), 'level' => 1 })
|
251
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html', 'title' => 'CH02', 'level' => 1 })
|
252
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html#S1', 'title' => 'CH02.1', 'level' => 2 })
|
253
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html#S1.1', 'title' => 'CH02.1.1', 'level' => 3 })
|
254
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html#S1.1.1', 'title' => 'CH02.1.1.1', 'level' => 4 })
|
255
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html#S1.1.1.1', 'title' => 'CH02.1.1.1.1', 'level' => 5 })
|
256
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html#S1.1.2', 'title' => 'CH02.1.1.2', 'level' => 4 })
|
257
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html#S2', 'title' => 'CH02.2', 'level' => 2 })
|
258
|
+
@producer.contents << Content.new({ 'file' => 'ch02.html#S2.1', 'title' => 'CH02.2.1', 'level' => 3 })
|
259
|
+
@producer.contents << Content.new({ 'file' => 'ch03.html', 'title' => 'CH03', 'level' => 1 })
|
260
|
+
@producer.contents << Content.new({ 'file' => 'ch03.html#S1', 'title' => 'CH03.1', 'level' => 2 })
|
261
|
+
@producer.contents << Content.new({ 'file' => 'ch03.html#S1.1', 'title' => 'CH03.1.1', 'level' => 3 })
|
262
|
+
@producer.contents << Content.new({ 'file' => 'ch04.html', 'title' => 'CH04', 'level' => 1 })
|
263
|
+
@producer.contents << Content.new({ 'file' => 'sample.png' })
|
264
|
+
@producer.contents << Content.new({ 'file' => 'sample.jpg' })
|
265
|
+
@producer.contents << Content.new({ 'file' => 'sample.JPEG' })
|
266
|
+
@producer.contents << Content.new({ 'file' => 'sample.SvG' })
|
267
|
+
@producer.contents << Content.new({ 'file' => 'sample.GIF' })
|
268
|
+
@producer.contents << Content.new({ 'file' => 'sample.css' })
|
270
269
|
end
|
271
270
|
|
272
271
|
def test_stage3_add_various_items
|
273
272
|
stage3
|
274
273
|
expect = [
|
275
|
-
Content.new(
|
276
|
-
Content.new(
|
277
|
-
Content.new(
|
278
|
-
Content.new(
|
279
|
-
Content.new(
|
280
|
-
Content.new(
|
281
|
-
Content.new(
|
282
|
-
Content.new(
|
283
|
-
Content.new(
|
284
|
-
Content.new(
|
285
|
-
Content.new(
|
286
|
-
Content.new(
|
287
|
-
Content.new(
|
288
|
-
Content.new(
|
289
|
-
Content.new(
|
290
|
-
Content.new(
|
291
|
-
Content.new(
|
292
|
-
Content.new(
|
293
|
-
Content.new(
|
274
|
+
Content.new('ch01.html', 'ch01-html', 'application/xhtml+xml', %Q(CH01<>&"), 1),
|
275
|
+
Content.new('ch02.html', 'ch02-html', 'application/xhtml+xml', 'CH02', 1),
|
276
|
+
Content.new('ch02.html#S1', 'ch02-html#S1', 'html#s1', 'CH02.1', 2),
|
277
|
+
Content.new('ch02.html#S1.1', 'ch02-html#S1-1', '1', 'CH02.1.1', 3),
|
278
|
+
Content.new('ch02.html#S1.1.1', 'ch02-html#S1-1-1', '1', 'CH02.1.1.1', 4),
|
279
|
+
Content.new('ch02.html#S1.1.1.1', 'ch02-html#S1-1-1-1', '1', 'CH02.1.1.1.1', 5),
|
280
|
+
Content.new('ch02.html#S1.1.2', 'ch02-html#S1-1-2', '2', 'CH02.1.1.2', 4),
|
281
|
+
Content.new('ch02.html#S2', 'ch02-html#S2', 'html#s2', 'CH02.2', 2),
|
282
|
+
Content.new('ch02.html#S2.1', 'ch02-html#S2-1', '1', 'CH02.2.1', 3),
|
283
|
+
Content.new('ch03.html', 'ch03-html', 'application/xhtml+xml', 'CH03', 1),
|
284
|
+
Content.new('ch03.html#S1', 'ch03-html#S1', 'html#s1', 'CH03.1', 2),
|
285
|
+
Content.new('ch03.html#S1.1', 'ch03-html#S1-1', '1', 'CH03.1.1', 3),
|
286
|
+
Content.new('ch04.html', 'ch04-html', 'application/xhtml+xml', 'CH04', 1),
|
287
|
+
Content.new('sample.png', 'sample-png', 'image/png'),
|
288
|
+
Content.new('sample.jpg', 'sample-jpg', 'image/jpeg'),
|
289
|
+
Content.new('sample.JPEG', 'sample-JPEG', 'image/jpeg'),
|
290
|
+
Content.new('sample.SvG', 'sample-SvG', 'image/svg+xml'),
|
291
|
+
Content.new('sample.GIF', 'sample-GIF', 'image/gif'),
|
292
|
+
Content.new('sample.css', 'sample-css', 'text/css')
|
294
293
|
]
|
295
294
|
|
296
295
|
assert_equal expect, @producer.contents
|
@@ -477,7 +476,7 @@ EOT
|
|
477
476
|
end
|
478
477
|
|
479
478
|
def test_stage3_flat
|
480
|
-
@producer.
|
479
|
+
@producer.merge_config('epubmaker' => { 'flattoc' => true, 'flattocindent' => false })
|
481
480
|
stage3
|
482
481
|
@producer.mytoc(@output)
|
483
482
|
expect = <<EOT
|
@@ -528,7 +527,7 @@ EOT
|
|
528
527
|
|
529
528
|
def test_stage3_cover_escape
|
530
529
|
stage3
|
531
|
-
@producer.
|
530
|
+
@producer.config['title'] = 'Sample<>Book'
|
532
531
|
@producer.cover(@output)
|
533
532
|
expect = <<EOT
|
534
533
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -549,7 +548,7 @@ EOT
|
|
549
548
|
|
550
549
|
def test_stage3_cover_with_image
|
551
550
|
stage3
|
552
|
-
@producer.
|
551
|
+
@producer.config['coverimage'] = 'sample.png'
|
553
552
|
@producer.cover(@output)
|
554
553
|
expect = <<EOT
|
555
554
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -572,8 +571,8 @@ EOT
|
|
572
571
|
|
573
572
|
def test_stage3_cover_with_image_escape
|
574
573
|
stage3
|
575
|
-
@producer.
|
576
|
-
@producer.
|
574
|
+
@producer.config['title'] = 'Sample<>Book'
|
575
|
+
@producer.config['coverimage'] = 'sample.png'
|
577
576
|
@producer.cover(@output)
|
578
577
|
expect = <<EOT
|
579
578
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -595,9 +594,9 @@ EOT
|
|
595
594
|
end
|
596
595
|
|
597
596
|
def test_colophon_default
|
598
|
-
@producer.
|
599
|
-
@producer.
|
600
|
-
@producer.
|
597
|
+
@producer.config['aut'] = ['Mr.Smith']
|
598
|
+
@producer.config['pbl'] = ['BLUEPRINT']
|
599
|
+
@producer.config['isbn'] = '9784797372274'
|
601
600
|
@producer.colophon(@output)
|
602
601
|
expect = <<EOT
|
603
602
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -627,12 +626,12 @@ EOT
|
|
627
626
|
end
|
628
627
|
|
629
628
|
def test_colophon_default_escape_and_multiple
|
630
|
-
@producer.
|
631
|
-
@producer.
|
632
|
-
@producer.
|
633
|
-
@producer.
|
634
|
-
@producer.
|
635
|
-
@producer.
|
629
|
+
@producer.config['title'] = '<&Sample Book>'
|
630
|
+
@producer.config['subtitle'] = 'Sample<>Subtitle'
|
631
|
+
@producer.config['aut'] = ['Mr.Smith', 'Mr.&Anderson']
|
632
|
+
@producer.config['pbl'] = ['BLUEPRINT', 'COPY<>EDIT']
|
633
|
+
@producer.config['isbn'] = '9784797372274'
|
634
|
+
@producer.config['rights'] = ['COPYRIGHT 2016 <>', '& REVIEW']
|
636
635
|
@producer.colophon(@output)
|
637
636
|
expect = <<EOT
|
638
637
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -663,22 +662,19 @@ EOT
|
|
663
662
|
end
|
664
663
|
|
665
664
|
def test_colophon_history
|
666
|
-
@producer.
|
667
|
-
@producer.
|
668
|
-
@producer.
|
669
|
-
@producer.
|
670
|
-
@producer.
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
"2013-03-01",
|
677
|
-
]]
|
678
|
-
epub = @producer.instance_eval{@epub}
|
665
|
+
@producer.config['aut'] = ['Mr.Smith']
|
666
|
+
@producer.config['pbl'] = ['BLUEPRINT']
|
667
|
+
@producer.config['pht'] = ['Mrs.Smith']
|
668
|
+
@producer.merge_config('language' => 'ja')
|
669
|
+
@producer.config['history'] =
|
670
|
+
[['2011-08-03',
|
671
|
+
'2012-02-15'],
|
672
|
+
['2012-10-01'],
|
673
|
+
['2013-03-01']]
|
674
|
+
epub = @producer.instance_eval { @epub }
|
679
675
|
result = epub.colophon_history
|
680
676
|
expect = <<-EOT
|
681
|
-
<div class
|
677
|
+
<div class="pubhistory">
|
682
678
|
<p>2011年8月3日 初版第1刷 発行</p>
|
683
679
|
<p>2012年2月15日 初版第2刷 発行</p>
|
684
680
|
<p>2012年10月1日 第2版第1刷 発行</p>
|
@@ -689,22 +685,19 @@ EOT
|
|
689
685
|
end
|
690
686
|
|
691
687
|
def test_colophon_history_freeformat
|
692
|
-
@producer.
|
693
|
-
@producer.
|
694
|
-
@producer.
|
695
|
-
@producer.
|
696
|
-
@producer.
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
]]
|
703
|
-
|
704
|
-
epub = @producer.instance_eval{@epub}
|
688
|
+
@producer.config['aut'] = ['Mr.Smith']
|
689
|
+
@producer.config['pbl'] = ['BLUEPRINT']
|
690
|
+
@producer.config['pht'] = ['Mrs.Smith']
|
691
|
+
@producer.merge_config('language' => 'ja')
|
692
|
+
@producer.config['history'] =
|
693
|
+
[['2011年8月3日 ver 1.1.0発行'],
|
694
|
+
['2011年10月12日 ver 1.2.0発行'],
|
695
|
+
['2012年1月31日 ver 1.2.1発行']]
|
696
|
+
|
697
|
+
epub = @producer.instance_eval { @epub }
|
705
698
|
result = epub.colophon_history
|
706
699
|
expect = <<-EOT
|
707
|
-
<div class
|
700
|
+
<div class="pubhistory">
|
708
701
|
<p>2011年8月3日 ver 1.1.0発行</p>
|
709
702
|
<p>2011年10月12日 ver 1.2.0発行</p>
|
710
703
|
<p>2012年1月31日 ver 1.2.1発行</p>
|
@@ -714,9 +707,9 @@ EOT
|
|
714
707
|
end
|
715
708
|
|
716
709
|
def test_colophon_pht
|
717
|
-
@producer.
|
718
|
-
@producer.
|
719
|
-
@producer.
|
710
|
+
@producer.config['aut'] = ['Mr.Smith']
|
711
|
+
@producer.config['pbl'] = ['BLUEPRINT']
|
712
|
+
@producer.config['pht'] = ['Mrs.Smith']
|
720
713
|
@producer.colophon(@output)
|
721
714
|
expect = <<EOT
|
722
715
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -746,23 +739,23 @@ EOT
|
|
746
739
|
end
|
747
740
|
|
748
741
|
def test_isbn13
|
749
|
-
@producer.
|
750
|
-
assert_equal
|
742
|
+
@producer.config['isbn'] = '9784797372274'
|
743
|
+
assert_equal '978-4-79737-227-4', @producer.isbn_hyphen
|
751
744
|
end
|
752
745
|
|
753
746
|
def test_isbn10
|
754
|
-
@producer.
|
755
|
-
assert_equal
|
747
|
+
@producer.config['isbn'] = '4797372273'
|
748
|
+
assert_equal '4-79737-227-3', @producer.isbn_hyphen
|
756
749
|
end
|
757
750
|
|
758
751
|
def test_isbn_nil
|
759
|
-
@producer.
|
752
|
+
@producer.config['isbn'] = nil
|
760
753
|
assert_equal nil, @producer.isbn_hyphen
|
761
754
|
end
|
762
755
|
|
763
756
|
def test_title
|
764
|
-
@producer.
|
765
|
-
@producer.
|
757
|
+
@producer.config['aut'] = ['Mr.Smith']
|
758
|
+
@producer.config['pbl'] = ['BLUEPRINT']
|
766
759
|
@producer.titlepage(@output)
|
767
760
|
expect = <<EOT
|
768
761
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -794,8 +787,8 @@ EOT
|
|
794
787
|
end
|
795
788
|
|
796
789
|
def test_title_single_value_param
|
797
|
-
@producer.
|
798
|
-
@producer.
|
790
|
+
@producer.config['aut'] = 'Mr.Smith'
|
791
|
+
@producer.config['pbl'] = 'BLUEPRINT'
|
799
792
|
@producer.titlepage(@output)
|
800
793
|
expect = <<EOT
|
801
794
|
<?xml version="1.0" encoding="UTF-8"?>
|