review 3.2.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +26 -4
- data/.travis.yml +1 -1
- data/NEWS.ja.md +97 -1
- data/NEWS.md +97 -1
- data/bin/review-catalog-converter +1 -1
- data/bin/review-check +5 -5
- data/bin/review-checkdep +1 -1
- data/bin/review-compile +5 -5
- data/bin/review-idgxmlmaker +16 -0
- data/bin/review-index +7 -7
- data/bin/review-preproc +9 -9
- data/bin/review-validate +2 -2
- data/bin/review-vol +5 -5
- data/doc/config.yml.sample +14 -6
- data/doc/config.yml.sample-simple +1 -1
- data/doc/format.ja.md +15 -5
- data/doc/format.md +30 -18
- data/doc/pdfmaker.ja.md +1 -1
- data/doc/pdfmaker.md +1 -1
- data/lib/review/book.rb +1 -1
- data/lib/review/book/base.rb +23 -63
- data/lib/review/book/chapter.rb +18 -3
- data/lib/review/book/compilable.rb +5 -0
- data/lib/review/book/index.rb +26 -65
- data/lib/review/book/index/item.rb +40 -0
- data/lib/review/book/part.rb +22 -2
- data/lib/review/builder.rb +60 -40
- data/lib/review/catalog.rb +12 -15
- data/lib/review/compiler.rb +68 -36
- data/lib/review/configure.rb +10 -7
- data/lib/review/epubmaker.rb +5 -2
- data/lib/review/htmlbuilder.rb +24 -71
- data/lib/review/htmlutils.rb +2 -3
- data/lib/review/i18n.rb +2 -2
- data/lib/review/idgxmlbuilder.rb +101 -55
- data/lib/review/idgxmlmaker.rb +184 -0
- data/lib/review/init-web/finish.html +10 -0
- data/lib/review/init-web/index.html +190 -0
- data/lib/review/init-web/review-layout-design.js +691 -0
- data/lib/review/init.rb +110 -26
- data/lib/review/latexbuilder.rb +76 -54
- data/lib/review/lineinput.rb +1 -1
- data/lib/review/logger.rb +4 -8
- data/lib/review/makerhelper.rb +6 -4
- data/lib/review/markdownbuilder.rb +25 -38
- data/lib/review/md2inaobuilder.rb +3 -5
- data/lib/review/pdfmaker.rb +15 -15
- data/lib/review/plaintextbuilder.rb +67 -76
- data/lib/review/preprocessor.rb +13 -13
- data/lib/review/rstbuilder.rb +31 -31
- data/lib/review/textmaker.rb +13 -3
- data/lib/review/textutils.rb +77 -2
- data/lib/review/tocparser.rb +17 -17
- data/lib/review/tocprinter.rb +8 -8
- data/lib/review/topbuilder.rb +76 -57
- data/lib/review/update.rb +16 -16
- data/lib/review/version.rb +1 -1
- data/lib/review/webmaker.rb +2 -2
- data/lib/review/yamlloader.rb +3 -0
- data/review.gemspec +4 -3
- data/samples/sample-book/README.md +7 -2
- data/samples/sample-book/src/.gitignore +153 -0
- data/samples/sample-book/src/config-jlreq.yml +6 -0
- data/samples/sample-book/src/lib/tasks/review.rake +20 -9
- data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +14 -8
- data/samples/syntax-book/ch03.re +3 -6
- data/samples/syntax-book/config-jlreq.yml +5 -0
- data/samples/syntax-book/lib/tasks/review.rake +7 -7
- data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +14 -8
- data/templates/latex/config.erb +6 -0
- data/templates/latex/layout.tex.erb +1 -0
- data/templates/latex/review-jlreq/review-base.sty +93 -31
- data/templates/latex/review-jlreq/review-jlreq.cls +6 -0
- data/templates/latex/review-jlreq/review-style.sty +3 -0
- data/templates/latex/review-jsbook/README.md +39 -0
- data/templates/latex/review-jsbook/review-base.sty +65 -10
- data/templates/latex/review-jsbook/review-jsbook.cls +4 -0
- data/templates/latex/review-jsbook/review-style.sty +4 -1
- data/test/assets/test_template.tex +11 -3
- data/test/assets/test_template_backmatter.tex +11 -3
- data/test/test_book.rb +65 -19
- data/test/test_catalog.rb +18 -42
- data/test/test_catalog_converter_cmd.rb +1 -1
- data/test/test_epubmaker_cmd.rb +2 -2
- data/test/test_helper.rb +1 -1
- data/test/test_htmlbuilder.rb +144 -55
- data/test/test_i18n.rb +25 -25
- data/test/test_idgxmlbuilder.rb +60 -18
- data/test/test_image_finder.rb +6 -6
- data/test/test_latexbuilder.rb +128 -24
- data/test/test_latexbuilder_v2.rb +23 -23
- data/test/test_logger.rb +14 -1
- data/test/test_makerhelper.rb +3 -3
- data/test/test_markdownbuilder.rb +45 -4
- data/test/test_md2inaobuilder.rb +12 -2
- data/test/test_pdfmaker.rb +1 -1
- data/test/test_pdfmaker_cmd.rb +1 -1
- data/test/test_plaintextbuilder.rb +31 -6
- data/test/test_rstbuilder.rb +33 -4
- data/test/test_textutils.rb +109 -2
- data/test/test_topbuilder.rb +35 -7
- data/test/test_update.rb +17 -8
- data/test/test_yamlloader.rb +13 -0
- metadata +26 -2
data/test/test_i18n.rb
CHANGED
|
@@ -9,7 +9,7 @@ class I18nTest < Test::Unit::TestCase
|
|
|
9
9
|
Dir.mktmpdir do |dir|
|
|
10
10
|
Dir.chdir(dir) do
|
|
11
11
|
file = File.join(dir, 'locale.yml')
|
|
12
|
-
File.open(file, 'w') { |f| f.write
|
|
12
|
+
File.open(file, 'w') { |f| f.write %Q(locale: ja\nfoo: "bar"\n) }
|
|
13
13
|
I18n.setup
|
|
14
14
|
assert_equal 'bar', I18n.t('foo')
|
|
15
15
|
end
|
|
@@ -20,7 +20,7 @@ class I18nTest < Test::Unit::TestCase
|
|
|
20
20
|
Dir.mktmpdir do |dir|
|
|
21
21
|
Dir.chdir(dir) do
|
|
22
22
|
file = File.join(dir, 'locale.yaml')
|
|
23
|
-
File.open(file, 'w') { |f| f.write
|
|
23
|
+
File.open(file, 'w') { |f| f.write %Q(locale: ja\nfoo: "bar"\n) }
|
|
24
24
|
assert_raise ReVIEW::ConfigError do
|
|
25
25
|
I18n.setup
|
|
26
26
|
end
|
|
@@ -32,7 +32,7 @@ class I18nTest < Test::Unit::TestCase
|
|
|
32
32
|
Dir.mktmpdir do |dir|
|
|
33
33
|
Dir.chdir(dir) do
|
|
34
34
|
file = File.join(dir, 'foo.yml')
|
|
35
|
-
File.open(file, 'w') { |f| f.write
|
|
35
|
+
File.open(file, 'w') { |f| f.write %Q(locale: ja\nfoo: "bar"\n) }
|
|
36
36
|
I18n.setup('ja', 'foo.yml')
|
|
37
37
|
assert_equal 'bar', I18n.t('foo')
|
|
38
38
|
end
|
|
@@ -43,7 +43,7 @@ class I18nTest < Test::Unit::TestCase
|
|
|
43
43
|
Dir.mktmpdir do |dir|
|
|
44
44
|
Dir.chdir(dir) do
|
|
45
45
|
file = File.join(dir, 'foo.yml')
|
|
46
|
-
File.open(file, 'w') { |f| f.write
|
|
46
|
+
File.open(file, 'w') { |f| f.write %Q(locale: ja\nfoo: "bar"\n) }
|
|
47
47
|
i18n = ReVIEW::I18n.new('ja')
|
|
48
48
|
i18n.update_localefile(File.join(Dir.pwd, 'foo.yml'))
|
|
49
49
|
assert_equal 'bar', i18n.t('foo')
|
|
@@ -55,7 +55,7 @@ class I18nTest < Test::Unit::TestCase
|
|
|
55
55
|
Dir.mktmpdir do |dir|
|
|
56
56
|
Dir.chdir(dir) do
|
|
57
57
|
file = File.join(dir, 'foo.yml')
|
|
58
|
-
File.open(file, 'w') { |f| f.write
|
|
58
|
+
File.open(file, 'w') { |f| f.write %Q(locale: ja\nfoo: "bar"\n) }
|
|
59
59
|
I18n.setup('ja', 'foo.yml')
|
|
60
60
|
assert_equal 'bar', I18n.t('foo')
|
|
61
61
|
end
|
|
@@ -66,7 +66,7 @@ class I18nTest < Test::Unit::TestCase
|
|
|
66
66
|
Dir.mktmpdir do |dir|
|
|
67
67
|
Dir.chdir(dir) do
|
|
68
68
|
file = File.join(dir, 'locale.yml')
|
|
69
|
-
File.open(file, 'w') { |f| f.write
|
|
69
|
+
File.open(file, 'w') { |f| f.write %Q(ja:\n foo: "bar"\nen:\n foo: "buz"\n) }
|
|
70
70
|
I18n.setup
|
|
71
71
|
assert_equal 'bar', I18n.t('foo')
|
|
72
72
|
assert_equal '図', I18n.t('image')
|
|
@@ -81,7 +81,7 @@ class I18nTest < Test::Unit::TestCase
|
|
|
81
81
|
Dir.mktmpdir do |dir|
|
|
82
82
|
Dir.chdir(dir) do
|
|
83
83
|
file = File.join(dir, 'locale.yml')
|
|
84
|
-
File.open(file, 'w') { |f| f.write
|
|
84
|
+
File.open(file, 'w') { |f| f.write %Q(local: ja\nfoo: "bar"\n) }
|
|
85
85
|
assert_raises(ReVIEW::KeyError) do
|
|
86
86
|
I18n.setup
|
|
87
87
|
end
|
|
@@ -93,59 +93,59 @@ class I18nTest < Test::Unit::TestCase
|
|
|
93
93
|
Dir.mktmpdir do |dir|
|
|
94
94
|
Dir.chdir(dir) do
|
|
95
95
|
file = File.join(dir, 'locale.yml')
|
|
96
|
-
File.open(file, 'w') { |f| f.write
|
|
96
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pa章" }
|
|
97
97
|
I18n.setup('ja')
|
|
98
98
|
assert_equal '第a章', I18n.t('chapter', 1)
|
|
99
99
|
|
|
100
|
-
File.open(file, 'w') { |f| f.write
|
|
100
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pA章" }
|
|
101
101
|
I18n.setup('ja')
|
|
102
102
|
assert_equal '第B章', I18n.t('chapter', 2)
|
|
103
103
|
|
|
104
|
-
File.open(file, 'w') { |f| f.write
|
|
104
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pAW章" }
|
|
105
105
|
I18n.setup('ja')
|
|
106
106
|
assert_equal '第B章', I18n.t('chapter', 2)
|
|
107
107
|
|
|
108
|
-
File.open(file, 'w') { |f| f.write
|
|
108
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%paW章" }
|
|
109
109
|
I18n.setup('ja')
|
|
110
110
|
assert_equal '第b章', I18n.t('chapter', 2)
|
|
111
111
|
|
|
112
|
-
File.open(file, 'w') { |f| f.write
|
|
112
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pR章" }
|
|
113
113
|
I18n.setup('ja')
|
|
114
114
|
assert_equal '第I章', I18n.t('chapter', 1)
|
|
115
115
|
|
|
116
|
-
File.open(file, 'w') { |f| f.write
|
|
116
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pr章" }
|
|
117
117
|
I18n.setup('ja')
|
|
118
118
|
assert_equal '第ii章', I18n.t('chapter', 2)
|
|
119
119
|
|
|
120
|
-
File.open(file, 'w') { |f| f.write
|
|
120
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pRW章" }
|
|
121
121
|
I18n.setup('ja')
|
|
122
122
|
assert_equal '第Ⅻ章', I18n.t('chapter', 12)
|
|
123
123
|
|
|
124
|
-
File.open(file, 'w') { |f| f.write
|
|
124
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pJ章" }
|
|
125
125
|
I18n.setup('ja')
|
|
126
126
|
assert_equal '第二十七章', I18n.t('chapter', 27)
|
|
127
127
|
|
|
128
|
-
File.open(file, 'w') { |f| f.write
|
|
128
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pdW章" }
|
|
129
129
|
I18n.setup('ja')
|
|
130
130
|
assert_equal '第1章', I18n.t('chapter', 1)
|
|
131
131
|
|
|
132
|
-
File.open(file, 'w') { |f| f.write
|
|
132
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pdW章" }
|
|
133
133
|
I18n.setup('ja')
|
|
134
134
|
assert_equal '第27章', I18n.t('chapter', 27)
|
|
135
135
|
|
|
136
|
-
File.open(file, 'w') { |f| f.write
|
|
136
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pDW章" }
|
|
137
137
|
I18n.setup('ja')
|
|
138
138
|
assert_equal '第1章', I18n.t('chapter', 1)
|
|
139
139
|
|
|
140
|
-
File.open(file, 'w') { |f| f.write
|
|
140
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pDW章" }
|
|
141
141
|
I18n.setup('ja')
|
|
142
142
|
assert_equal '第27章', I18n.t('chapter', 27)
|
|
143
143
|
|
|
144
|
-
File.open(file, 'w') { |f| f.write
|
|
144
|
+
File.open(file, 'w') { |f| f.write "locale: ja\npart: Part %pRW" }
|
|
145
145
|
I18n.setup('ja')
|
|
146
146
|
assert_equal 'Part 0', I18n.t('part', 0)
|
|
147
147
|
|
|
148
|
-
File.open(file, 'w') { |f| f.write
|
|
148
|
+
File.open(file, 'w') { |f| f.write "locale: ja\npart: 第%pJ部" }
|
|
149
149
|
I18n.setup('ja')
|
|
150
150
|
assert_equal '第一部', I18n.t('part', 1)
|
|
151
151
|
end
|
|
@@ -215,7 +215,7 @@ class I18nTest < Test::Unit::TestCase
|
|
|
215
215
|
end
|
|
216
216
|
|
|
217
217
|
def test_en
|
|
218
|
-
I18n.setup
|
|
218
|
+
I18n.setup('en')
|
|
219
219
|
assert_equal 'Figure ', I18n.t('image')
|
|
220
220
|
assert_equal 'Table ', I18n.t('table')
|
|
221
221
|
assert_equal 'Chapter 1', I18n.t('chapter', 1)
|
|
@@ -223,7 +223,7 @@ class I18nTest < Test::Unit::TestCase
|
|
|
223
223
|
end
|
|
224
224
|
|
|
225
225
|
def test_nil
|
|
226
|
-
I18n.setup
|
|
226
|
+
I18n.setup('nil')
|
|
227
227
|
assert_equal 'image', I18n.t('image')
|
|
228
228
|
assert_equal 'table', I18n.t('table')
|
|
229
229
|
assert_equal 'etc', I18n.t('etc')
|
|
@@ -236,7 +236,7 @@ class I18nTest < Test::Unit::TestCase
|
|
|
236
236
|
end
|
|
237
237
|
|
|
238
238
|
def _setup_htmlbuilder
|
|
239
|
-
I18n.setup
|
|
239
|
+
I18n.setup('en')
|
|
240
240
|
@builder = HTMLBuilder.new
|
|
241
241
|
@config = ReVIEW::Configure[
|
|
242
242
|
'secnolevel' => 2, # for IDGXMLBuilder, HTMLBuilder
|
|
@@ -295,6 +295,6 @@ class I18nTest < Test::Unit::TestCase
|
|
|
295
295
|
end
|
|
296
296
|
|
|
297
297
|
def teardown
|
|
298
|
-
I18n.setup
|
|
298
|
+
I18n.setup('ja')
|
|
299
299
|
end
|
|
300
300
|
end
|
data/test/test_idgxmlbuilder.rb
CHANGED
|
@@ -199,16 +199,28 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
|
199
199
|
def test_paragraph
|
|
200
200
|
actual = compile_block("foo\nbar\n")
|
|
201
201
|
assert_equal '<p>foobar</p>', actual
|
|
202
|
+
|
|
203
|
+
@book.config['join_lines_by_lang'] = true
|
|
204
|
+
actual = compile_block("foo\nbar\n")
|
|
205
|
+
assert_equal '<p>foo bar</p>', actual
|
|
202
206
|
end
|
|
203
207
|
|
|
204
208
|
def test_tabbed_paragraph
|
|
205
209
|
actual = compile_block("\tfoo\nbar\n")
|
|
206
210
|
assert_equal %Q(<p inlist="1">foobar</p>), actual
|
|
211
|
+
|
|
212
|
+
@book.config['join_lines_by_lang'] = true
|
|
213
|
+
actual = compile_block("\tfoo\nbar\n")
|
|
214
|
+
assert_equal %Q(<p inlist="1">foo bar</p>), actual
|
|
207
215
|
end
|
|
208
216
|
|
|
209
217
|
def test_quote
|
|
210
218
|
actual = compile_block("//quote{\nfoo\nbar\n\nbuz\n//}\n")
|
|
211
219
|
assert_equal '<quote><p>foobar</p><p>buz</p></quote>', actual
|
|
220
|
+
|
|
221
|
+
@book.config['join_lines_by_lang'] = true
|
|
222
|
+
actual = compile_block("//quote{\nfoo\nbar\n\nbuz\n//}\n")
|
|
223
|
+
assert_equal '<quote><p>foo bar</p><p>buz</p></quote>', actual
|
|
212
224
|
end
|
|
213
225
|
|
|
214
226
|
def test_major_blocks
|
|
@@ -249,16 +261,28 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
|
249
261
|
def test_term
|
|
250
262
|
actual = compile_block("//term{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
|
251
263
|
assert_equal '<term><p>test1test1.5</p><p>test<i>2</i></p></term>', actual
|
|
264
|
+
|
|
265
|
+
@book.config['join_lines_by_lang'] = true
|
|
266
|
+
actual = compile_block("//term{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
|
267
|
+
assert_equal '<term><p>test1 test1.5</p><p>test<i>2</i></p></term>', actual
|
|
252
268
|
end
|
|
253
269
|
|
|
254
270
|
def test_point
|
|
255
271
|
actual = compile_block("//point[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
|
256
272
|
assert_equal %Q(<point-t><title aid:pstyle='point-title'>this is <b>test</b><&>_</title><p>test1test1.5</p><p>test<i>2</i></p></point-t>), actual
|
|
273
|
+
|
|
274
|
+
@book.config['join_lines_by_lang'] = true
|
|
275
|
+
actual = compile_block("//point[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
|
276
|
+
assert_equal %Q(<point-t><title aid:pstyle='point-title'>this is <b>test</b><&>_</title><p>test1 test1.5</p><p>test<i>2</i></p></point-t>), actual
|
|
257
277
|
end
|
|
258
278
|
|
|
259
279
|
def test_point_without_caption
|
|
260
280
|
actual = compile_block("//point{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
|
261
281
|
assert_equal '<point><p>test1test1.5</p><p>test<i>2</i></p></point>', actual
|
|
282
|
+
|
|
283
|
+
@book.config['join_lines_by_lang'] = true
|
|
284
|
+
actual = compile_block("//point{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
|
285
|
+
assert_equal '<point><p>test1 test1.5</p><p>test<i>2</i></p></point>', actual
|
|
262
286
|
end
|
|
263
287
|
|
|
264
288
|
def test_emlist
|
|
@@ -311,7 +335,7 @@ EOS
|
|
|
311
335
|
|
|
312
336
|
def test_list
|
|
313
337
|
def @chapter.list(_id)
|
|
314
|
-
Book::
|
|
338
|
+
Book::Index::Item.new('samplelist', 1)
|
|
315
339
|
end
|
|
316
340
|
actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
|
317
341
|
expected = <<-EOS.chomp
|
|
@@ -326,7 +350,7 @@ EOS
|
|
|
326
350
|
|
|
327
351
|
def test_listnum
|
|
328
352
|
def @chapter.list(_id)
|
|
329
|
-
Book::
|
|
353
|
+
Book::Index::Item.new('samplelist', 1)
|
|
330
354
|
end
|
|
331
355
|
actual = compile_block("//listnum[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
|
332
356
|
expected = <<-EOS.chomp
|
|
@@ -341,7 +365,7 @@ EOS
|
|
|
341
365
|
|
|
342
366
|
def test_listnum_linenum
|
|
343
367
|
def @chapter.list(_id)
|
|
344
|
-
Book::
|
|
368
|
+
Book::Index::Item.new('samplelist', 1)
|
|
345
369
|
end
|
|
346
370
|
actual = compile_block("//firstlinenum[100]\n//listnum[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
|
347
371
|
expected = <<-EOS.chomp
|
|
@@ -356,7 +380,7 @@ EOS
|
|
|
356
380
|
|
|
357
381
|
def test_list_listinfo
|
|
358
382
|
def @chapter.list(_id)
|
|
359
|
-
Book::
|
|
383
|
+
Book::Index::Item.new('samplelist', 1)
|
|
360
384
|
end
|
|
361
385
|
@config['listinfo'] = true
|
|
362
386
|
actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
|
@@ -454,11 +478,19 @@ EOS
|
|
|
454
478
|
def test_flushright
|
|
455
479
|
actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
|
|
456
480
|
assert_equal %Q(<p align='right'>foobar</p><p align='right'>buz</p>), actual
|
|
481
|
+
|
|
482
|
+
@book.config['join_lines_by_lang'] = true
|
|
483
|
+
actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
|
|
484
|
+
assert_equal %Q(<p align='right'>foo bar</p><p align='right'>buz</p>), actual
|
|
457
485
|
end
|
|
458
486
|
|
|
459
487
|
def test_centering
|
|
460
488
|
actual = compile_block("//centering{\nfoo\nbar\n\nbuz\n//}\n")
|
|
461
489
|
assert_equal %Q(<p align='center'>foobar</p><p align='center'>buz</p>), actual
|
|
490
|
+
|
|
491
|
+
@book.config['join_lines_by_lang'] = true
|
|
492
|
+
actual = compile_block("//centering{\nfoo\nbar\n\nbuz\n//}\n")
|
|
493
|
+
assert_equal %Q(<p align='center'>foo bar</p><p align='center'>buz</p>), actual
|
|
462
494
|
end
|
|
463
495
|
|
|
464
496
|
def test_blankline
|
|
@@ -469,11 +501,15 @@ EOS
|
|
|
469
501
|
def test_noindent
|
|
470
502
|
actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
|
|
471
503
|
assert_equal %Q(<p aid:pstyle="noindent" noindent='1'>foobar</p><p>foo2bar2</p>), actual
|
|
504
|
+
|
|
505
|
+
@book.config['join_lines_by_lang'] = true
|
|
506
|
+
actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
|
|
507
|
+
assert_equal %Q(<p aid:pstyle="noindent" noindent='1'>foo bar</p><p>foo2 bar2</p>), actual
|
|
472
508
|
end
|
|
473
509
|
|
|
474
510
|
def test_image
|
|
475
511
|
def @chapter.image(_id)
|
|
476
|
-
item = Book::
|
|
512
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
|
477
513
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
|
478
514
|
item
|
|
479
515
|
end
|
|
@@ -484,7 +520,7 @@ EOS
|
|
|
484
520
|
|
|
485
521
|
def test_image_with_metric
|
|
486
522
|
def @chapter.image(_id)
|
|
487
|
-
item = Book::
|
|
523
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
|
488
524
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
|
489
525
|
item
|
|
490
526
|
end
|
|
@@ -495,7 +531,7 @@ EOS
|
|
|
495
531
|
|
|
496
532
|
def test_image_with_metric2
|
|
497
533
|
def @chapter.image(_id)
|
|
498
|
-
item = Book::
|
|
534
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
|
499
535
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
|
500
536
|
item
|
|
501
537
|
end
|
|
@@ -506,7 +542,7 @@ EOS
|
|
|
506
542
|
|
|
507
543
|
def test_indepimage
|
|
508
544
|
def @chapter.image(_id)
|
|
509
|
-
item = Book::
|
|
545
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
|
510
546
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
|
511
547
|
item
|
|
512
548
|
end
|
|
@@ -517,7 +553,7 @@ EOS
|
|
|
517
553
|
|
|
518
554
|
def test_indepimage_without_caption
|
|
519
555
|
def @chapter.image(_id)
|
|
520
|
-
item = Book::
|
|
556
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
|
521
557
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
|
522
558
|
item
|
|
523
559
|
end
|
|
@@ -528,7 +564,7 @@ EOS
|
|
|
528
564
|
|
|
529
565
|
def test_indepimage_with_metric
|
|
530
566
|
def @chapter.image(_id)
|
|
531
|
-
item = Book::
|
|
567
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
|
532
568
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
|
533
569
|
item
|
|
534
570
|
end
|
|
@@ -539,7 +575,7 @@ EOS
|
|
|
539
575
|
|
|
540
576
|
def test_indepimage_with_metric2
|
|
541
577
|
def @chapter.image(_id)
|
|
542
|
-
item = Book::
|
|
578
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
|
543
579
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
|
544
580
|
item
|
|
545
581
|
end
|
|
@@ -550,7 +586,7 @@ EOS
|
|
|
550
586
|
|
|
551
587
|
def test_indepimage_without_caption_but_with_metric
|
|
552
588
|
def @chapter.image(_id)
|
|
553
|
-
item = Book::
|
|
589
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
|
554
590
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
|
555
591
|
item
|
|
556
592
|
end
|
|
@@ -628,7 +664,7 @@ EOS
|
|
|
628
664
|
|
|
629
665
|
def test_column_in_aother_chapter_ref
|
|
630
666
|
def @chapter.column_index
|
|
631
|
-
items = [Book::
|
|
667
|
+
items = [Book::Index::Item.new('chap1|column', 1, 'column_cap')]
|
|
632
668
|
Book::ColumnIndex.new(items)
|
|
633
669
|
end
|
|
634
670
|
|
|
@@ -657,9 +693,15 @@ EOS
|
|
|
657
693
|
* BBB
|
|
658
694
|
-BB
|
|
659
695
|
EOS
|
|
660
|
-
|
|
661
696
|
expected = <<-EOS.chomp
|
|
662
697
|
<ul><li aid:pstyle="ul-item">AAA-AA</li><li aid:pstyle="ul-item">BBB-BB</li></ul>
|
|
698
|
+
EOS
|
|
699
|
+
actual = compile_block(src)
|
|
700
|
+
assert_equal expected, actual
|
|
701
|
+
|
|
702
|
+
@book.config['join_lines_by_lang'] = true
|
|
703
|
+
expected = <<-EOS.chomp
|
|
704
|
+
<ul><li aid:pstyle="ul-item">AAA -AA</li><li aid:pstyle="ul-item">BBB -BB</li></ul>
|
|
663
705
|
EOS
|
|
664
706
|
actual = compile_block(src)
|
|
665
707
|
assert_equal expected, actual
|
|
@@ -777,24 +819,24 @@ EOS
|
|
|
777
819
|
|
|
778
820
|
def test_inline_imgref
|
|
779
821
|
def @chapter.image(_id)
|
|
780
|
-
item = Book::
|
|
822
|
+
item = Book::Index::Item.new('sampleimg', 1, 'sample photo')
|
|
781
823
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
|
782
824
|
item
|
|
783
825
|
end
|
|
784
826
|
|
|
785
|
-
actual = compile_block
|
|
827
|
+
actual = compile_block("@<imgref>{sampleimg}\n")
|
|
786
828
|
expected = %Q(<p><span type='image'>図1.1「sample photo」</span></p>)
|
|
787
829
|
assert_equal expected, actual
|
|
788
830
|
end
|
|
789
831
|
|
|
790
832
|
def test_inline_imgref2
|
|
791
833
|
def @chapter.image(_id)
|
|
792
|
-
item = Book::
|
|
834
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
|
793
835
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
|
794
836
|
item
|
|
795
837
|
end
|
|
796
838
|
|
|
797
|
-
actual = compile_block
|
|
839
|
+
actual = compile_block("@<imgref>{sampleimg}\n")
|
|
798
840
|
expected = %Q(<p><span type='image'>図1.1</span></p>)
|
|
799
841
|
assert_equal expected, actual
|
|
800
842
|
end
|
data/test/test_image_finder.rb
CHANGED
|
@@ -19,7 +19,7 @@ class ImageFinderTest < Test::Unit::TestCase
|
|
|
19
19
|
finder = ReVIEW::Book::ImageFinder.new(dir, 'ch01', 'builder', ['.jpg'])
|
|
20
20
|
assert_equal(path, finder.find_path('foo'))
|
|
21
21
|
ensure
|
|
22
|
-
FileUtils.remove_entry_secure
|
|
22
|
+
FileUtils.remove_entry_secure(dir)
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -33,7 +33,7 @@ class ImageFinderTest < Test::Unit::TestCase
|
|
|
33
33
|
finder = ReVIEW::Book::ImageFinder.new(dir, 'ch01', 'builder', ['.jpg'])
|
|
34
34
|
assert_equal(path, finder.find_path('foo'))
|
|
35
35
|
ensure
|
|
36
|
-
FileUtils.remove_entry_secure
|
|
36
|
+
FileUtils.remove_entry_secure(dir)
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
@@ -47,7 +47,7 @@ class ImageFinderTest < Test::Unit::TestCase
|
|
|
47
47
|
finder = ReVIEW::Book::ImageFinder.new(dir, 'ch01', 'builder', ['.jpg'])
|
|
48
48
|
assert_equal(path, finder.find_path('foo'))
|
|
49
49
|
ensure
|
|
50
|
-
FileUtils.remove_entry_secure
|
|
50
|
+
FileUtils.remove_entry_secure(dir)
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -61,7 +61,7 @@ class ImageFinderTest < Test::Unit::TestCase
|
|
|
61
61
|
finder = ReVIEW::Book::ImageFinder.new(dir, 'ch01', 'builder', ['.jpg'])
|
|
62
62
|
assert_equal(path, finder.find_path('foo'))
|
|
63
63
|
ensure
|
|
64
|
-
FileUtils.remove_entry_secure
|
|
64
|
+
FileUtils.remove_entry_secure(dir)
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
|
|
@@ -75,7 +75,7 @@ class ImageFinderTest < Test::Unit::TestCase
|
|
|
75
75
|
finder = ReVIEW::Book::ImageFinder.new(dir, 'ch01', 'builder', ['.jpg'])
|
|
76
76
|
assert_equal(path, finder.find_path('foo'))
|
|
77
77
|
ensure
|
|
78
|
-
FileUtils.remove_entry_secure
|
|
78
|
+
FileUtils.remove_entry_secure(dir)
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
|
|
@@ -93,7 +93,7 @@ class ImageFinderTest < Test::Unit::TestCase
|
|
|
93
93
|
finder = ReVIEW::Book::ImageFinder.new(dir, 'ch01', 'builder', ['.jpg'])
|
|
94
94
|
assert_equal(path_dstimg, finder.find_path('foo'))
|
|
95
95
|
ensure
|
|
96
|
-
FileUtils.remove_entry_secure
|
|
96
|
+
FileUtils.remove_entry_secure(dir)
|
|
97
97
|
end
|
|
98
98
|
end
|
|
99
99
|
end
|