review 5.5.0 → 5.7.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/rubocop.yml +31 -0
- data/.github/workflows/ruby-tex.yml +1 -1
- data/.github/workflows/ruby-win.yml +1 -1
- data/.github/workflows/ruby.yml +2 -2
- data/.rubocop.yml +13 -2
- data/NEWS.ja.md +40 -0
- data/NEWS.md +39 -0
- data/README.md +1 -1
- data/doc/format.ja.md +70 -33
- data/doc/format.md +69 -34
- data/doc/quickstart.ja.md +7 -1
- data/doc/quickstart.md +7 -1
- data/lib/review/book/base.rb +1 -1
- data/lib/review/builder.rb +6 -10
- data/lib/review/epubmaker/epubcommon.rb +13 -7
- data/lib/review/epubmaker/epubv2.rb +0 -5
- data/lib/review/epubmaker/epubv3.rb +9 -1
- data/lib/review/epubmaker/producer.rb +2 -3
- data/lib/review/epubmaker.rb +2 -4
- data/lib/review/htmlbuilder.rb +2 -2
- data/lib/review/i18n.yml +24 -2
- data/lib/review/idgxmlbuilder.rb +29 -10
- data/lib/review/idgxmlmaker.rb +11 -1
- data/lib/review/img_math.rb +9 -2
- data/lib/review/init.rb +10 -5
- data/lib/review/latexbuilder.rb +2 -2
- data/lib/review/lineinput.rb +2 -2
- data/lib/review/makerhelper.rb +2 -2
- data/lib/review/pdfmaker.rb +3 -5
- data/lib/review/update.rb +3 -7
- data/lib/review/version.rb +1 -1
- data/lib/review/yamlloader.rb +0 -3
- data/review.gemspec +3 -3
- data/samples/syntax-book/Gemfile +1 -1
- data/templates/latex/config.erb +6 -1
- data/templates/latex/review-jlreq/review-base.sty +11 -8
- data/templates/latex/review-jsbook/review-base.sty +15 -11
- data/templates/opf/epubv2.opf.erb +2 -0
- data/templates/opf/epubv3.opf.erb +2 -0
- data/templates/opf/opf_manifest_epubv2.opf.erb +2 -0
- data/templates/opf/opf_manifest_epubv3.opf.erb +2 -0
- data/templates/opf/opf_tocx_epubv3.opf.erb +2 -0
- metadata +24 -139
- data/test/assets/black.eps +0 -280
- data/test/assets/fit.png +0 -0
- data/test/assets/header_listener.html +0 -35
- data/test/assets/img_math/img1.png +0 -0
- data/test/assets/img_math/img2.png +0 -0
- data/test/assets/img_math/img3.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 +0 -65
- data/test/assets/syntax_book_index_detail.txt +0 -60
- data/test/assets/test.xml.erb +0 -3
- data/test/assets/test_template.tex +0 -179
- data/test/assets/test_template_backmatter.tex +0 -190
- data/test/book_test_helper.rb +0 -44
- data/test/run_test.rb +0 -12
- data/test/test_book.rb +0 -588
- data/test/test_book_chapter.rb +0 -329
- data/test/test_book_part.rb +0 -53
- data/test/test_builder.rb +0 -126
- data/test/test_catalog.rb +0 -174
- data/test/test_catalog_converter_cmd.rb +0 -73
- data/test/test_compiler.rb +0 -52
- data/test/test_configure.rb +0 -91
- data/test/test_converter.rb +0 -21
- data/test/test_epub3maker.rb +0 -733
- data/test/test_epubmaker.rb +0 -931
- data/test/test_epubmaker_cmd.rb +0 -56
- data/test/test_extentions_hash.rb +0 -66
- data/test/test_helper.rb +0 -62
- data/test/test_htmlbuilder.rb +0 -3312
- data/test/test_htmltoc.rb +0 -29
- data/test/test_htmlutils.rb +0 -43
- data/test/test_i18n.rb +0 -300
- data/test/test_idgxmlbuilder.rb +0 -1487
- data/test/test_idgxmlmaker_cmd.rb +0 -50
- data/test/test_image_finder.rb +0 -81
- data/test/test_img_math.rb +0 -120
- data/test/test_index.rb +0 -287
- data/test/test_indexbuilder.rb +0 -52
- data/test/test_latexbuilder.rb +0 -2964
- data/test/test_latexbuilder_v2.rb +0 -1654
- data/test/test_lineinput.rb +0 -104
- data/test/test_location.rb +0 -30
- data/test/test_logger.rb +0 -33
- data/test/test_makerhelper.rb +0 -44
- data/test/test_markdownbuilder.rb +0 -371
- data/test/test_md2inaobuilder.rb +0 -90
- data/test/test_pdfmaker.rb +0 -354
- data/test/test_pdfmaker_cmd.rb +0 -130
- data/test/test_plaintextbuilder.rb +0 -1211
- data/test/test_preprocessor.rb +0 -196
- data/test/test_review_ext.rb +0 -30
- data/test/test_reviewheaderlistener.rb +0 -49
- data/test/test_rstbuilder.rb +0 -616
- data/test/test_sec_counter.rb +0 -156
- data/test/test_template.rb +0 -33
- data/test/test_textmaker_cmd.rb +0 -58
- data/test/test_textutils.rb +0 -187
- data/test/test_tocprinter.rb +0 -46
- data/test/test_topbuilder.rb +0 -1298
- data/test/test_update.rb +0 -473
- data/test/test_webtocprinter.rb +0 -195
- data/test/test_yamlloader.rb +0 -186
- data/test/test_zip_exporter.rb +0 -106
data/test/test_pdfmaker.rb
DELETED
@@ -1,354 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'review/pdfmaker'
|
3
|
-
|
4
|
-
class PDFMakerTest < Test::Unit::TestCase
|
5
|
-
include ReVIEW
|
6
|
-
|
7
|
-
def setup
|
8
|
-
@maker = ReVIEW::PDFMaker.new
|
9
|
-
@config = ReVIEW::Configure.values
|
10
|
-
@config.merge!(
|
11
|
-
'bookname' => 'sample',
|
12
|
-
'title' => 'Sample Book',
|
13
|
-
'aut' => 'anonymous',
|
14
|
-
'review_version' => 4,
|
15
|
-
'urnid' => 'http://example.jp/',
|
16
|
-
'date' => '2020-07-11',
|
17
|
-
'language' => 'ja',
|
18
|
-
'texcommand' => 'uplatex'
|
19
|
-
)
|
20
|
-
@maker.config = @config
|
21
|
-
@maker.initialize_metachars(@config['texcommand'])
|
22
|
-
@output = StringIO.new
|
23
|
-
I18n.setup(@config['language'])
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_check_book_existed
|
27
|
-
Dir.mktmpdir do |dir|
|
28
|
-
Dir.chdir(dir) do
|
29
|
-
pdf_file = File.join(dir, 'sample.pdf')
|
30
|
-
FileUtils.touch(pdf_file)
|
31
|
-
@maker.basedir = Dir.pwd
|
32
|
-
@maker.remove_old_file
|
33
|
-
assert !File.exist?(pdf_file)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_check_book_none
|
39
|
-
Dir.mktmpdir do
|
40
|
-
assert_nothing_raised do
|
41
|
-
@maker.basedir = Dir.pwd
|
42
|
-
@maker.remove_old_file
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_buildpath_debug
|
48
|
-
@maker.config['debug'] = true
|
49
|
-
path = @maker.build_path
|
50
|
-
begin
|
51
|
-
assert_equal(path, 'sample-pdf')
|
52
|
-
ensure
|
53
|
-
FileUtils.remove_entry_secure(path)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_parse_opts_help
|
58
|
-
io = StringIO.new
|
59
|
-
$stdout = io
|
60
|
-
assert_raises SystemExit do
|
61
|
-
@maker.parse_opts(['-h'])
|
62
|
-
end
|
63
|
-
$stdout = STDOUT
|
64
|
-
io.rewind
|
65
|
-
str = io.gets
|
66
|
-
assert_equal "Usage: review-pdfmaker configfile\n", str
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_parse_opts_ignore_errors
|
70
|
-
conf, yml = @maker.parse_opts(['--ignore-errors', 'hoge.yml'])
|
71
|
-
assert_equal conf['ignore-errors'], true
|
72
|
-
assert_equal yml, 'hoge.yml'
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_make_custom_page
|
76
|
-
Dir.mktmpdir do |dir|
|
77
|
-
coverfile = 'cover.html'
|
78
|
-
content = '<html><body>test</body></html>'
|
79
|
-
File.write(File.join(dir, 'cover.tex'), content)
|
80
|
-
page = @maker.make_custom_page(File.join(dir, coverfile))
|
81
|
-
assert_equal(content, page)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_make_authors
|
86
|
-
@config.merge!(
|
87
|
-
'aut' => ['テスト太郎', 'テスト次郎'],
|
88
|
-
'csl' => ['監修三郎'],
|
89
|
-
'trl' => ['翻訳四郎', '翻訳五郎']
|
90
|
-
)
|
91
|
-
Dir.mktmpdir do
|
92
|
-
authors = @maker.make_authors
|
93
|
-
assert_equal("テスト太郎、テスト次郎 著 \\\\\n監修三郎 監修 \\\\\n翻訳四郎、翻訳五郎 訳",
|
94
|
-
authors)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_make_authors_only_aut
|
99
|
-
@config['aut'] = 'テスト太郎'
|
100
|
-
Dir.mktmpdir do
|
101
|
-
authors = @maker.make_authors
|
102
|
-
assert_equal('テスト太郎 著', authors)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_make_okuduke
|
107
|
-
@config.merge!(
|
108
|
-
'aut' => ['テスト太郎', 'テスト次郎'],
|
109
|
-
'csl' => ['監修三郎'],
|
110
|
-
'trl' => ['翻訳四郎', '翻訳五郎'],
|
111
|
-
'dsr' => ['デザイン六郎'],
|
112
|
-
'ill' => ['イラスト七郎', 'イラスト八郎'],
|
113
|
-
'cov' => ['表紙九郎'],
|
114
|
-
'edt' => ['編集十郎'],
|
115
|
-
'pbl' => 'テスト出版',
|
116
|
-
'prt' => 'テスト印刷'
|
117
|
-
)
|
118
|
-
Dir.mktmpdir do
|
119
|
-
okuduke = @maker.make_colophon
|
120
|
-
assert_equal("著 者 & テスト太郎、テスト次郎 \\\\\n監 修 & 監修三郎 \\\\\n翻 訳 & 翻訳四郎、翻訳五郎 \\\\\nデザイン & デザイン六郎 \\\\\nイラスト & イラスト七郎、イラスト八郎 \\\\\n表 紙 & 表紙九郎 \\\\\n編 集 & 編集十郎 \\\\\n発行所 & テスト出版 \\\\\n印刷所 & テスト印刷 \\\\\n",
|
121
|
-
okuduke)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
def test_make_okuduke_dojin
|
126
|
-
@config.merge!(
|
127
|
-
'aut' => ['テスト太郎', 'テスト次郎'],
|
128
|
-
'csl' => ['監修三郎'],
|
129
|
-
'ill' => ['イラスト七郎', 'イラスト八郎'],
|
130
|
-
'pbl' => 'テスト出版',
|
131
|
-
'prt' => 'テスト印刷',
|
132
|
-
'contact' => 'tarou@example.jp'
|
133
|
-
)
|
134
|
-
Dir.mktmpdir do
|
135
|
-
I18n.update({ 'prt' => '印刷所' }, 'ja')
|
136
|
-
okuduke = @maker.make_colophon
|
137
|
-
assert_equal("著 者 & テスト太郎、テスト次郎 \\\\\n監 修 & 監修三郎 \\\\\nイラスト & イラスト七郎、イラスト八郎 \\\\\n発行所 & テスト出版 \\\\\n連絡先 & tarou@example.jp \\\\\n印刷所 & テスト印刷 \\\\\n",
|
138
|
-
okuduke)
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_template_content
|
143
|
-
Dir.mktmpdir do
|
144
|
-
@maker.basedir = Dir.pwd
|
145
|
-
@maker.erb_config
|
146
|
-
tmpl = @maker.template_content
|
147
|
-
expect = File.read(File.join(assets_dir, 'test_template.tex'))
|
148
|
-
expect.gsub!(/\\def\\review@reviewversion{[^}]+}/, "\\def\\review@reviewversion{#{ReVIEW::VERSION}}")
|
149
|
-
assert_equal(expect, tmpl)
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
def test_template_content_with_localconfig
|
154
|
-
@config['mycustom'] = { 'value' => '#_TEST_' }
|
155
|
-
Dir.mktmpdir do |dir|
|
156
|
-
Dir.chdir(dir) do
|
157
|
-
Dir.mkdir('layouts')
|
158
|
-
File.write(File.join('layouts', 'config-local.tex.erb'), %q(\def\customvalue{<%= escape(@config['mycustom']['value']) %>}) + "\n")
|
159
|
-
@maker.basedir = Dir.pwd
|
160
|
-
@maker.erb_config
|
161
|
-
tmpl = @maker.template_content
|
162
|
-
expect = File.read(File.join(assets_dir, 'test_template.tex'))
|
163
|
-
expect.gsub!(/\\def\\review@reviewversion{[^}]+}/, "\\def\\review@reviewversion{#{ReVIEW::VERSION}}")
|
164
|
-
expect.sub!("\\makeatother\n", '\&' + "%% BEGIN: config-local.tex.erb\n\\def\\customvalue{\\#\\textunderscore{}TEST\\textunderscore{}}\n%% END: config-local.tex.erb\n")
|
165
|
-
assert_equal(expect, tmpl)
|
166
|
-
end
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def test_template_content_with_invalid_localconfig
|
171
|
-
Dir.mktmpdir do |dir|
|
172
|
-
Dir.chdir(dir) do
|
173
|
-
Dir.mkdir('layouts')
|
174
|
-
File.write(File.join('layouts', 'config-local.tex.erb'), %q(<%= not_existed_method %>\n))
|
175
|
-
@maker.basedir = Dir.pwd
|
176
|
-
@maker.erb_config
|
177
|
-
@maker.instance_eval do
|
178
|
-
def error!(msg)
|
179
|
-
msg
|
180
|
-
end
|
181
|
-
end
|
182
|
-
error_msg = @maker.template_content
|
183
|
-
assert_match(/template or configuration error:/, error_msg)
|
184
|
-
assert_match(/undefined local variable or method `not_existed_method'/, error_msg)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
def test_gettemplate_with_backmatter
|
190
|
-
@config.merge!(
|
191
|
-
'backcover' => 'backcover.tex',
|
192
|
-
'profile' => 'profile.tex',
|
193
|
-
'advfile' => 'advfile.tex'
|
194
|
-
)
|
195
|
-
Dir.mktmpdir do |dir|
|
196
|
-
Dir.chdir(dir) do
|
197
|
-
profile = "\\thispagestyle{empty}\\chapter*{Profile}\nsome profile\n"
|
198
|
-
File.write(File.join(dir, 'profile.tex'), profile)
|
199
|
-
advfile = "\\thispagestyle{empty}\\chapter*{Ad}\nsome ad content\n"
|
200
|
-
File.write(File.join(dir, 'advfile.tex'), advfile)
|
201
|
-
backcover = "\\clearpage\n\\thispagestyle{empty}\\AddToShipoutPictureBG{%\n\\AtPageLowerLeft{\\includegraphics[width=\\paperwidth,height=\\paperheight]{images/backcover.png}}\n}\n\\null"
|
202
|
-
File.write(File.join(dir, 'backcover.tex'), backcover)
|
203
|
-
expect = File.read(File.join(assets_dir, 'test_template_backmatter.tex'))
|
204
|
-
expect.gsub!(/\\def\\review@reviewversion{[^}]+}/, "\\def\\review@reviewversion{#{ReVIEW::VERSION}}")
|
205
|
-
@maker.basedir = Dir.pwd
|
206
|
-
@maker.erb_config
|
207
|
-
tmpl = @maker.template_content
|
208
|
-
assert_equal(expect, tmpl)
|
209
|
-
end
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
def test_colophon_history
|
214
|
-
@config['aut'] = ['Mr.Smith']
|
215
|
-
@config['pbl'] = ['BLUEPRINT']
|
216
|
-
@config['pht'] = ['Mrs.Smith']
|
217
|
-
@config['language'] = 'ja'
|
218
|
-
history = @maker.make_history_list
|
219
|
-
expect = ['2020年7月11日 発行']
|
220
|
-
assert_equal expect, history
|
221
|
-
end
|
222
|
-
|
223
|
-
def test_colophon_history_2
|
224
|
-
@config['aut'] = ['Mr.Smith']
|
225
|
-
@config['pbl'] = ['BLUEPRINT']
|
226
|
-
@config['pht'] = ['Mrs.Smith']
|
227
|
-
@config['language'] = 'ja'
|
228
|
-
@config['history'] =
|
229
|
-
[['2011-08-03 v1.0.0版発行',
|
230
|
-
'2020-07-11 v1.2.0版発行']]
|
231
|
-
history = @maker.make_history_list
|
232
|
-
expect = ['2011年8月3日 v1.0.0版発行', '2020年7月11日 v1.2.0版発行']
|
233
|
-
assert_equal expect, history
|
234
|
-
end
|
235
|
-
|
236
|
-
def test_colophon_history_date
|
237
|
-
@config['aut'] = ['Mr.Smith']
|
238
|
-
@config['pbl'] = ['BLUEPRINT']
|
239
|
-
@config['pht'] = ['Mrs.Smith']
|
240
|
-
@config['language'] = 'ja'
|
241
|
-
@config['history'] =
|
242
|
-
[['2011-08-03',
|
243
|
-
'2012-02-15']]
|
244
|
-
history = @maker.make_history_list
|
245
|
-
expect = ['2011年8月3日 初版第1刷 発行',
|
246
|
-
'2012年2月15日 初版第2刷 発行']
|
247
|
-
assert_equal expect, history
|
248
|
-
end
|
249
|
-
|
250
|
-
def test_colophon_history_date2
|
251
|
-
@config['aut'] = ['Mr.Smith']
|
252
|
-
@config['pbl'] = ['BLUEPRINT']
|
253
|
-
@config['pht'] = ['Mrs.Smith']
|
254
|
-
@config['language'] = 'ja'
|
255
|
-
@config['history'] =
|
256
|
-
[['2011-08-03',
|
257
|
-
'2012-02-15'],
|
258
|
-
['2012-10-01'],
|
259
|
-
['2013-03-01']]
|
260
|
-
history = @maker.make_history_list
|
261
|
-
expect = ['2011年8月3日 初版第1刷 発行',
|
262
|
-
'2012年2月15日 初版第2刷 発行',
|
263
|
-
'2012年10月1日 第2版第1刷 発行',
|
264
|
-
'2013年3月1日 第3版第1刷 発行']
|
265
|
-
assert_equal expect, history
|
266
|
-
end
|
267
|
-
|
268
|
-
def test_colophon_history_freeformat
|
269
|
-
@config['aut'] = ['Mr.Smith']
|
270
|
-
@config['pbl'] = ['BLUEPRINT']
|
271
|
-
@config['pht'] = ['Mrs.Smith']
|
272
|
-
@config['language'] = 'ja'
|
273
|
-
@config['history'] =
|
274
|
-
[['2011年8月3日 ver 1.1.0発行'],
|
275
|
-
['2011年10月12日 ver 1.2.0発行'],
|
276
|
-
['2012年1月31日 ver 1.2.1発行']]
|
277
|
-
history = @maker.make_history_list
|
278
|
-
expect = ['2011年8月3日 ver 1.1.0発行',
|
279
|
-
'2011年10月12日 ver 1.2.0発行',
|
280
|
-
'2012年1月31日 ver 1.2.1発行']
|
281
|
-
assert_equal expect, history
|
282
|
-
end
|
283
|
-
|
284
|
-
def test_box_setting_is_defined
|
285
|
-
%w[column note memo tip info warning important caution notice].each do |name|
|
286
|
-
@config['pdfmaker']['boxsetting'] = {
|
287
|
-
name => { 'style' => 'simplebox' }
|
288
|
-
}
|
289
|
-
assert !ReVIEW::LaTeXBox.new.tcbox(@config).empty?
|
290
|
-
end
|
291
|
-
@config['pdfmaker']['boxsetting'] = {
|
292
|
-
'invalid' => { 'style' => 'simplebox' }
|
293
|
-
}
|
294
|
-
assert ReVIEW::LaTeXBox.new.tcbox(@config).empty?
|
295
|
-
end
|
296
|
-
|
297
|
-
def test_box_setting_options
|
298
|
-
@config['pdfmaker']['boxsetting'] = {
|
299
|
-
'note' => { 'style' => 'simplebox' },
|
300
|
-
'important' => { 'style' => 'simplebox', 'options' => 'colback=blue,arc=3mm' },
|
301
|
-
'caution' => { 'style' => 'squarecaptionbox', 'options_with_caption' => 'attach boxed title to top bottom' }
|
302
|
-
}
|
303
|
-
|
304
|
-
expected = <<-EOS
|
305
|
-
\\renewenvironment{reviewnote}[1][]{%
|
306
|
-
\\csdef{rv@tmp@withcaption}{true}
|
307
|
-
\\notblank{##1}{
|
308
|
-
\\begin{rv@simplebox@caption}{##1}[]
|
309
|
-
}{
|
310
|
-
\\csundef{rv@tmp@withcaption}
|
311
|
-
\\begin{rv@simplebox@nocaption}[]
|
312
|
-
}
|
313
|
-
}{
|
314
|
-
\\ifcsdef{rv@tmp@withcaption}{
|
315
|
-
\\end{rv@simplebox@caption}
|
316
|
-
}{
|
317
|
-
\\end{rv@simplebox@nocaption}
|
318
|
-
}
|
319
|
-
}
|
320
|
-
\\renewenvironment{reviewimportant}[1][]{%
|
321
|
-
\\csdef{rv@tmp@withcaption}{true}
|
322
|
-
\\notblank{##1}{
|
323
|
-
\\begin{rv@simplebox@caption}{##1}[colback=blue,arc=3mm]
|
324
|
-
}{
|
325
|
-
\\csundef{rv@tmp@withcaption}
|
326
|
-
\\begin{rv@simplebox@nocaption}[colback=blue,arc=3mm]
|
327
|
-
}
|
328
|
-
}{
|
329
|
-
\\ifcsdef{rv@tmp@withcaption}{
|
330
|
-
\\end{rv@simplebox@caption}
|
331
|
-
}{
|
332
|
-
\\end{rv@simplebox@nocaption}
|
333
|
-
}
|
334
|
-
}
|
335
|
-
\\renewenvironment{reviewcaution}[1][]{%
|
336
|
-
\\csdef{rv@tmp@withcaption}{true}
|
337
|
-
\\notblank{##1}{
|
338
|
-
\\begin{rv@squarecaptionbox@caption}{##1}[attach boxed title to top bottom]
|
339
|
-
}{
|
340
|
-
\\csundef{rv@tmp@withcaption}
|
341
|
-
\\begin{rv@squarecaptionbox@nocaption}[]
|
342
|
-
}
|
343
|
-
}{
|
344
|
-
\\ifcsdef{rv@tmp@withcaption}{
|
345
|
-
\\end{rv@squarecaptionbox@caption}
|
346
|
-
}{
|
347
|
-
\\end{rv@squarecaptionbox@nocaption}
|
348
|
-
}
|
349
|
-
}
|
350
|
-
EOS
|
351
|
-
actual = ReVIEW::LaTeXBox.new.tcbox(@config)
|
352
|
-
assert_equal expected, actual
|
353
|
-
end
|
354
|
-
end
|
data/test/test_pdfmaker_cmd.rb
DELETED
@@ -1,130 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'tmpdir'
|
3
|
-
require 'fileutils'
|
4
|
-
require 'yaml'
|
5
|
-
require 'rbconfig'
|
6
|
-
require 'open3'
|
7
|
-
|
8
|
-
REVIEW_PDFMAKER = File.expand_path('../bin/review-pdfmaker', __dir__)
|
9
|
-
|
10
|
-
class PDFMakerCmdTest < Test::Unit::TestCase
|
11
|
-
def setup
|
12
|
-
@tmpdir1 = Dir.mktmpdir
|
13
|
-
|
14
|
-
@old_rubylib = ENV['RUBYLIB']
|
15
|
-
ENV['RUBYLIB'] = File.expand_path('../lib', __dir__)
|
16
|
-
end
|
17
|
-
|
18
|
-
def teardown
|
19
|
-
FileUtils.rm_rf(@tmpdir1)
|
20
|
-
ENV['RUBYLIB'] = @old_rubylib
|
21
|
-
end
|
22
|
-
|
23
|
-
def common_buildpdf(bookdir, templatedir, configfile, targetpdffile, option = nil)
|
24
|
-
unless /mswin|mingw|cygwin/.match?(RUBY_PLATFORM)
|
25
|
-
config = prepare_samplebook(@tmpdir1, bookdir, templatedir, configfile)
|
26
|
-
builddir = File.join(@tmpdir1, config['bookname'] + '-pdf')
|
27
|
-
assert !File.exist?(builddir)
|
28
|
-
|
29
|
-
ruby_cmd = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
|
30
|
-
Dir.chdir(@tmpdir1) do
|
31
|
-
_o, e, s = Open3.capture3("#{ruby_cmd} -S #{REVIEW_PDFMAKER} #{option} #{configfile}")
|
32
|
-
if !e.empty? && !s.success?
|
33
|
-
$stderr.puts e
|
34
|
-
end
|
35
|
-
assert s.success?
|
36
|
-
end
|
37
|
-
assert File.exist?(File.join(@tmpdir1, targetpdffile))
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_pdfmaker_cmd_sample_jsbook_print
|
42
|
-
begin
|
43
|
-
`uplatex -v`
|
44
|
-
rescue StandardError
|
45
|
-
$stderr.puts 'skip test_pdfmaker_cmd_sample_jsbook_print'
|
46
|
-
return true
|
47
|
-
end
|
48
|
-
common_buildpdf('sample-book/src', 'review-jsbook', 'config.yml', 'book.pdf')
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_pdfmaker_cmd_sample_jsbook_ebook
|
52
|
-
begin
|
53
|
-
`uplatex -v`
|
54
|
-
rescue StandardError
|
55
|
-
$stderr.puts 'skip test_pdfmaker_cmd_sample_jsbook_ebook'
|
56
|
-
return true
|
57
|
-
end
|
58
|
-
common_buildpdf('sample-book/src', 'review-jsbook', 'config-ebook.yml', 'book.pdf')
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_pdfmaker_cmd_sample_jlreq_print
|
62
|
-
begin
|
63
|
-
`uplatex -v`
|
64
|
-
rescue StandardError
|
65
|
-
$stderr.puts 'skip test_pdfmaker_cmd_sample_jlreq_print'
|
66
|
-
return true
|
67
|
-
end
|
68
|
-
common_buildpdf('sample-book/src', 'review-jlreq', 'config-jlreq.yml', 'book.pdf')
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_pdfmaker_cmd_sample_jlreq_ebook
|
72
|
-
begin
|
73
|
-
`uplatex -v`
|
74
|
-
rescue StandardError
|
75
|
-
$stderr.puts 'skip test_pdfmaker_cmd_sample_jlreq_ebook'
|
76
|
-
return true
|
77
|
-
end
|
78
|
-
common_buildpdf('sample-book/src', 'review-jlreq', 'config-jlreq-ebook.yml', 'book.pdf')
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_pdfmaker_cmd_syntax_jsbook_print
|
82
|
-
begin
|
83
|
-
`uplatex -v`
|
84
|
-
rescue StandardError
|
85
|
-
$stderr.puts 'skip test_pdfmaker_cmd_syntax_jsbook_print'
|
86
|
-
return true
|
87
|
-
end
|
88
|
-
common_buildpdf('syntax-book', 'review-jsbook', 'config-print.yml', 'syntax-book.pdf')
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_pdfmaker_cmd_syntax_jsbook_print_buildonly
|
92
|
-
begin
|
93
|
-
`uplatex -v`
|
94
|
-
rescue StandardError
|
95
|
-
$stderr.puts 'skip test_pdfmaker_cmd_syntax_jsbook_print_buildonly'
|
96
|
-
return true
|
97
|
-
end
|
98
|
-
common_buildpdf('syntax-book', 'review-jsbook', 'config-print.yml', 'syntax-book.pdf', '-y ch01')
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_pdfmaker_cmd_syntax_jsbook_ebook
|
102
|
-
begin
|
103
|
-
`uplatex -v`
|
104
|
-
rescue StandardError
|
105
|
-
$stderr.puts 'skip test_pdfmaker_cmd_syntax_jsbook_ebook'
|
106
|
-
return true
|
107
|
-
end
|
108
|
-
common_buildpdf('syntax-book', 'review-jsbook', 'config.yml', 'syntax-book.pdf')
|
109
|
-
end
|
110
|
-
|
111
|
-
def test_pdfmaker_cmd_syntax_jlreq_ebook
|
112
|
-
begin
|
113
|
-
`uplatex -v`
|
114
|
-
rescue StandardError
|
115
|
-
$stderr.puts 'skip test_pdfmaker_cmd_syntax_jlreq_ebook'
|
116
|
-
return true
|
117
|
-
end
|
118
|
-
common_buildpdf('syntax-book', 'review-jlreq', 'config-jlreq.yml', 'syntax-book.pdf')
|
119
|
-
end
|
120
|
-
|
121
|
-
def test_pdfmaker_cmd_syntax_jlreq_ebook_lualatex
|
122
|
-
begin
|
123
|
-
`lualatex -v`
|
124
|
-
rescue StandardError
|
125
|
-
$stderr.puts 'skip test_pdfmaker_cmd_syntax_jlreq_ebook_lualatex'
|
126
|
-
return true
|
127
|
-
end
|
128
|
-
common_buildpdf('syntax-book', 'review-jlreq', 'config-jlreq-lualatex.yml', 'syntax-book.pdf')
|
129
|
-
end
|
130
|
-
end
|