review 5.1.1 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-tex.yml +5 -1
  3. data/.github/workflows/ruby-win.yml +5 -1
  4. data/.github/workflows/ruby.yml +5 -1
  5. data/.rubocop.yml +6 -2
  6. data/NEWS.ja.md +48 -0
  7. data/NEWS.md +48 -1
  8. data/bin/review-compile +8 -15
  9. data/bin/review-preproc +28 -34
  10. data/doc/config.yml.sample +2 -0
  11. data/doc/writing_vertical.ja.md +6 -0
  12. data/lib/review/builder.rb +34 -40
  13. data/lib/review/compiler.rb +59 -43
  14. data/lib/review/epubmaker.rb +24 -38
  15. data/lib/review/epubmaker/producer.rb +3 -4
  16. data/lib/review/exception.rb +7 -0
  17. data/lib/review/htmlbuilder.rb +51 -20
  18. data/lib/review/idgxmlbuilder.rb +19 -18
  19. data/lib/review/idgxmlmaker.rb +12 -13
  20. data/lib/review/img_math.rb +11 -18
  21. data/lib/review/index_builder.rb +6 -15
  22. data/lib/review/latexbuilder.rb +38 -43
  23. data/lib/review/loggable.rb +27 -0
  24. data/lib/review/logger.rb +48 -0
  25. data/lib/review/makerhelper.rb +5 -1
  26. data/lib/review/markdownbuilder.rb +5 -4
  27. data/lib/review/pdfmaker.rb +23 -21
  28. data/lib/review/plaintextbuilder.rb +8 -8
  29. data/lib/review/preprocessor.rb +94 -296
  30. data/lib/review/preprocessor/directive.rb +35 -0
  31. data/lib/review/preprocessor/line.rb +34 -0
  32. data/lib/review/preprocessor/repository.rb +177 -0
  33. data/lib/review/rstbuilder.rb +1 -1
  34. data/lib/review/template.rb +5 -1
  35. data/lib/review/textmaker.rb +12 -13
  36. data/lib/review/tocprinter.rb +1 -1
  37. data/lib/review/topbuilder.rb +7 -7
  38. data/lib/review/version.rb +1 -1
  39. data/lib/review/webmaker.rb +13 -14
  40. data/review.gemspec +1 -1
  41. data/samples/sample-book/src/lib/tasks/review.rake +3 -1
  42. data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +2 -1
  43. data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +2 -1
  44. data/templates/latex/review-jlreq/review-base.sty +3 -5
  45. data/templates/latex/review-jlreq/review-jlreq.cls +4 -3
  46. data/templates/latex/review-jsbook/review-base.sty +3 -3
  47. data/templates/latex/review-jsbook/review-jsbook.cls +1 -1
  48. data/test/test_builder.rb +8 -8
  49. data/test/test_epubmaker.rb +13 -8
  50. data/test/test_epubmaker_cmd.rb +13 -2
  51. data/test/test_htmlbuilder.rb +68 -26
  52. data/test/test_idgxmlbuilder.rb +31 -23
  53. data/test/test_latexbuilder.rb +30 -22
  54. data/test/test_latexbuilder_v2.rb +18 -10
  55. data/test/test_plaintextbuilder.rb +30 -22
  56. data/test/test_preprocessor.rb +188 -1
  57. data/test/test_topbuilder.rb +26 -18
  58. metadata +12 -8
data/review.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |gem|
26
26
  gem.add_development_dependency('mini_magick')
27
27
  gem.add_development_dependency('pygments.rb')
28
28
  gem.add_development_dependency('rake')
29
- gem.add_development_dependency('rubocop', '~> 1.10.0')
29
+ gem.add_development_dependency('rubocop', '~> 1.12.0')
30
30
  gem.add_development_dependency('rubocop-performance')
31
31
  gem.add_development_dependency('rubocop-rake')
32
32
  gem.add_development_dependency('simplecov')
@@ -130,15 +130,17 @@ file IDGXMLROOT => SRC do
130
130
  FileUtils.rm_rf([IDGXMLROOT])
131
131
  end
132
132
 
133
- desc 'run vivliostyle'
133
+ desc 'preview with vivliostyle'
134
134
  task 'vivliostyle:preview': BOOK_EPUB do
135
135
  sh "#{REVIEW_VSCLI} preview #{REVIEW_VSCLI_USESANDBOX} #{REVIEW_VSCLI_OPTIONS} #{BOOK_EPUB}"
136
136
  end
137
137
 
138
+ desc 'build with vivliostyle'
138
139
  task 'vivliostyle:build': BOOK_EPUB do
139
140
  sh "#{REVIEW_VSCLI} build #{REVIEW_VSCLI_USESANDBOX} #{REVIEW_VSCLI_OPTIONS} -o #{REVIEW_VSCLI_PDF} #{BOOK_EPUB}"
140
141
  end
141
142
 
143
+ desc 'build with vivliostyle'
142
144
  task vivliostyle: 'vivliostyle:build'
143
145
 
144
146
  CLEAN.include([BOOK, BOOK_PDF, BOOK_EPUB, BOOK + '-pdf', BOOK + '-epub', WEBROOT, 'images/_review_math', 'images/_review_math_text', TEXTROOT, IDGXMLROOT])
@@ -1,5 +1,6 @@
1
- desc 'copy sty/* files from current Re:VIEW source code (in git repos)'
2
1
  REVIEW_TEMPLATE = ENV['REVIEW_TEMPLATE'] || 'review-jsbook'
2
+
3
+ desc 'copy sty/* files from current Re:VIEW source code (in git repos)'
3
4
  task :copy_sty do
4
5
  review_rootdir = '../../..'
5
6
  template_dir = File.join(review_rootdir, "templates/latex/#{REVIEW_TEMPLATE}")
@@ -1,5 +1,6 @@
1
- desc 'copy sty/* files from current Re:VIEW source code (in git repos)'
2
1
  REVIEW_TEMPLATE = ENV['REVIEW_TEMPLATE'] || 'review-jsbook'
2
+
3
+ desc 'copy sty/* files from current Re:VIEW source code (in git repos)'
3
4
  task :copy_sty do
4
5
  review_rootdir = '../..'
5
6
  template_dir = File.join(review_rootdir, "templates/latex/#{REVIEW_TEMPLATE}")
@@ -1,4 +1,4 @@
1
- \ProvidesClass{review-base}[2020/12/31]
1
+ \ProvidesClass{review-base}[2021/06/28]
2
2
  % jlreq用基本設定
3
3
  \def\recls@tmp{luatex}\ifx\recls@tmp\recls@driver
4
4
  \hypersetup{
@@ -61,10 +61,7 @@
61
61
  \begin{figure}\begin{center}}{\end{center}\end{figure}}
62
62
 
63
63
  \newenvironment{reviewdummyimage}{%
64
- \begin{figure}
65
- \begin{center}\begin{alltt}}{%
66
- \end{alltt}\end{center}
67
- \end{figure}}
64
+ \begin{figure}\begin{center}}{\end{center}\end{figure}}
68
65
 
69
66
  \newcommand{\reviewindepimagecaption[2]}{\@makecaption{}{#2}}
70
67
 
@@ -388,6 +385,7 @@
388
385
  \ifdefined\review@toc
389
386
  \def\reviewtableofcontents{%
390
387
  \setcounter{tocdepth}{\review@tocdepth}
388
+ \pagestyle{headings}
391
389
  \tableofcontents
392
390
  }
393
391
  \fi
@@ -21,7 +21,7 @@
21
21
 
22
22
  \IfFileExists{plautopatch.sty}{\RequirePackage{plautopatch}}{}
23
23
  \NeedsTeXFormat{LaTeX2e}
24
- \ProvidesClass{review-jlreq}[2021/01/12 Re:VIEW 5.1 upLaTeX/LuaLaTeX class modified for jlreq.cls]
24
+ \ProvidesClass{review-jlreq}[2021/06/28 Re:VIEW 5.2 upLaTeX/LuaLaTeX class modified for jlreq.cls]
25
25
 
26
26
  %% hook at end of reviewmacro
27
27
  \let\@endofreviewmacrohook\@empty
@@ -82,7 +82,7 @@
82
82
 
83
83
  %% hiddenfolio=nikko-pc
84
84
  \@namedef{@makehiddenfolio@nikko-pc}{%
85
- \jlreqtrimmarkssetup{banner = { center-gutter = { in = {\hiddenfolio@font\selectfont \thepage} } } } }
85
+ \jlreqtrimmarkssetup{banner = { center-gutter= { in = { \hiddenfolio@font\selectfont \thepage} } } } }
86
86
 
87
87
  %% hiddenfolio=shippo
88
88
  \@namedef{@makehiddenfolio@shippo}{%
@@ -218,7 +218,7 @@
218
218
  ]{hyperref}
219
219
 
220
220
  \def\recls@tmp{uplatex}\ifx\recls@tmp\recls@engine
221
- \RequirePackage[\recls@driver]{pxjahyper}
221
+ \RequirePackage{pxjahyper}
222
222
  \fi
223
223
 
224
224
  %% include fullpage graphics
@@ -282,6 +282,7 @@
282
282
  % シンプルな通しノンブル
283
283
  \ifrecls@serialpage
284
284
  \jlreqsetup{frontmatter_pagination=continuous}
285
+ \if@openright\else\jlreqsetup{mainmatter_pagebreak=clearpage}\fi
285
286
  \fi
286
287
 
287
288
  % 開始ページを変更
@@ -1,4 +1,4 @@
1
- \ProvidesClass{review-base}[2020/12/31]
1
+ \ProvidesClass{review-base}[2021/06/04]
2
2
  \RequirePackage{ifthen}
3
3
  \@ifundefined{Hy@Info}{% for jsbook.cls
4
4
  \RequirePackage[dvipdfmx,bookmarks=true,bookmarksnumbered=true]{hyperref}
@@ -112,8 +112,8 @@
112
112
 
113
113
  \newenvironment{reviewdummyimage}{%
114
114
  \begin{figure}
115
- \begin{center}\begin{alltt}}{%
116
- \end{alltt}\end{center}
115
+ \begin{center}}{%
116
+ \end{center}
117
117
  \end{figure}}
118
118
 
119
119
  \DeclareRobustCommand{\reviewincludegraphics}[2][]{%
@@ -389,7 +389,7 @@
389
389
  hidelinks,
390
390
  setpagesize=false,
391
391
  ]{hyperref}
392
- \RequirePackage[dvipdfmx]{pxjahyper}
392
+ \RequirePackage{pxjahyper}
393
393
 
394
394
  %% more useful macros
395
395
  %% ----------
data/test/test_builder.rb CHANGED
@@ -85,15 +85,15 @@ class BuidlerTest < Test::Unit::TestCase
85
85
  chapter = ReVIEW::Book::Chapter.new(ReVIEW::Book::Base.new, 1, 'chap1', nil, StringIO.new)
86
86
  b.bind(nil, chapter, nil)
87
87
  e = assert_raises(ReVIEW::ApplicationError) { b.inline_list('unknown|list1') }
88
- assert_equal ': error: unknown list: unknown|list1', e.message
88
+ assert_equal 'unknown list: unknown|list1', e.message
89
89
  e = assert_raises(ReVIEW::ApplicationError) { b.inline_table('unknown|table1') }
90
- assert_equal ': error: unknown table: unknown|table1', e.message
90
+ assert_equal 'unknown table: unknown|table1', e.message
91
91
  e = assert_raises(ReVIEW::ApplicationError) { b.inline_img('unknown|img1') }
92
- assert_equal ': error: unknown image: unknown|img1', e.message
92
+ assert_equal 'unknown image: unknown|img1', e.message
93
93
  e = assert_raises(ReVIEW::ApplicationError) { b.inline_column('unknown|column1') }
94
- assert_equal ': error: unknown column: unknown|column1', e.message
94
+ assert_equal 'unknown column: unknown|column1', e.message
95
95
  e = assert_raises(ReVIEW::ApplicationError) { b.inline_fn('unknown|footnote1') }
96
- assert_equal ': error: unknown footnote: unknown|footnote1', e.message
96
+ assert_equal 'unknown footnote: unknown|footnote1', e.message
97
97
  end
98
98
 
99
99
  def test_nest_error
@@ -102,16 +102,16 @@ class BuidlerTest < Test::Unit::TestCase
102
102
  assert_equal '', b.solve_nest('')
103
103
  b.children = ['dl']
104
104
  e = assert_raises(ReVIEW::ApplicationError) { b.solve_nest('') }
105
- assert_equal ': error: //beginchild of dl misses //endchild', e.message
105
+ assert_equal '//beginchild of dl misses //endchild', e.message
106
106
  b.children = ['ul', 'dl', 'ol']
107
107
  e = assert_raises(ReVIEW::ApplicationError) { b.solve_nest('') }
108
- assert_equal ': error: //beginchild of ol,dl,ul misses //endchild', e.message
108
+ assert_equal '//beginchild of ol,dl,ul misses //endchild', e.message
109
109
 
110
110
  assert_equal "\u0001→/ol←\u0001", b.endchild
111
111
  assert_equal "\u0001→/dl←\u0001", b.endchild
112
112
  assert_equal "\u0001→/ul←\u0001", b.endchild
113
113
  e = assert_raises(ReVIEW::ApplicationError) { b.endchild }
114
- assert_equal ": error: //endchild is shown, but any opened //beginchild doesn't exist", e.message
114
+ assert_equal "//endchild is shown, but any opened //beginchild doesn't exist", e.message
115
115
  end
116
116
 
117
117
  class XBuilder < Builder
@@ -13,6 +13,8 @@ class EPUBMakerTest < Test::Unit::TestCase
13
13
  'language' => 'en',
14
14
  'titlepage' => nil
15
15
  )
16
+ @log_io = StringIO.new
17
+ ReVIEW.logger = ReVIEW::Logger.new(@log_io)
16
18
  @producer = ReVIEW::EPUBMaker::Producer.new(config)
17
19
  end
18
20
 
@@ -901,8 +903,8 @@ EOT
901
903
  assert_nothing_raised { epubmaker.copy_stylesheet(tmpdir) }
902
904
 
903
905
  epubmaker.config['stylesheet'] = ['nothing.css']
904
- e = assert_raise(ApplicationError) { epubmaker.copy_stylesheet(tmpdir) }
905
- assert_equal 'stylesheet: nothing.css is not found.', e.message
906
+ assert_raise(SystemExit) { epubmaker.copy_stylesheet(tmpdir) }
907
+ assert_equal "ERROR --: stylesheet: nothing.css is not found.\n", @log_io.string
906
908
  end
907
909
 
908
910
  epubmaker_instance do |epubmaker, tmpdir|
@@ -911,8 +913,9 @@ EOT
911
913
  assert_nothing_raised { epubmaker.copy_frontmatter(tmpdir) }
912
914
 
913
915
  epubmaker.config['titlefile'] = 'nothing.html'
914
- e = assert_raise(ApplicationError) { epubmaker.copy_frontmatter(tmpdir) }
915
- assert_equal 'titlefile: nothing.html is not found.', e.message
916
+ @log_io.string = ''
917
+ assert_raise(SystemExit) { epubmaker.copy_frontmatter(tmpdir) }
918
+ assert_equal "ERROR --: titlefile: nothing.html is not found.\n", @log_io.string
916
919
  end
917
920
 
918
921
  # XXX: only `cover' is allowed to have invalid file name.
@@ -922,8 +925,9 @@ EOT
922
925
  assert_nothing_raised { epubmaker.copy_frontmatter(tmpdir) }
923
926
 
924
927
  epubmaker.config[name] = 'nothing.html'
925
- e = assert_raise(ApplicationError) { epubmaker.copy_frontmatter(tmpdir) }
926
- assert_equal "#{name}: nothing.html is not found.", e.message
928
+ @log_io.string = ''
929
+ assert_raise(SystemExit) { epubmaker.copy_frontmatter(tmpdir) }
930
+ assert_equal "ERROR --: #{name}: nothing.html is not found.\n", @log_io.string
927
931
  end
928
932
  end
929
933
 
@@ -933,8 +937,9 @@ EOT
933
937
  assert_nothing_raised { epubmaker.copy_backmatter(tmpdir) }
934
938
 
935
939
  epubmaker.config[name] = 'nothing.html'
936
- e = assert_raise(ApplicationError) { epubmaker.copy_backmatter(tmpdir) }
937
- assert_equal "#{name}: nothing.html is not found.", e.message
940
+ @log_io.string = ''
941
+ assert_raise(SystemExit) { epubmaker.copy_backmatter(tmpdir) }
942
+ assert_equal "ERROR --: #{name}: nothing.html is not found.\n", @log_io.string
938
943
  end
939
944
  end
940
945
  end
@@ -3,13 +3,13 @@ require 'tmpdir'
3
3
  require 'fileutils'
4
4
  require 'yaml'
5
5
  require 'rbconfig'
6
+ require 'zip'
6
7
 
7
8
  REVIEW_EPUBMAKER = File.expand_path('../bin/review-epubmaker', __dir__)
8
9
 
9
10
  class EPUBMakerCmdTest < Test::Unit::TestCase
10
11
  def setup
11
12
  @tmpdir1 = Dir.mktmpdir
12
- @tmpdir2 = Dir.mktmpdir
13
13
 
14
14
  @old_rubylib = ENV['RUBYLIB']
15
15
  ENV['RUBYLIB'] = File.expand_path('lib', __dir__)
@@ -17,7 +17,6 @@ class EPUBMakerCmdTest < Test::Unit::TestCase
17
17
 
18
18
  def teardown
19
19
  FileUtils.rm_rf(@tmpdir1)
20
- FileUtils.rm_rf(@tmpdir2)
21
20
  ENV['RUBYLIB'] = @old_rubylib
22
21
  end
23
22
 
@@ -35,11 +34,23 @@ class EPUBMakerCmdTest < Test::Unit::TestCase
35
34
  end
36
35
  end
37
36
 
37
+ def check_filesize(epubfile)
38
+ if /mswin|mingw|cygwin/ !~ RUBY_PLATFORM
39
+ Zip::File.open(epubfile) do |zio|
40
+ zio.each do |entry|
41
+ assert_not_equal(0, entry.size, "#{entry.name} is 0 byte.")
42
+ end
43
+ end
44
+ end
45
+ end
46
+
38
47
  def test_epubmaker_cmd_samplebook
39
48
  common_buildepub('sample-book/src', 'config.yml', 'book.epub')
49
+ check_filesize(File.join(@tmpdir1, 'book.epub'))
40
50
  end
41
51
 
42
52
  def test_epubmaker_cmd_syntaxbook
43
53
  common_buildepub('syntax-book', 'config.yml', 'syntax-book.epub')
54
+ check_filesize(File.join(@tmpdir1, 'syntax-book.epub'))
44
55
  end
45
56
  end
@@ -16,6 +16,8 @@ class HTMLBuidlerTest < Test::Unit::TestCase
16
16
  @book = Book::Base.new('.')
17
17
  @book.config = @config
18
18
  img_math = ReVIEW::ImgMath.new(@config)
19
+ @log_io = StringIO.new
20
+ ReVIEW.logger = ReVIEW::Logger.new(@log_io)
19
21
  @builder = HTMLBuilder.new(img_math: img_math)
20
22
  @compiler = ReVIEW::Compiler.new(@builder)
21
23
  @chapter = Book::Chapter.new(@book, 1, '-', nil, StringIO.new)
@@ -133,6 +135,48 @@ class HTMLBuidlerTest < Test::Unit::TestCase
133
135
  assert_equal %Q(\n<h3 id="test"><a id="h1-0-1"></a><span class="secno">1.0.1 </span>this is test.</h3>\n), actual
134
136
  end
135
137
 
138
+ def test_headline_sections
139
+ @book.config['epubmaker']['use_section'] = true
140
+ actual = compile_block("= H1\n== H2\n== H2-2\n")
141
+ expected = <<-EOS
142
+ <section class="level1"><h1><a id="h1"></a><span class="secno">第1章 </span>H1</h1>
143
+ <section class="level2">
144
+ <h2><a id="h1-1"></a><span class="secno">1.1 </span>H2</h2>
145
+ </section>
146
+ <section class="level2">
147
+ <h2><a id="h1-2"></a><span class="secno">1.2 </span>H2-2</h2>
148
+ </section>
149
+ </section>
150
+ EOS
151
+ assert_equal expected, actual
152
+
153
+ actual = compile_block("= H1\n== H2\n==== H4\n== H2-2\n")
154
+ expected = <<-EOS
155
+ <section class="level1"><h1><a id="h1"></a><span class="secno">第1章 </span>H1</h1>
156
+ <section class="level2">
157
+ <h2><a id="h1-1"></a><span class="secno">1.1 </span>H2</h2>
158
+ <section class="level4">
159
+ <h4><a id="h1-1-0-1"></a>H4</h4>
160
+ </section>
161
+ </section>
162
+ <section class="level2">
163
+ <h2><a id="h1-2"></a><span class="secno">1.2 </span>H2-2</h2>
164
+ </section>
165
+ </section>
166
+ EOS
167
+ assert_equal expected, actual
168
+
169
+ actual = compile_block("===== H5\n= H1\n")
170
+ expected = <<-EOS
171
+ <section class="level5">
172
+ <h5><a id="h1-0-0-0-1"></a>H5</h5>
173
+ </section>
174
+ <section class="level1"><h1><a id="h1"></a><span class="secno">第1章 </span>H1</h1>
175
+ </section>
176
+ EOS
177
+ assert_equal expected, actual
178
+ end
179
+
136
180
  def test_label
137
181
  actual = compile_block("//label[label_test]\n")
138
182
  assert_equal %Q(<a id="label_test"></a>\n), actual
@@ -2029,8 +2073,8 @@ EOS
2029
2073
  * AA
2030
2074
  EOS
2031
2075
 
2032
- e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2033
- assert_equal ':1: error: too many *.', e.message
2076
+ assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2077
+ assert_match(/too many \*\./, @log_io.string)
2034
2078
  end
2035
2079
 
2036
2080
  def test_ul_nest4
@@ -2378,10 +2422,10 @@ EOS
2378
2422
 
2379
2423
  def test_empty_table
2380
2424
  e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n//}\n") }
2381
- assert_equal ':2: error: no rows in the table', e.message
2425
+ assert_equal 'no rows in the table', e.message
2382
2426
 
2383
2427
  e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n------------\n//}\n") }
2384
- assert_equal ':3: error: no rows in the table', e.message
2428
+ assert_equal 'no rows in the table', e.message
2385
2429
  end
2386
2430
 
2387
2431
  def test_inline_table
@@ -2736,8 +2780,8 @@ EOS
2736
2780
 
2737
2781
  //}
2738
2782
  EOS
2739
- e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2740
- assert_match(/minicolumn cannot be nested:/, e.message)
2783
+ assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2784
+ assert_match(/minicolumn cannot be nested:/, @log_io.string)
2741
2785
  end
2742
2786
  end
2743
2787
 
@@ -2753,8 +2797,8 @@ EOS
2753
2797
 
2754
2798
  //}
2755
2799
  EOS
2756
- e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2757
- assert_match(/minicolumn cannot be nested:/, e.message)
2800
+ assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2801
+ assert_match(/minicolumn cannot be nested:/, @log_io.string)
2758
2802
  end
2759
2803
  end
2760
2804
 
@@ -2770,8 +2814,8 @@ EOS
2770
2814
 
2771
2815
  //}
2772
2816
  EOS
2773
- e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2774
- assert_match(/minicolumn cannot be nested:/, e.message)
2817
+ assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2818
+ assert_match(/minicolumn cannot be nested:/, @log_io.string)
2775
2819
  end
2776
2820
  end
2777
2821
 
@@ -2813,28 +2857,26 @@ EOS
2813
2857
  EOB
2814
2858
  end
2815
2859
  @book.config['words_file'] = File.join(dir, 'words.csv')
2816
- io = StringIO.new
2817
- @builder.instance_eval { @logger = ReVIEW::Logger.new(io) }
2818
2860
  actual = compile_block('@<w>{F} @<w>{B} @<wb>{B} @<w>{N}')
2819
2861
  assert_equal %Q(<p>foo bar&quot;\\&lt;&gt;_@&lt;b&gt;{BAZ} <b>bar&quot;\\&lt;&gt;_@&lt;b&gt;{BAZ}</b> [missing word: N]</p>\n), actual
2820
- assert_match(/WARN --: :1: word not bound: N/, io.string)
2862
+ assert_match(/WARN --: :1: word not bound: N/, @log_io.string)
2821
2863
  end
2822
2864
  end
2823
2865
 
2824
2866
  def test_inline_unknown
2825
- e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<img>{n}\n") }
2826
- assert_equal ':1: error: unknown image: n', e.message
2827
- e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<fn>{n}\n") }
2828
- assert_equal ':1: error: unknown footnote: n', e.message
2829
- e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<hd>{n}\n") }
2830
- assert_equal ':1: error: unknown headline: n', e.message
2867
+ assert_raises(ReVIEW::ApplicationError) { compile_block("@<img>{n}\n") }
2868
+ assert_match(/unknown image: n/, @log_io.string)
2869
+ assert_raises(ReVIEW::ApplicationError) { compile_block("@<fn>{n}\n") }
2870
+ assert_match(/unknown footnote: n/, @log_io.string)
2871
+ assert_raises(ReVIEW::ApplicationError) { compile_block("@<hd>{n}\n") }
2872
+ assert_match(/unknown headline: n/, @log_io.string)
2831
2873
  %w[list table column].each do |name|
2832
- e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
2833
- assert_equal ":1: error: unknown #{name}: n", e.message
2874
+ assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
2875
+ assert_match(/unknown #{name}: n/, @log_io.string)
2834
2876
  end
2835
2877
  %w[chap chapref title].each do |name|
2836
- e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
2837
- assert_equal ':1: error: key not found: "n"', e.message
2878
+ assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
2879
+ assert_match(/key not found: "n"/, @log_io.string)
2838
2880
  end
2839
2881
  end
2840
2882
 
@@ -2909,7 +2951,7 @@ EOS
2909
2951
  //beginchild
2910
2952
  EOS
2911
2953
  e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2912
- assert_equal ":1: error: //beginchild is shown, but previous element isn't ul, ol, or dl", e.message
2954
+ assert_equal "//beginchild is shown, but previous element isn't ul, ol, or dl", e.message
2913
2955
  end
2914
2956
 
2915
2957
  def test_nest_error_close2
@@ -2927,7 +2969,7 @@ EOS
2927
2969
  //beginchild
2928
2970
  EOS
2929
2971
  e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2930
- assert_equal ':12: error: //beginchild of dl,ol,ul misses //endchild', e.message
2972
+ assert_equal '//beginchild of dl,ol,ul misses //endchild', e.message
2931
2973
  end
2932
2974
 
2933
2975
  def test_nest_error_close3
@@ -2947,7 +2989,7 @@ EOS
2947
2989
  //endchild
2948
2990
  EOS
2949
2991
  e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2950
- assert_equal ':14: error: //beginchild of ol,ul misses //endchild', e.message
2992
+ assert_equal '//beginchild of ol,ul misses //endchild', e.message
2951
2993
  end
2952
2994
 
2953
2995
  def test_nest_ul