review 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +42 -0
  3. data/README.rdoc +31 -0
  4. data/bin/review-catalog-converter +129 -0
  5. data/bin/review-check +4 -2
  6. data/bin/review-compile +7 -7
  7. data/bin/review-index +4 -3
  8. data/bin/review-init +3 -1
  9. data/bin/review-pdfmaker +2 -258
  10. data/bin/review-vol +2 -2
  11. data/doc/catalog.rdoc +18 -3
  12. data/doc/format.rdoc +2 -3
  13. data/doc/quickstart.rdoc +1 -1
  14. data/lib/epubmaker/epubv2.rb +16 -8
  15. data/lib/epubmaker/epubv3.rb +44 -12
  16. data/lib/epubmaker/producer.rb +4 -2
  17. data/lib/review/book.rb +0 -1
  18. data/lib/review/book/base.rb +72 -35
  19. data/lib/review/book/chapter.rb +8 -12
  20. data/lib/review/book/compilable.rb +8 -8
  21. data/lib/review/book/image_finder.rb +7 -0
  22. data/lib/review/book/index.rb +23 -5
  23. data/lib/review/book/volume.rb +2 -1
  24. data/lib/review/builder.rb +10 -5
  25. data/lib/review/catalog.rb +5 -0
  26. data/lib/review/compiler.rb +1 -1
  27. data/lib/review/configure.rb +12 -0
  28. data/lib/review/epubmaker.rb +13 -7
  29. data/lib/review/htmlbuilder.rb +26 -12
  30. data/lib/review/i18n.rb +2 -2
  31. data/lib/review/i18n.yml +21 -0
  32. data/lib/review/idgxmlbuilder.rb +11 -9
  33. data/lib/review/latexbuilder.rb +3 -2
  34. data/lib/review/{review.tex.erb → layout.tex.erb} +9 -1
  35. data/lib/review/markdownbuilder.rb +126 -4
  36. data/lib/review/pdfmaker.rb +291 -0
  37. data/lib/review/tocparser.rb +6 -5
  38. data/lib/review/tocprinter.rb +5 -2
  39. data/lib/review/version.rb +1 -1
  40. data/review.gemspec +1 -1
  41. data/rubocop-todo.yml +13 -0
  42. data/test/test_book.rb +95 -133
  43. data/test/test_book_chapter.rb +16 -21
  44. data/test/test_builder.rb +12 -7
  45. data/test/test_catalog.rb +15 -3
  46. data/test/test_catalog_converter_cmd.rb +73 -0
  47. data/test/test_epubmaker.rb +5 -5
  48. data/test/test_helper.rb +32 -21
  49. data/test/test_htmlbuilder.rb +219 -192
  50. data/test/test_i18n.rb +46 -19
  51. data/test/test_idgxmlbuilder.rb +177 -182
  52. data/test/test_inaobuilder.rb +1 -2
  53. data/test/test_index.rb +20 -0
  54. data/test/test_latexbuilder.rb +175 -183
  55. data/test/test_markdownbuilder.rb +41 -5
  56. data/test/test_pdfmaker.rb +130 -0
  57. data/test/test_topbuilder.rb +92 -96
  58. metadata +10 -6
  59. data/lib/review/book/parameters.rb +0 -98
  60. data/test/test_book_parameter.rb +0 -42
@@ -21,14 +21,14 @@ module ReVIEW
21
21
  def TOCParser.parse(chap)
22
22
  chap.open {|f|
23
23
  stream = Preprocessor::Strip.new(f)
24
- new.parse(stream, chap.id, chap.path).map {|root|
24
+ new.parse(stream, chap.id, chap.path, chap).map {|root|
25
25
  root.number = chap.number
26
26
  root
27
27
  }
28
28
  }
29
29
  end
30
30
 
31
- def parse(f, id, filename)
31
+ def parse(f, id, filename, chap)
32
32
  roots = []
33
33
  path = []
34
34
 
@@ -80,7 +80,7 @@ module ReVIEW
80
80
  # error! filename, f.lineno, 'text found before section label'
81
81
  #end
82
82
  next if path.empty?
83
- path.last.add_child(par = Paragraph.new)
83
+ path.last.add_child(par = Paragraph.new(chap.book.page_metric))
84
84
  par.add line
85
85
  while line = f.gets
86
86
  break if /\A\s*\z/ =~ line
@@ -239,8 +239,9 @@ module ReVIEW
239
239
 
240
240
  class Paragraph < Node
241
241
 
242
- def initialize
242
+ def initialize(page_metric)
243
243
  @bytes = 0
244
+ @page_metric = page_metric
244
245
  end
245
246
 
246
247
  def inspect
@@ -252,7 +253,7 @@ module ReVIEW
252
253
  end
253
254
 
254
255
  def estimated_lines
255
- (@bytes + 2) / ReVIEW.book.page_metric.text.n_columns + 1
256
+ (@bytes + 2) / @page_metric.text.n_columns + 1
256
257
  end
257
258
 
258
259
  def yield_section
@@ -126,9 +126,12 @@ module ReVIEW
126
126
  end
127
127
  end
128
128
  end
129
+ layout_file = File.join(book.basedir, "layouts", "layout.html.erb")
130
+ unless File.exist?(layout_file) # backward compatibility
131
+ layout_file = File.join(book.basedir, "layouts", "layout.erb")
132
+ end
129
133
  puts HTMLLayout.new(
130
- {'body' => html, 'title' => "目次"},
131
- File.join(book.basedir, "layouts", "layout.erb")).result
134
+ {'body' => html, 'title' => "目次"}, layout_file).result
132
135
  end
133
136
 
134
137
  private
@@ -1,3 +1,3 @@
1
1
  module ReVIEW
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.summary = "Re:VIEW: a easy-to-use digital publishing system"
14
14
  gem.description = "Re:VIEW is a digital publishing system for books and ebooks. It supports InDesign, EPUB and LaTeX."
15
15
  gem.required_rubygems_version = Gem::Requirement.new(">= 0") if gem.respond_to? :required_rubygems_version=
16
- gem.date = "2014-06-29"
16
+ gem.date = "2014-10-29"
17
17
 
18
18
  gem.files = `git ls-files`.split("\n")
19
19
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -441,3 +441,16 @@ WhileUntilModifier:
441
441
  # Cop supports --auto-correct.
442
442
  WordArray:
443
443
  MinSize: 7
444
+
445
+ BarePercentLiterals:
446
+ Enabled: false
447
+
448
+ UnusedMethodArgument:
449
+ Enabled: false
450
+
451
+ PercentQLiterals:
452
+ Enabled: false
453
+
454
+ UnneededPercentQ:
455
+ Enabled: false
456
+
@@ -34,15 +34,6 @@ class BookTest < Test::Unit::TestCase
34
34
  end
35
35
  end
36
36
 
37
- def test_s_load
38
- Dir.mktmpdir do |dir|
39
- book = Book.load(dir)
40
- defs = get_instance_variables(Book::Parameters.default)
41
- pars = get_instance_variables(book.instance_eval { @parameters })
42
- assert_equal defs, pars
43
- end
44
- end
45
-
46
37
  def test_s_update_rubyenv
47
38
  save_load_path = $LOAD_PATH.dup
48
39
 
@@ -124,6 +115,52 @@ class BookTest < Test::Unit::TestCase
124
115
  end
125
116
  end
126
117
 
118
+ def test_read_APPENDIX
119
+ Dir.mktmpdir do |dir|
120
+ book = Book::Base.new(dir)
121
+ assert_equal "", book.read_APPENDIX
122
+
123
+ post_path = File.join(dir, 'POSTDEF')
124
+ re1_path = File.join(dir, "123#{book.ext}")
125
+ re2_path = File.join(dir, "456#{book.ext}")
126
+
127
+ File.open(post_path, 'w') {|o| o.print "abc\n" }
128
+ File.open(re1_path, 'w') {|o| o.print "123\n" }
129
+ File.open(re2_path, 'w') {|o| o.print "456\n" }
130
+
131
+ assert_equal "abc\n", book.read_APPENDIX
132
+
133
+ File.unlink(post_path)
134
+ assert_equal "#{re1_path}\n#{re2_path}", book.read_APPENDIX
135
+
136
+ File.unlink(re1_path)
137
+ assert_equal "#{re2_path}", book.read_APPENDIX
138
+
139
+ File.unlink(re2_path)
140
+ assert_equal "", book.read_APPENDIX
141
+ end
142
+ end
143
+
144
+ def test_read_POSTDEF
145
+ Dir.mktmpdir do |dir|
146
+ book = Book::Base.new(dir)
147
+ assert_equal "", book.read_POSTDEF
148
+
149
+ post_path = File.join(dir, 'POSTDEF')
150
+ re1_path = File.join(dir, "123#{book.ext}")
151
+ re2_path = File.join(dir, "456#{book.ext}")
152
+
153
+ File.open(post_path, 'w') {|o| o.print "abc\n" }
154
+ File.open(re1_path, 'w') {|o| o.print "123\n" }
155
+ File.open(re2_path, 'w') {|o| o.print "456\n" }
156
+
157
+ assert_equal "", book.read_POSTDEF
158
+
159
+ File.unlink(post_path)
160
+ assert_equal "", book.read_POSTDEF
161
+ end
162
+ end
163
+
127
164
  def test_read_bib
128
165
  Dir.mktmpdir do |dir|
129
166
  book = Book::Base.new(dir)
@@ -257,12 +294,11 @@ EOC
257
294
  ].each do |n_parts, chaps_text, parts_text, part_names|
258
295
  n_test += 1
259
296
  Dir.mktmpdir do |dir|
260
- params = Book::Parameters.new(:part_file => 'PARTS')
261
- book = Book::Base.new(dir, params)
297
+ book = Book::Base.new(dir)
262
298
  chaps_path = File.join(dir, 'CHAPS')
263
299
  File.open(chaps_path, 'w') {|o| o.print chaps_text }
264
300
  unless parts_text.nil?
265
- parts_path = File.join(dir, 'PARTS')
301
+ parts_path = File.join(dir, 'PART')
266
302
  File.open(parts_path, 'w') {|o| o.print parts_text }
267
303
  end
268
304
 
@@ -278,17 +314,7 @@ EOC
278
314
  assert_equal nil, book.prefaces
279
315
  end
280
316
 
281
- mktmpbookdir 'preface.re' => '' do |dir, book, files|
282
- assert_kind_of Book::Part, book.prefaces
283
- assert_equal '', book.prefaces.name
284
- assert_equal 1, book.prefaces.chapters.size
285
- assert_equal "preface", book.prefaces.chapters.first.name
286
- assert_equal files['preface.re'], book.prefaces.chapters.first.path
287
- assert_equal nil, book.prefaces.chapters.first.number
288
- end
289
-
290
- mktmpbookdir 'preface.re' => '',
291
- 'PREDEF' => '' do |dir, book, files|
317
+ mktmpbookdir 'PREDEF' => '' do |dir, book, files|
292
318
  assert_equal nil, book.prefaces # XXX: OK?
293
319
  end
294
320
 
@@ -344,83 +370,68 @@ EOC
344
370
  end
345
371
  end
346
372
 
347
- def test_postscripts
373
+ def test_appendix
348
374
  mktmpbookdir do |dir, book, files|
349
- assert_equal nil, book.postscripts
350
- end
351
-
352
- mktmpbookdir 'appendix.re' => '' do |dir, book, files|
353
- assert_kind_of Book::Part, book.postscripts
354
- assert_equal '', book.postscripts.name
355
- assert_equal 1, book.postscripts.chapters.size
356
- assert_equal "appendix", book.postscripts.chapters.first.name
357
- assert_equal files['appendix.re'], book.postscripts.chapters.first.path
358
- assert_equal nil, book.postscripts.chapters.first.number
359
- end
360
-
361
- mktmpbookdir 'postscript.re' => '' do |dir, book, files|
362
- assert_kind_of Book::Part, book.postscripts
363
- assert_equal '', book.postscripts.name
364
- assert_equal 1, book.postscripts.chapters.size
365
- assert_equal "postscript", book.postscripts.chapters.first.name
366
- assert_equal files['postscript.re'], book.postscripts.chapters.first.path
367
- assert_equal nil, book.postscripts.chapters.first.number
368
- end
369
-
370
- mktmpbookdir 'appendix.re' => '',
371
- 'postscript.re' => '' do |dir, book, files|
372
- assert_kind_of Book::Part, book.postscripts
373
- assert_equal '', book.postscripts.name
374
- assert_equal 2, book.postscripts.chapters.size
375
- assert_equal "appendix", book.postscripts.chapters.first.name
376
- assert_equal files['appendix.re'], book.postscripts.chapters.first.path
377
- assert_equal nil, book.postscripts.chapters.first.number
378
- assert_equal "postscript", book.postscripts.chapters.last.name
379
- assert_equal files['postscript.re'], book.postscripts.chapters.last.path
380
- assert_equal nil, book.postscripts.chapters.last.number
381
- end
382
-
383
- mktmpbookdir 'preface.re' => '',
384
- 'POSTDEF' => '' do |dir, book, files|
385
- assert_equal nil, book.postscripts # XXX: OK?
375
+ assert_equal nil, book.appendix
386
376
  end
387
377
 
388
378
  mktmpbookdir 'POSTDEF' => '' do |dir, book, files|
389
- assert_equal nil, book.postscripts
379
+ assert_equal nil, book.appendix
390
380
  end
391
381
 
392
382
  mktmpbookdir 'POSTDEF' => 'chapter1',
393
383
  'chapter1.re' => '' do |dir, book, files|
394
- assert_kind_of Book::Part, book.postscripts
395
- assert_equal '', book.postscripts.name
396
- assert_equal 1, book.postscripts.chapters.size
397
- assert_equal "chapter1", book.postscripts.chapters.first.name
398
- assert_equal files['chapter1.re'], book.postscripts.chapters.first.path
384
+ assert_kind_of Book::Part, book.appendix
385
+ assert_equal '', book.appendix.name
386
+ assert_equal 1, book.appendix.chapters.size
387
+ assert_equal "chapter1", book.appendix.chapters.first.name
388
+ assert_equal files['chapter1.re'], book.appendix.chapters.first.path
389
+ assert_equal 1, book.appendix.chapters.first.number
399
390
  end
400
391
 
401
392
  mktmpbookdir 'POSTDEF' => "chapter1\n\nchapter2",
402
393
  'chapter1.re' => '', 'chapter2.re' => '' do |dir, book, files|
403
- assert_kind_of Book::Part, book.postscripts
404
- assert_equal '', book.postscripts.name
405
- assert_equal 2, book.postscripts.chapters.size
406
- assert_equal "chapter1", book.postscripts.chapters.first.name
407
- assert_equal files['chapter1.re'], book.postscripts.chapters.first.path
408
- assert_equal "chapter2", book.postscripts.chapters.last.name
409
- assert_equal files['chapter2.re'], book.postscripts.chapters.last.path
394
+ assert_kind_of Book::Part, book.appendix
395
+ assert_equal '', book.appendix.name
396
+ assert_equal 2, book.appendix.chapters.size
397
+ assert_equal "chapter1", book.appendix.chapters.first.name
398
+ assert_equal files['chapter1.re'], book.appendix.chapters.first.path
399
+ assert_equal "chapter2", book.appendix.chapters.last.name
400
+ assert_equal files['chapter2.re'], book.appendix.chapters.last.path
401
+ assert_equal 1, book.appendix.chapters.first.number
402
+ assert_equal 2, book.appendix.chapters.last.number
410
403
  end
411
404
 
412
405
  mktmpbookdir 'POSTDEF' => "chapter1 chapter2",
413
406
  'chapter1.re' => '', 'chapter2.re' => '' do |dir, book, files|
414
- assert_kind_of Book::Part, book.postscripts
415
- assert_equal '', book.postscripts.name
416
- assert_equal 2, book.postscripts.chapters.size # XXX: OK?
407
+ assert_kind_of Book::Part, book.appendix
408
+ assert_equal '', book.appendix.name
409
+ assert_equal 2, book.appendix.chapters.size # XXX: OK?
410
+ assert_equal 1, book.appendix.chapters.first.number
411
+ assert_equal 2, book.appendix.chapters.last.number
417
412
  end
418
413
 
419
414
  mktmpbookdir 'POSTDEF' => 'not_exist' do |dir, book, files|
420
415
  assert_raises FileNotFound do
421
- assert_equal nil, book.postscripts
416
+ assert_equal nil, book.appendix
422
417
  end
423
418
  end
419
+
420
+ mktmpbookdir 'catalog.yml' => "APPENDIX:\n - p01.re",
421
+ 'p01.re' => '= appendix' do |dir, book, files|
422
+ assert_equal 'appendix', book.appendix.chapters.first.title
423
+ assert_equal 1, book.appendix.chapters.first.number
424
+ end
425
+ end
426
+
427
+ def test_postscripts
428
+ mktmpbookdir 'catalog.yml' => "POSTDEF:\n - b01.re",
429
+ 'b01.re' => '= back' do |dir, book, files|
430
+ assert_kind_of Book::Part, book.postscripts
431
+ assert_equal 1, book.postscripts.chapters.size
432
+ assert_equal 'back', book.postscripts.chapters.first.title
433
+ assert_equal nil, book.postscripts.chapters.first.number
434
+ end
424
435
  end
425
436
 
426
437
  def test_parts
@@ -446,62 +457,14 @@ EOC
446
457
  book.each_part {|p| tmp << p.number }
447
458
  assert_equal [1, 2], tmp
448
459
  end
449
-
450
- mktmpbookdir 'CHAPS' => "ch1\nch2\n\nch3",
451
- 'preface.re' => '' do |dir, book, files|
452
- parts = book.parts
453
- assert_equal 3, parts.size
454
- assert book.part(1)
455
- assert book.part(2)
456
- assert !book.part(3)
457
- assert book.part(nil) # XXX: OK?
458
- assert_equal 'preface', parts.first.chapters.first.name
459
-
460
- tmp = []
461
- book.each_part {|p| tmp << p.number }
462
- assert_equal [nil, 1, 2], tmp
463
- end
464
-
465
- mktmpbookdir 'CHAPS' => "ch1\nch2\n\nch3",
466
- 'postscript.re' => '' do |dir, book, files|
467
- parts = book.parts
468
- assert_equal 3, parts.size
469
- assert book.part(1)
470
- assert book.part(2)
471
- assert !book.part(3)
472
- assert book.part(nil) # XXX: OK?
473
- assert_equal 'postscript', parts.last.chapters.last.name
474
-
475
- tmp = []
476
- book.each_part {|p| tmp << p.number }
477
- assert_equal [1, 2, nil], tmp
478
- end
479
-
480
- mktmpbookdir 'CHAPS' => "ch1\nch2\n\nch3",
481
- 'preface.re' => '', 'postscript.re' => '' do |dir, book, files|
482
- parts = book.parts
483
- assert_equal 4, parts.size
484
- assert book.part(1)
485
- assert book.part(2)
486
- assert !book.part(3)
487
- assert !book.part(4)
488
- assert book.part(nil) # XXX: OK?
489
- assert_equal 'preface', parts.first.chapters.first.name
490
- assert_equal 'postscript', parts.last.chapters.last.name
491
-
492
- tmp = []
493
- book.each_part {|p| tmp << p.number }
494
- assert_equal [nil, 1, 2, nil], tmp
495
- end
496
460
  end
497
461
 
498
462
  def test_chapters
499
- mktmpbookdir 'CHAPS' => "ch1\nch2\n\nch3",
500
- 'preface.re' => '', 'postscript.re' => '' do |dir, book, files|
463
+ mktmpbookdir 'CHAPS' => "ch1\nch2\n\nch3" do |dir, book, files|
501
464
  chapters = book.chapters
502
- assert_equal 5, chapters.size
465
+ assert_equal 3, chapters.size
503
466
 
504
- ch_names = %w(preface ch1 ch2 ch3 postscript)
467
+ ch_names = %w(ch1 ch2 ch3)
505
468
  tmp = []
506
469
  book.each_chapter {|ch| tmp << ch.name }
507
470
  assert_equal ch_names, tmp
@@ -516,12 +479,11 @@ EOC
516
479
  end
517
480
  end
518
481
 
519
- mktmpbookdir 'CHAPS' => "ch1.txt\nch2.txt\n\nch3.txt",
520
- 'preface.re' => '', 'postscript.re' => '' do |dir, book, files|
482
+ mktmpbookdir 'CHAPS' => "ch1.txt\nch2.txt\n\nch3.txt" do |dir, book, files|
521
483
  chapters = book.chapters
522
- assert_equal 5, chapters.size
484
+ assert_equal 3, chapters.size
523
485
 
524
- ch_names = %w(preface ch1 ch2 ch3 postscript)
486
+ ch_names = %w(ch1 ch2 ch3)
525
487
  tmp = []
526
488
  book.each_chapter {|ch| tmp << ch.name }
527
489
  assert_equal ch_names, tmp
@@ -84,8 +84,7 @@ class ChapterTest < Test::Unit::TestCase
84
84
 
85
85
  dir_files = {
86
86
  'CHAPS' => "ch1.re\n",
87
- 'ch1.re' => 'ch1',
88
- 'preface.re' => 'preface',
87
+ 'ch1.re' => 'ch1'
89
88
  }
90
89
  mktmpbookdir dir_files do |dir, book, files|
91
90
  paths = files.values.grep(/\.re\z/)
@@ -95,14 +94,6 @@ class ChapterTest < Test::Unit::TestCase
95
94
  end
96
95
  end
97
96
 
98
- def test_s_for_stdin
99
- assert Book::Chapter.for_stdin
100
- end
101
-
102
- def test_s_for_path
103
- assert Book::Chapter.for_path(1, __FILE__)
104
- end
105
-
106
97
  def test_initialize
107
98
  ch = Book::Chapter.new(:book, :number, :name, '/foo/bar', :io)
108
99
  assert_equal :book, ch.env
@@ -161,11 +152,12 @@ class ChapterTest < Test::Unit::TestCase
161
152
 
162
153
  def test_title
163
154
  io = StringIO.new
164
- ch = Book::Chapter.new(ReVIEW.book, nil, nil, nil, io)
155
+ book = Book::Base.new(nil)
156
+ ch = Book::Chapter.new(book, nil, nil, nil, io)
165
157
  assert_equal '', ch.title
166
158
 
167
159
  io = StringIO.new("=1\n=2\n")
168
- ch = Book::Chapter.new(ReVIEW.book, nil, nil, nil, io)
160
+ ch = Book::Chapter.new(book, nil, nil, nil, io)
169
161
  assert_equal '1', ch.title
170
162
 
171
163
 
@@ -176,8 +168,8 @@ class ChapterTest < Test::Unit::TestCase
176
168
  ['XYZ', @eucjp_str],
177
169
  ].each do |enc, instr|
178
170
  io = StringIO.new("= #{instr}\n")
179
- ch = Book::Chapter.new(ReVIEW.book, nil, nil, nil, io)
180
- ReVIEW.book.config = {'inencoding' => enc}
171
+ ch = Book::Chapter.new(book, nil, nil, nil, io)
172
+ book.config['inencoding'] = enc
181
173
  assert_equal @utf8_str, ch.title
182
174
  assert_equal @utf8_str, ch.instance_eval { @title }
183
175
  end
@@ -191,12 +183,13 @@ class ChapterTest < Test::Unit::TestCase
191
183
  ['XYZ', @eucjp_str],
192
184
  ].each do |enc, instr|
193
185
  tf = Tempfile.new('chapter_test')
186
+ book = Book::Base.new(nil)
194
187
  begin
195
188
  tf.print instr
196
189
  tf.close
197
190
 
198
- ch = Book::Chapter.new(ReVIEW.book, nil, nil, tf.path)
199
- ReVIEW.book.config = {'inencoding' => enc}
191
+ ch = Book::Chapter.new(book, nil, nil, tf.path)
192
+ book.config['inencoding'] = enc
200
193
  assert_equal @utf8_str, ch.content
201
194
  assert_equal @utf8_str, ch.instance_eval { @content }
202
195
  ensure
@@ -212,8 +205,8 @@ class ChapterTest < Test::Unit::TestCase
212
205
  tf2.puts instr
213
206
  tf1.close
214
207
 
215
- ch = Book::Chapter.new(ReVIEW.book, nil, nil, tf1.path, tf2)
216
- ReVIEW.book.config = {'inencoding' => enc}
208
+ ch = Book::Chapter.new(book, nil, nil, tf1.path, tf2)
209
+ book.config['inencoding'] = enc
217
210
  assert_equal "#{@utf8_str}\n#{@utf8_str}\n", ch.content # XXX: OK?
218
211
  ensure
219
212
  tf1.close(true)
@@ -228,7 +221,8 @@ class ChapterTest < Test::Unit::TestCase
228
221
  tf.print lines.join('')
229
222
  tf.close
230
223
 
231
- ch = Book::Chapter.new(ReVIEW.book, nil, nil, tf.path)
224
+ book = Book::Base.new(nil)
225
+ ch = Book::Chapter.new(book, nil, nil, tf.path)
232
226
  assert_equal lines, ch.lines
233
227
 
234
228
  lines = ["1\n", "2\n", "3"]
@@ -240,7 +234,7 @@ class ChapterTest < Test::Unit::TestCase
240
234
  tf2.puts lines.join('')
241
235
  tf2.close
242
236
 
243
- ch = Book::Chapter.new(ReVIEW.book, nil, nil, tf1.path, tf2.path)
237
+ ch = Book::Chapter.new(book, nil, nil, tf1.path, tf2.path)
244
238
  assert_equal lines, ch.lines # XXX: OK?
245
239
  end
246
240
 
@@ -356,7 +350,8 @@ E
356
350
 
357
351
 
358
352
  def test_column_index
359
- ReVIEW.book.config = {"inencoding" => "utf-8"}
353
+ book = Book::Base.new(nil)
354
+ book.config["inencoding"] = "utf-8"
360
355
  do_test_index(<<E, Book::ColumnIndex, :column_index, :column, :propagate => false)
361
356
  = dummy1
362
357
  ===[column]{abc} aaaa