review 5.3.0 → 5.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby-tex.yml +1 -1
- data/.github/workflows/ruby.yml +1 -1
- data/.rubocop.yml +1 -322
- data/NEWS.ja.md +48 -0
- data/NEWS.md +48 -0
- data/README.md +9 -8
- data/bin/review +1 -1
- data/bin/review-catalog-converter +15 -15
- data/bin/review-check +7 -7
- data/bin/review-compile +6 -8
- data/bin/review-index +1 -1
- data/bin/review-preproc +1 -1
- data/bin/review-validate +2 -2
- data/doc/config.yml.sample +7 -1
- data/doc/config.yml.sample-simple +1 -1
- data/lib/review/book/base.rb +3 -3
- data/lib/review/book/book_unit.rb +1 -1
- data/lib/review/book/chapter.rb +1 -1
- data/lib/review/book/index.rb +3 -3
- data/lib/review/book/part.rb +12 -13
- data/lib/review/book/volume.rb +1 -1
- data/lib/review/builder.rb +10 -12
- data/lib/review/catalog.rb +5 -5
- data/lib/review/compiler.rb +13 -13
- data/lib/review/configure.rb +5 -2
- data/lib/review/epub2html.rb +12 -12
- data/lib/review/epubmaker/content.rb +1 -1
- data/lib/review/epubmaker/epubcommon.rb +44 -42
- data/lib/review/epubmaker/epubv2.rb +2 -1
- data/lib/review/epubmaker/epubv3.rb +5 -4
- data/lib/review/epubmaker/producer.rb +3 -3
- data/lib/review/epubmaker/reviewheaderlistener.rb +1 -1
- data/lib/review/epubmaker.rb +32 -31
- data/lib/review/extentions/string.rb +1 -1
- data/lib/review/htmlbuilder.rb +16 -15
- data/lib/review/htmlutils.rb +17 -17
- data/lib/review/i18n.rb +3 -3
- data/lib/review/idgxmlbuilder.rb +22 -21
- data/lib/review/idgxmlmaker.rb +15 -13
- data/lib/review/index_builder.rb +4 -20
- data/lib/review/init.rb +4 -4
- data/lib/review/latexbuilder.rb +30 -32
- data/lib/review/lineinput.rb +3 -3
- data/lib/review/location.rb +1 -1
- data/lib/review/logger.rb +21 -21
- data/lib/review/makerhelper.rb +3 -3
- data/lib/review/markdownbuilder.rb +6 -6
- data/lib/review/pdfmaker.rb +23 -19
- data/lib/review/plaintextbuilder.rb +5 -5
- data/lib/review/preprocessor/repository.rb +1 -1
- data/lib/review/preprocessor.rb +5 -5
- data/lib/review/textmaker.rb +20 -18
- data/lib/review/textutils.rb +3 -5
- data/lib/review/topbuilder.rb +71 -12
- data/lib/review/update.rb +16 -8
- data/lib/review/version.rb +1 -1
- data/lib/review/webmaker.rb +32 -32
- data/lib/review/webtocprinter.rb +10 -10
- data/lib/review/yamlloader.rb +35 -2
- data/review.gemspec +1 -0
- data/samples/sample-book/src/config.yml +0 -1
- data/templates/html/_titlepage.html.erb +9 -17
- data/templates/opf/opf_manifest_epubv2.opf.erb +1 -1
- data/templates/opf/opf_manifest_epubv3.opf.erb +1 -1
- data/test/book_test_helper.rb +10 -10
- data/test/test_epub3maker.rb +3 -3
- data/test/test_epubmaker.rb +14 -29
- data/test/test_epubmaker_cmd.rb +2 -2
- data/test/test_htmlbuilder.rb +4 -5
- data/test/test_idgxmlbuilder.rb +10 -10
- data/test/test_idgxmlmaker_cmd.rb +1 -1
- data/test/test_img_math.rb +11 -2
- data/test/test_latexbuilder.rb +2 -3
- data/test/test_pdfmaker_cmd.rb +10 -10
- data/test/test_textmaker_cmd.rb +1 -1
- data/test/test_topbuilder.rb +151 -11
- data/test/test_yamlloader.rb +28 -42
- metadata +8 -7
data/test/test_epub3maker.rb
CHANGED
@@ -321,12 +321,12 @@ EOT
|
|
321
321
|
<item id="ch02-html" href="ch02.html" media-type="application/xhtml+xml"/>
|
322
322
|
<item id="ch03-html" href="ch03.html" media-type="application/xhtml+xml" properties="mathml"/>
|
323
323
|
<item id="ch04-html" href="ch04.html" media-type="application/xhtml+xml"/>
|
324
|
-
<item id="sample-
|
325
|
-
<item id="sample-jpg" href="sample.jpg" media-type="image/jpeg"/>
|
324
|
+
<item id="sample-GIF" href="sample.GIF" media-type="image/gif"/>
|
326
325
|
<item id="sample-JPEG" href="sample.JPEG" media-type="image/jpeg"/>
|
327
326
|
<item id="sample-SvG" href="sample.SvG" media-type="image/svg+xml"/>
|
328
|
-
<item id="sample-GIF" href="sample.GIF" media-type="image/gif"/>
|
329
327
|
<item id="sample-css" href="sample.css" media-type="text/css"/>
|
328
|
+
<item id="sample-jpg" href="sample.jpg" media-type="image/jpeg"/>
|
329
|
+
<item id="sample-png" href="sample.png" media-type="image/png"/>
|
330
330
|
</manifest>
|
331
331
|
<spine page-progression-direction="ltr">
|
332
332
|
<itemref idref="sample" linear="no"/>
|
data/test/test_epubmaker.rb
CHANGED
@@ -6,6 +6,7 @@ class EPUBMakerTest < Test::Unit::TestCase
|
|
6
6
|
config = ReVIEW::Configure.values
|
7
7
|
config.merge!(
|
8
8
|
'bookname' => 'sample',
|
9
|
+
'booktitle' => 'Sample Book',
|
9
10
|
'title' => 'Sample Book',
|
10
11
|
'epubversion' => 2,
|
11
12
|
'urnid' => 'http://example.jp/',
|
@@ -318,12 +319,12 @@ EOT
|
|
318
319
|
<item id="ch02-html" href="ch02.html" media-type="application/xhtml+xml"/>
|
319
320
|
<item id="ch03-html" href="ch03.html" media-type="application/xhtml+xml"/>
|
320
321
|
<item id="ch04-html" href="ch04.html" media-type="application/xhtml+xml"/>
|
321
|
-
<item id="sample-
|
322
|
-
<item id="sample-jpg" href="sample.jpg" media-type="image/jpeg"/>
|
322
|
+
<item id="sample-GIF" href="sample.GIF" media-type="image/gif"/>
|
323
323
|
<item id="sample-JPEG" href="sample.JPEG" media-type="image/jpeg"/>
|
324
324
|
<item id="sample-SvG" href="sample.SvG" media-type="image/svg+xml"/>
|
325
|
-
<item id="sample-GIF" href="sample.GIF" media-type="image/gif"/>
|
326
325
|
<item id="sample-css" href="sample.css" media-type="text/css"/>
|
326
|
+
<item id="sample-jpg" href="sample.jpg" media-type="image/jpeg"/>
|
327
|
+
<item id="sample-png" href="sample.png" media-type="image/png"/>
|
327
328
|
</manifest>
|
328
329
|
<spine toc="ncx">
|
329
330
|
<itemref idref="sample" linear="no"/>
|
@@ -806,19 +807,11 @@ EOT
|
|
806
807
|
<title>Sample Book</title>
|
807
808
|
</head>
|
808
809
|
<body>
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
<h2 class="tp-author">Mr.Smith</h2>
|
815
|
-
<p>
|
816
|
-
<br />
|
817
|
-
<br />
|
818
|
-
<br />
|
819
|
-
<br />
|
820
|
-
</p>
|
821
|
-
<h3 class="tp-publisher">BLUEPRINT</h3>
|
810
|
+
<div class="titlepage">
|
811
|
+
<h1 class="tp-title">Sample Book</h1>
|
812
|
+
<h2 class="tp-author">Mr.Smith</h2>
|
813
|
+
<h3 class="tp-publisher">BLUEPRINT</h3>
|
814
|
+
</div>
|
822
815
|
</body>
|
823
816
|
</html>
|
824
817
|
EOT
|
@@ -842,19 +835,11 @@ EOT
|
|
842
835
|
<title>Sample Book</title>
|
843
836
|
</head>
|
844
837
|
<body>
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
<h2 class="tp-author">Mr.Smith</h2>
|
851
|
-
<p>
|
852
|
-
<br />
|
853
|
-
<br />
|
854
|
-
<br />
|
855
|
-
<br />
|
856
|
-
</p>
|
857
|
-
<h3 class="tp-publisher">BLUEPRINT</h3>
|
838
|
+
<div class="titlepage">
|
839
|
+
<h1 class="tp-title">Sample Book</h1>
|
840
|
+
<h2 class="tp-author">Mr.Smith</h2>
|
841
|
+
<h3 class="tp-publisher">BLUEPRINT</h3>
|
842
|
+
</div>
|
858
843
|
</body>
|
859
844
|
</html>
|
860
845
|
EOT
|
data/test/test_epubmaker_cmd.rb
CHANGED
@@ -21,7 +21,7 @@ class EPUBMakerCmdTest < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def common_buildepub(bookdir, configfile, targetepubfile)
|
24
|
-
|
24
|
+
unless /mswin|mingw|cygwin/.match?(RUBY_PLATFORM)
|
25
25
|
config = prepare_samplebook(@tmpdir1, bookdir, nil, configfile)
|
26
26
|
builddir = File.join(@tmpdir1, config['bookname'] + '-epub')
|
27
27
|
assert !File.exist?(builddir)
|
@@ -35,7 +35,7 @@ class EPUBMakerCmdTest < Test::Unit::TestCase
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def check_filesize(epubfile)
|
38
|
-
|
38
|
+
unless /mswin|mingw|cygwin/.match?(RUBY_PLATFORM)
|
39
39
|
Zip::File.open(epubfile) do |zio|
|
40
40
|
zio.each do |entry|
|
41
41
|
assert_not_equal(0, entry.size, "#{entry.name} is 0 byte.")
|
data/test/test_htmlbuilder.rb
CHANGED
@@ -1708,7 +1708,7 @@ EOS
|
|
1708
1708
|
end
|
1709
1709
|
|
1710
1710
|
def test_texequation
|
1711
|
-
return true if /mswin|mingw|cygwin
|
1711
|
+
return true if /mswin|mingw|cygwin/.match?(RUBY_PLATFORM)
|
1712
1712
|
return true unless system('latex -version 1>/dev/null 2>/dev/null')
|
1713
1713
|
|
1714
1714
|
mktmpbookdir('catalog.yml' => "CHAPS:\n - ch01.re\n",
|
@@ -1741,7 +1741,7 @@ EOS
|
|
1741
1741
|
|
1742
1742
|
def test_texequation_fail
|
1743
1743
|
# Re:VIEW 3 never fail on defer mode. This test is only for Re:VIEW 2.
|
1744
|
-
return true if /mswin|mingw|cygwin
|
1744
|
+
return true if /mswin|mingw|cygwin/.match?(RUBY_PLATFORM)
|
1745
1745
|
return true unless system('latex -version 1>/dev/null 2>/dev/null')
|
1746
1746
|
|
1747
1747
|
mktmpbookdir('catalog.yml' => "CHAPS:\n - ch01.re\n",
|
@@ -2887,12 +2887,11 @@ EOS
|
|
2887
2887
|
|
2888
2888
|
def test_inline_w
|
2889
2889
|
Dir.mktmpdir do |dir|
|
2890
|
-
File.
|
2891
|
-
f.write <<EOB
|
2890
|
+
File.write(File.join(dir, 'words.csv'), <<EOB
|
2892
2891
|
"F","foo"
|
2893
2892
|
"B","bar""\\<>_@<b>{BAZ}"
|
2894
2893
|
EOB
|
2895
|
-
|
2894
|
+
)
|
2896
2895
|
@book.config['words_file'] = File.join(dir, 'words.csv')
|
2897
2896
|
actual = compile_block('@<w>{F} @<w>{B} @<wb>{B} @<w>{N}')
|
2898
2897
|
assert_equal %Q(<p>foo bar"\\<>_@<b>{BAZ} <b>bar"\\<>_@<b>{BAZ}</b> [missing word: N]</p>\n), actual
|
data/test/test_idgxmlbuilder.rb
CHANGED
@@ -348,15 +348,15 @@ EOS
|
|
348
348
|
//}
|
349
349
|
EOS
|
350
350
|
|
351
|
-
if type == 'notice' # exception pattern
|
352
|
-
|
351
|
+
expected = if type == 'notice' # exception pattern
|
352
|
+
<<-EOS.chomp
|
353
353
|
<#{type}-t><title aid:pstyle='#{type}-title'>#{type}1</title></#{type}-t><#{type}-t><title aid:pstyle='#{type}-title'>#{type}2</title></#{type}-t>
|
354
354
|
EOS
|
355
|
-
|
356
|
-
|
355
|
+
else
|
356
|
+
<<-EOS.chomp
|
357
357
|
<#{type}><title aid:pstyle='#{type}-title'>#{type}1</title></#{type}><#{type}><title aid:pstyle='#{type}-title'>#{type}2</title></#{type}>
|
358
358
|
EOS
|
359
|
-
|
359
|
+
end
|
360
360
|
assert_equal expected, compile_block(src)
|
361
361
|
|
362
362
|
src = <<-EOS
|
@@ -412,17 +412,17 @@ LIST
|
|
412
412
|
//}
|
413
413
|
EOS
|
414
414
|
|
415
|
-
if type == 'notice' # exception pattern
|
416
|
-
|
415
|
+
expected = if type == 'notice' # exception pattern
|
416
|
+
<<-EOS.chomp
|
417
417
|
<#{type}><ul><li aid:pstyle="ul-item">A</li></ul><ol><li aid:pstyle="ol-item" olnum="1" num="1">B</li></ol></#{type}><#{type}-t><title aid:pstyle='#{type}-title'>OMITEND1</title><list type='emlist'><pre>LIST
|
418
418
|
</pre></list></#{type}-t><#{type}-t><title aid:pstyle='#{type}-title'>OMITEND2</title></#{type}-t>
|
419
419
|
EOS
|
420
|
-
|
421
|
-
|
420
|
+
else
|
421
|
+
<<-EOS.chomp
|
422
422
|
<#{type}><ul><li aid:pstyle="ul-item">A</li></ul><ol><li aid:pstyle="ol-item" olnum="1" num="1">B</li></ol></#{type}><#{type}><title aid:pstyle='#{type}-title'>OMITEND1</title><list type='emlist'><pre>LIST
|
423
423
|
</pre></list></#{type}><#{type}><title aid:pstyle='#{type}-title'>OMITEND2</title></#{type}>
|
424
424
|
EOS
|
425
|
-
|
425
|
+
end
|
426
426
|
assert_equal expected, compile_block(src)
|
427
427
|
end
|
428
428
|
end
|
@@ -21,7 +21,7 @@ class IDGXMLMakerCmdTest < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def common_buildidgxml(bookdir, configfile, targetfile, option)
|
24
|
-
|
24
|
+
unless /mswin|mingw|cygwin/.match?(RUBY_PLATFORM)
|
25
25
|
config = prepare_samplebook(@tmpdir1, bookdir, nil, configfile)
|
26
26
|
builddir = File.join(@tmpdir1, config['bookname'] + '-idgxml')
|
27
27
|
assert !File.exist?(builddir)
|
data/test/test_img_math.rb
CHANGED
@@ -30,7 +30,7 @@ class ImgMathTest < Test::Unit::TestCase
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_defer_math_image
|
33
|
-
unless support_latex_in_tests?
|
33
|
+
unless support_latex_in_tests? && support_pdftocairo_in_tests?
|
34
34
|
$stderr.puts 'skip test_defer_math_image'
|
35
35
|
return true
|
36
36
|
end
|
@@ -104,7 +104,16 @@ class ImgMathTest < Test::Unit::TestCase
|
|
104
104
|
begin
|
105
105
|
`uplatex -v`
|
106
106
|
true
|
107
|
-
rescue
|
107
|
+
rescue StandardError
|
108
|
+
false
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def support_pdftocairo_in_tests?
|
113
|
+
begin
|
114
|
+
`pdftocairo -v`
|
115
|
+
true
|
116
|
+
rescue StandardError
|
108
117
|
false
|
109
118
|
end
|
110
119
|
end
|
data/test/test_latexbuilder.rb
CHANGED
@@ -2422,12 +2422,11 @@ EOS
|
|
2422
2422
|
|
2423
2423
|
def test_inline_w
|
2424
2424
|
Dir.mktmpdir do |dir|
|
2425
|
-
File.
|
2426
|
-
f.write <<EOB
|
2425
|
+
File.write(File.join(dir, 'words.csv'), <<EOB
|
2427
2426
|
"F","foo"
|
2428
2427
|
"B","bar""\\<>_@<b>{BAZ}"
|
2429
2428
|
EOB
|
2430
|
-
|
2429
|
+
)
|
2431
2430
|
@book.config['words_file'] = File.join(dir, 'words.csv')
|
2432
2431
|
|
2433
2432
|
io = StringIO.new
|
data/test/test_pdfmaker_cmd.rb
CHANGED
@@ -21,7 +21,7 @@ class PDFMakerCmdTest < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def common_buildpdf(bookdir, templatedir, configfile, targetpdffile, option = nil)
|
24
|
-
|
24
|
+
unless /mswin|mingw|cygwin/.match?(RUBY_PLATFORM)
|
25
25
|
config = prepare_samplebook(@tmpdir1, bookdir, templatedir, configfile)
|
26
26
|
builddir = File.join(@tmpdir1, config['bookname'] + '-pdf')
|
27
27
|
assert !File.exist?(builddir)
|
@@ -41,7 +41,7 @@ class PDFMakerCmdTest < Test::Unit::TestCase
|
|
41
41
|
def test_pdfmaker_cmd_sample_jsbook_print
|
42
42
|
begin
|
43
43
|
`uplatex -v`
|
44
|
-
rescue
|
44
|
+
rescue StandardError
|
45
45
|
$stderr.puts 'skip test_pdfmaker_cmd_sample_jsbook_print'
|
46
46
|
return true
|
47
47
|
end
|
@@ -51,7 +51,7 @@ class PDFMakerCmdTest < Test::Unit::TestCase
|
|
51
51
|
def test_pdfmaker_cmd_sample_jsbook_ebook
|
52
52
|
begin
|
53
53
|
`uplatex -v`
|
54
|
-
rescue
|
54
|
+
rescue StandardError
|
55
55
|
$stderr.puts 'skip test_pdfmaker_cmd_sample_jsbook_ebook'
|
56
56
|
return true
|
57
57
|
end
|
@@ -61,7 +61,7 @@ class PDFMakerCmdTest < Test::Unit::TestCase
|
|
61
61
|
def test_pdfmaker_cmd_sample_jlreq_print
|
62
62
|
begin
|
63
63
|
`uplatex -v`
|
64
|
-
rescue
|
64
|
+
rescue StandardError
|
65
65
|
$stderr.puts 'skip test_pdfmaker_cmd_sample_jlreq_print'
|
66
66
|
return true
|
67
67
|
end
|
@@ -71,7 +71,7 @@ class PDFMakerCmdTest < Test::Unit::TestCase
|
|
71
71
|
def test_pdfmaker_cmd_sample_jlreq_ebook
|
72
72
|
begin
|
73
73
|
`uplatex -v`
|
74
|
-
rescue
|
74
|
+
rescue StandardError
|
75
75
|
$stderr.puts 'skip test_pdfmaker_cmd_sample_jlreq_ebook'
|
76
76
|
return true
|
77
77
|
end
|
@@ -81,7 +81,7 @@ class PDFMakerCmdTest < Test::Unit::TestCase
|
|
81
81
|
def test_pdfmaker_cmd_syntax_jsbook_print
|
82
82
|
begin
|
83
83
|
`uplatex -v`
|
84
|
-
rescue
|
84
|
+
rescue StandardError
|
85
85
|
$stderr.puts 'skip test_pdfmaker_cmd_syntax_jsbook_print'
|
86
86
|
return true
|
87
87
|
end
|
@@ -91,7 +91,7 @@ class PDFMakerCmdTest < Test::Unit::TestCase
|
|
91
91
|
def test_pdfmaker_cmd_syntax_jsbook_print_buildonly
|
92
92
|
begin
|
93
93
|
`uplatex -v`
|
94
|
-
rescue
|
94
|
+
rescue StandardError
|
95
95
|
$stderr.puts 'skip test_pdfmaker_cmd_syntax_jsbook_print_buildonly'
|
96
96
|
return true
|
97
97
|
end
|
@@ -101,7 +101,7 @@ class PDFMakerCmdTest < Test::Unit::TestCase
|
|
101
101
|
def test_pdfmaker_cmd_syntax_jsbook_ebook
|
102
102
|
begin
|
103
103
|
`uplatex -v`
|
104
|
-
rescue
|
104
|
+
rescue StandardError
|
105
105
|
$stderr.puts 'skip test_pdfmaker_cmd_syntax_jsbook_ebook'
|
106
106
|
return true
|
107
107
|
end
|
@@ -111,7 +111,7 @@ class PDFMakerCmdTest < Test::Unit::TestCase
|
|
111
111
|
def test_pdfmaker_cmd_syntax_jlreq_ebook
|
112
112
|
begin
|
113
113
|
`uplatex -v`
|
114
|
-
rescue
|
114
|
+
rescue StandardError
|
115
115
|
$stderr.puts 'skip test_pdfmaker_cmd_syntax_jlreq_ebook'
|
116
116
|
return true
|
117
117
|
end
|
@@ -121,7 +121,7 @@ class PDFMakerCmdTest < Test::Unit::TestCase
|
|
121
121
|
def test_pdfmaker_cmd_syntax_jlreq_ebook_lualatex
|
122
122
|
begin
|
123
123
|
`lualatex -v`
|
124
|
-
rescue
|
124
|
+
rescue StandardError
|
125
125
|
$stderr.puts 'skip test_pdfmaker_cmd_syntax_jlreq_ebook_lualatex'
|
126
126
|
return true
|
127
127
|
end
|
data/test/test_textmaker_cmd.rb
CHANGED
@@ -21,7 +21,7 @@ class TEXTMakerCmdTest < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def common_buildtext(bookdir, configfile, targetfile, option)
|
24
|
-
|
24
|
+
unless /mswin|mingw|cygwin/.match?(RUBY_PLATFORM)
|
25
25
|
config = prepare_samplebook(@tmpdir1, bookdir, nil, configfile)
|
26
26
|
builddir = File.join(@tmpdir1, config['bookname'] + '-text')
|
27
27
|
assert !File.exist?(builddir)
|
data/test/test_topbuilder.rb
CHANGED
@@ -151,7 +151,8 @@ class TOPBuidlerTest < Test::Unit::TestCase
|
|
151
151
|
actual = compile_block("//table{\n★1☆\t▲2☆\n------------\n★3☆\t▲4☆<>&\n//}\n")
|
152
152
|
expected = <<-EOS
|
153
153
|
◆→開始:表←◆
|
154
|
-
|
154
|
+
★1☆\t▲2☆
|
155
|
+
------------
|
155
156
|
★3☆\t▲4☆<>&
|
156
157
|
◆→終了:表←◆
|
157
158
|
|
@@ -506,7 +507,8 @@ EOS
|
|
506
507
|
actual = compile_block("//table{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
507
508
|
expected = <<-EOS
|
508
509
|
◆→開始:表←◆
|
509
|
-
|
510
|
+
aaa\tbbb
|
511
|
+
------------
|
510
512
|
ccc\tddd<>&
|
511
513
|
◆→終了:表←◆
|
512
514
|
|
@@ -518,7 +520,8 @@ EOS
|
|
518
520
|
◆→開始:表←◆
|
519
521
|
表1.1 FOO
|
520
522
|
|
521
|
-
|
523
|
+
aaa\tbbb
|
524
|
+
------------
|
522
525
|
ccc\tddd<>&
|
523
526
|
◆→終了:表←◆
|
524
527
|
|
@@ -529,12 +532,36 @@ EOS
|
|
529
532
|
actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
530
533
|
expected = <<-EOS
|
531
534
|
◆→開始:表←◆
|
532
|
-
|
535
|
+
aaa\tbbb
|
536
|
+
------------
|
533
537
|
ccc\tddd<>&
|
534
538
|
|
535
539
|
表1.1 FOO
|
536
540
|
◆→終了:表←◆
|
537
541
|
|
542
|
+
EOS
|
543
|
+
assert_equal expected, actual
|
544
|
+
end
|
545
|
+
|
546
|
+
def test_table_th_bold
|
547
|
+
@config['textmaker']['th_bold'] = true
|
548
|
+
actual = compile_block("//table{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
549
|
+
expected = <<-EOS
|
550
|
+
◆→開始:表←◆
|
551
|
+
★aaa☆\t★bbb☆
|
552
|
+
ccc\tddd<>&
|
553
|
+
◆→終了:表←◆
|
554
|
+
|
555
|
+
EOS
|
556
|
+
assert_equal expected, actual
|
557
|
+
|
558
|
+
actual = compile_block("//table{\naaa\tbbb\nccc\tddd<>&\n//}\n")
|
559
|
+
expected = <<-EOS
|
560
|
+
◆→開始:表←◆
|
561
|
+
★aaa☆\tbbb
|
562
|
+
★ccc☆\tddd<>&
|
563
|
+
◆→終了:表←◆
|
564
|
+
|
538
565
|
EOS
|
539
566
|
assert_equal expected, actual
|
540
567
|
end
|
@@ -561,6 +588,28 @@ EOS
|
|
561
588
|
◆→開始:表←◆
|
562
589
|
foo
|
563
590
|
|
591
|
+
aaa\tbbb
|
592
|
+
------------
|
593
|
+
ccc\tddd<>&
|
594
|
+
◆→終了:表←◆
|
595
|
+
|
596
|
+
◆→開始:表←◆
|
597
|
+
aaa\tbbb
|
598
|
+
------------
|
599
|
+
ccc\tddd<>&
|
600
|
+
◆→終了:表←◆
|
601
|
+
|
602
|
+
EOS
|
603
|
+
assert_equal expected, actual
|
604
|
+
end
|
605
|
+
|
606
|
+
def test_emtable_thbold
|
607
|
+
@config['textmaker']['th_bold'] = true
|
608
|
+
actual = compile_block("//emtable[foo]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n//emtable{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
609
|
+
expected = <<-EOS
|
610
|
+
◆→開始:表←◆
|
611
|
+
foo
|
612
|
+
|
564
613
|
★aaa☆\t★bbb☆
|
565
614
|
ccc\tddd<>&
|
566
615
|
◆→終了:表←◆
|
@@ -570,6 +619,37 @@ ccc\tddd<>&
|
|
570
619
|
ccc\tddd<>&
|
571
620
|
◆→終了:表←◆
|
572
621
|
|
622
|
+
EOS
|
623
|
+
assert_equal expected, actual
|
624
|
+
end
|
625
|
+
|
626
|
+
def test_imgtable
|
627
|
+
def @chapter.image(_id)
|
628
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
629
|
+
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
630
|
+
item
|
631
|
+
end
|
632
|
+
|
633
|
+
actual = compile_block("//imgtable[sampleimg][sample photo]{\nfoo\n//}\n")
|
634
|
+
expected = <<-EOS
|
635
|
+
◆→開始:表←◆
|
636
|
+
表1.1 sample photo
|
637
|
+
|
638
|
+
◆→./images/chap1-sampleimg.png←◆
|
639
|
+
◆→終了:表←◆
|
640
|
+
|
641
|
+
EOS
|
642
|
+
assert_equal expected, actual
|
643
|
+
|
644
|
+
@config['caption_position']['table'] = 'bottom'
|
645
|
+
actual = compile_block("//imgtable[sampleimg][sample photo]{\nfoo\n//}\n")
|
646
|
+
expected = <<-EOS
|
647
|
+
◆→開始:表←◆
|
648
|
+
◆→./images/chap1-sampleimg.png←◆
|
649
|
+
|
650
|
+
表1.1 sample photo
|
651
|
+
◆→終了:表←◆
|
652
|
+
|
573
653
|
EOS
|
574
654
|
assert_equal expected, actual
|
575
655
|
end
|
@@ -578,7 +658,8 @@ EOS
|
|
578
658
|
src = "//table{\n1\t2\t\t3 4| 5\n------------\na b\tc d |e\n//}\n"
|
579
659
|
expected = <<-EOS
|
580
660
|
◆→開始:表←◆
|
581
|
-
|
661
|
+
1 2 3 4| 5
|
662
|
+
------------
|
582
663
|
a b c d |e
|
583
664
|
◆→終了:表←◆
|
584
665
|
|
@@ -590,7 +671,8 @@ EOS
|
|
590
671
|
actual = compile_block(src)
|
591
672
|
expected = <<-EOS
|
592
673
|
◆→開始:表←◆
|
593
|
-
|
674
|
+
1 2 3 4| 5
|
675
|
+
------------
|
594
676
|
a b c d |e
|
595
677
|
◆→終了:表←◆
|
596
678
|
|
@@ -601,7 +683,8 @@ EOS
|
|
601
683
|
actual = compile_block(src)
|
602
684
|
expected = <<-EOS
|
603
685
|
◆→開始:表←◆
|
604
|
-
|
686
|
+
1 2 3 4| 5
|
687
|
+
------------
|
605
688
|
a b c d |e
|
606
689
|
◆→終了:表←◆
|
607
690
|
|
@@ -612,7 +695,8 @@ EOS
|
|
612
695
|
actual = compile_block(src)
|
613
696
|
expected = <<-EOS
|
614
697
|
◆→開始:表←◆
|
615
|
-
|
698
|
+
1 2 3 4 5
|
699
|
+
------------
|
616
700
|
a b c d e
|
617
701
|
◆→終了:表←◆
|
618
702
|
|
@@ -965,6 +1049,63 @@ EOS
|
|
965
1049
|
図1.1 sample photo
|
966
1050
|
◆→終了:図←◆
|
967
1051
|
|
1052
|
+
EOS
|
1053
|
+
assert_equal expected, actual
|
1054
|
+
end
|
1055
|
+
|
1056
|
+
def test_image_dummy
|
1057
|
+
actual = compile_block("//image[dummy][sample photo]{\nDUMMY\n//}\n")
|
1058
|
+
expected = <<-EOS
|
1059
|
+
◆→開始:図←◆
|
1060
|
+
DUMMY
|
1061
|
+
|
1062
|
+
図1.1 sample photo
|
1063
|
+
◆→終了:図←◆
|
1064
|
+
|
1065
|
+
EOS
|
1066
|
+
assert_equal expected, actual
|
1067
|
+
end
|
1068
|
+
|
1069
|
+
def test_indepimage
|
1070
|
+
def @chapter.image(_id)
|
1071
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
1072
|
+
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
1073
|
+
item
|
1074
|
+
end
|
1075
|
+
|
1076
|
+
actual = compile_block("//indepimage[sampleimg][sample photo]{\nfoo\n//}\n")
|
1077
|
+
expected = <<-EOS
|
1078
|
+
◆→開始:図←◆
|
1079
|
+
◆→./images/chap1-sampleimg.png←◆
|
1080
|
+
|
1081
|
+
図 sample photo
|
1082
|
+
◆→終了:図←◆
|
1083
|
+
|
1084
|
+
EOS
|
1085
|
+
assert_equal expected, actual
|
1086
|
+
|
1087
|
+
@config['caption_position']['image'] = 'top'
|
1088
|
+
actual = compile_block("//indepimage[sampleimg][sample photo]{\nfoo\n//}\n")
|
1089
|
+
expected = <<-EOS
|
1090
|
+
◆→開始:図←◆
|
1091
|
+
図 sample photo
|
1092
|
+
|
1093
|
+
◆→./images/chap1-sampleimg.png←◆
|
1094
|
+
◆→終了:図←◆
|
1095
|
+
|
1096
|
+
EOS
|
1097
|
+
assert_equal expected, actual
|
1098
|
+
end
|
1099
|
+
|
1100
|
+
def test_indepimage_dummy
|
1101
|
+
actual = compile_block("//indepimage[dummy][sample photo]{\nDUMMY\n//}\n")
|
1102
|
+
expected = <<-EOS
|
1103
|
+
◆→開始:図←◆
|
1104
|
+
DUMMY
|
1105
|
+
|
1106
|
+
図 sample photo
|
1107
|
+
◆→終了:図←◆
|
1108
|
+
|
968
1109
|
EOS
|
969
1110
|
assert_equal expected, actual
|
970
1111
|
end
|
@@ -983,12 +1124,11 @@ EOS
|
|
983
1124
|
|
984
1125
|
def test_inline_w
|
985
1126
|
Dir.mktmpdir do |dir|
|
986
|
-
File.
|
987
|
-
f.write <<EOB
|
1127
|
+
File.write(File.join(dir, 'words.csv'), <<EOB
|
988
1128
|
"F","foo"
|
989
1129
|
"B","bar""\\<>_@<b>{BAZ}"
|
990
1130
|
EOB
|
991
|
-
|
1131
|
+
)
|
992
1132
|
@book.config['words_file'] = File.join(dir, 'words.csv')
|
993
1133
|
|
994
1134
|
io = StringIO.new
|