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
@@ -1,1211 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'review/compiler'
|
3
|
-
require 'review/book'
|
4
|
-
require 'review/plaintextbuilder'
|
5
|
-
require 'review/i18n'
|
6
|
-
|
7
|
-
class PLAINTEXTBuidlerTest < Test::Unit::TestCase
|
8
|
-
include ReVIEW
|
9
|
-
|
10
|
-
def setup
|
11
|
-
@builder = PLAINTEXTBuilder.new
|
12
|
-
@config = ReVIEW::Configure.values
|
13
|
-
@config['secnolevel'] = 2
|
14
|
-
@config['language'] = 'ja'
|
15
|
-
@book = Book::Base.new
|
16
|
-
@book.config = @config
|
17
|
-
@log_io = StringIO.new
|
18
|
-
ReVIEW.logger = ReVIEW::Logger.new(@log_io)
|
19
|
-
@compiler = ReVIEW::Compiler.new(@builder)
|
20
|
-
@chapter = Book::Chapter.new(@book, 1, '-', nil, StringIO.new)
|
21
|
-
location = Location.new(nil, nil)
|
22
|
-
@builder.bind(@compiler, @chapter, location)
|
23
|
-
|
24
|
-
@builder.instance_eval do
|
25
|
-
# to ignore lineno in original method
|
26
|
-
def warn(msg)
|
27
|
-
puts msg
|
28
|
-
end
|
29
|
-
end
|
30
|
-
I18n.setup(@config['language'])
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_headline_level1
|
34
|
-
actual = compile_block("={test} this is test.\n")
|
35
|
-
assert_equal %Q(第1章 this is test.\n), actual
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_headline_level1_without_secno
|
39
|
-
@config['secnolevel'] = 0
|
40
|
-
actual = compile_block("={test} this is test.\n")
|
41
|
-
assert_equal %Q(this is test.\n), actual
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_headline_level2
|
45
|
-
actual = compile_block("=={test} this is test.\n")
|
46
|
-
assert_equal %Q(1.1 this is test.\n), actual
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_headline_level3
|
50
|
-
actual = compile_block("==={test} this is test.\n")
|
51
|
-
assert_equal %Q(this is test.\n), actual
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_headline_level3_with_secno
|
55
|
-
@config['secnolevel'] = 3
|
56
|
-
actual = compile_block("==={test} this is test.\n")
|
57
|
-
assert_equal %Q(1.0.1 this is test.\n), actual
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_href
|
61
|
-
actual = compile_inline('@<href>{http://github.com, GitHub}')
|
62
|
-
assert_equal 'GitHub(http://github.com)', actual
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_href_without_label
|
66
|
-
actual = compile_inline('@<href>{http://github.com}')
|
67
|
-
assert_equal 'http://github.com', actual
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_inline_sec
|
71
|
-
def @chapter.headline_index
|
72
|
-
item = Book::Index::Item.new('chap1|test', [1, 1], 'te_st<>')
|
73
|
-
idx = Book::HeadlineIndex.new(self)
|
74
|
-
idx.add_item(item)
|
75
|
-
idx
|
76
|
-
end
|
77
|
-
|
78
|
-
@config['secnolevel'] = 3
|
79
|
-
actual = compile_inline('test @<secref>{test}')
|
80
|
-
assert_equal 'test 「1.1.1 te_st<>」', actual
|
81
|
-
actual = compile_inline('test @<sectitle>{test}')
|
82
|
-
assert_equal 'test te_st<>', actual
|
83
|
-
actual = compile_inline('test @<sec>{test}')
|
84
|
-
assert_equal 'test 1.1.1', actual
|
85
|
-
|
86
|
-
@config['secnolevel'] = 2
|
87
|
-
actual = compile_inline('test @<secref>{test}')
|
88
|
-
assert_equal 'test 「te_st<>」', actual
|
89
|
-
actual = compile_inline('test @<sectitle>{test}')
|
90
|
-
assert_equal 'test te_st<>', actual
|
91
|
-
assert_raises(ReVIEW::ApplicationError) { compile_block('test @<sec>{test}') }
|
92
|
-
assert_match(/the target headline doesn't have a number/, @log_io.string)
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_inline_raw
|
96
|
-
actual = compile_inline('@<raw>{@<tt>{inline\}}')
|
97
|
-
assert_equal '@<tt>{inline}', actual
|
98
|
-
end
|
99
|
-
|
100
|
-
def test_inline_ruby
|
101
|
-
actual = compile_inline('@<ruby>{coffin,bed}')
|
102
|
-
assert_equal 'coffin', actual
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_inline_kw
|
106
|
-
actual = compile_inline('@<kw>{ISO, International Organization for Standardization } @<kw>{Ruby<>}')
|
107
|
-
assert_equal 'ISO(International Organization for Standardization) Ruby<>', actual
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_inline_maru
|
111
|
-
actual = compile_inline('@<maru>{1}@<maru>{20}@<maru>{A}@<maru>{z}')
|
112
|
-
assert_equal '120Az', actual
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_inline_br
|
116
|
-
actual = compile_inline('@<br>{}')
|
117
|
-
assert_equal "\n", actual
|
118
|
-
end
|
119
|
-
|
120
|
-
def test_inline_asis
|
121
|
-
%w[i b tti ttb bou ami u strong em code ins tcy].each do |tag|
|
122
|
-
actual = compile_inline("test @<#{tag}>{inline test} test2")
|
123
|
-
assert_equal 'test inline test test2', actual
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_inline_del
|
128
|
-
actual = compile_inline('test @<del>{inline test} test2')
|
129
|
-
assert_equal 'test test2', actual
|
130
|
-
end
|
131
|
-
|
132
|
-
def test_inline_i_and_escape
|
133
|
-
actual = compile_inline('test @<i>{inline<&;\\ test} test2')
|
134
|
-
assert_equal 'test inline<&;\\ test test2', actual
|
135
|
-
end
|
136
|
-
|
137
|
-
def test_inline_b_and_escape
|
138
|
-
actual = compile_inline('test @<b>{inline<&;\\ test} test2')
|
139
|
-
assert_equal 'test inline<&;\\ test test2', actual
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_inline_tt
|
143
|
-
actual = compile_inline('test @<tt>{inline test} test2@<tt>{\\}}')
|
144
|
-
assert_equal 'test inline test test2}', actual
|
145
|
-
end
|
146
|
-
|
147
|
-
def test_inline_uchar
|
148
|
-
actual = compile_inline('test @<uchar>{2460} test2')
|
149
|
-
assert_equal 'test ① test2', actual
|
150
|
-
end
|
151
|
-
|
152
|
-
def test_inline_comment
|
153
|
-
actual = compile_inline('test @<comment>{コメント} test2')
|
154
|
-
assert_equal 'test test2', actual
|
155
|
-
end
|
156
|
-
|
157
|
-
def test_inline_comment_for_draft
|
158
|
-
@config['draft'] = true
|
159
|
-
actual = compile_inline('test @<comment>{コメント} test2')
|
160
|
-
assert_equal 'test test2', actual
|
161
|
-
end
|
162
|
-
|
163
|
-
def test_inline_in_table
|
164
|
-
actual = compile_block("//table{\n★1☆\t▲2☆\n------------\n★3☆\t▲4☆<>&\n//}\n")
|
165
|
-
expected = <<-EOS
|
166
|
-
★1☆\t▲2☆
|
167
|
-
★3☆\t▲4☆<>&
|
168
|
-
|
169
|
-
EOS
|
170
|
-
assert_equal expected, actual
|
171
|
-
end
|
172
|
-
|
173
|
-
def test_dlist_beforeulol
|
174
|
-
actual = compile_block(" : foo\n foo.\n\npara\n\n : foo\n foo.\n\n 1. bar\n\n : foo\n foo.\n\n * bar\n")
|
175
|
-
expected = <<-EOS
|
176
|
-
foo
|
177
|
-
foo.
|
178
|
-
|
179
|
-
para
|
180
|
-
|
181
|
-
foo
|
182
|
-
foo.
|
183
|
-
|
184
|
-
1 bar
|
185
|
-
|
186
|
-
foo
|
187
|
-
foo.
|
188
|
-
|
189
|
-
bar
|
190
|
-
|
191
|
-
EOS
|
192
|
-
assert_equal expected, actual
|
193
|
-
end
|
194
|
-
|
195
|
-
def test_paragraph
|
196
|
-
actual = compile_block("foo\nbar\n")
|
197
|
-
assert_equal %Q(foobar\n), actual
|
198
|
-
|
199
|
-
@book.config['join_lines_by_lang'] = true
|
200
|
-
actual = compile_block("foo\nbar\n")
|
201
|
-
assert_equal %Q(foo bar\n), actual
|
202
|
-
end
|
203
|
-
|
204
|
-
def test_tabbed_paragraph
|
205
|
-
actual = compile_block("\tfoo\nbar\n")
|
206
|
-
assert_equal %Q(\tfoobar\n), actual
|
207
|
-
|
208
|
-
@book.config['join_lines_by_lang'] = true
|
209
|
-
actual = compile_block("\tfoo\nbar\n")
|
210
|
-
assert_equal %Q(\tfoo bar\n), actual
|
211
|
-
end
|
212
|
-
|
213
|
-
def test_flushright
|
214
|
-
actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
|
215
|
-
expected = <<-EOS
|
216
|
-
foobar
|
217
|
-
buz
|
218
|
-
|
219
|
-
EOS
|
220
|
-
assert_equal expected, actual
|
221
|
-
|
222
|
-
@book.config['join_lines_by_lang'] = true
|
223
|
-
actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
|
224
|
-
expected = <<-EOS
|
225
|
-
foo bar
|
226
|
-
buz
|
227
|
-
|
228
|
-
EOS
|
229
|
-
assert_equal expected, actual
|
230
|
-
end
|
231
|
-
|
232
|
-
def test_noindent
|
233
|
-
actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
|
234
|
-
expected = <<-EOS
|
235
|
-
foobar
|
236
|
-
foo2bar2
|
237
|
-
EOS
|
238
|
-
assert_equal expected, actual
|
239
|
-
|
240
|
-
@book.config['join_lines_by_lang'] = true
|
241
|
-
actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
|
242
|
-
expected = <<-EOS
|
243
|
-
foo bar
|
244
|
-
foo2 bar2
|
245
|
-
EOS
|
246
|
-
assert_equal expected, actual
|
247
|
-
end
|
248
|
-
|
249
|
-
def test_comment
|
250
|
-
actual = compile_block('//comment[コメント]')
|
251
|
-
assert_equal '', actual
|
252
|
-
end
|
253
|
-
|
254
|
-
def test_comment_for_draft
|
255
|
-
@config['draft'] = true
|
256
|
-
actual = compile_block('//comment[コメント]')
|
257
|
-
assert_equal '', actual
|
258
|
-
end
|
259
|
-
|
260
|
-
def test_list
|
261
|
-
def @chapter.list(_id)
|
262
|
-
Book::Index::Item.new('test', 1)
|
263
|
-
end
|
264
|
-
actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
265
|
-
expected = <<-EOS
|
266
|
-
リスト1.1 this is test<&>_
|
267
|
-
|
268
|
-
foo
|
269
|
-
bar
|
270
|
-
|
271
|
-
EOS
|
272
|
-
assert_equal expected, actual
|
273
|
-
|
274
|
-
@config['caption_position']['list'] = 'bottom'
|
275
|
-
actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
276
|
-
expected = <<-EOS
|
277
|
-
foo
|
278
|
-
bar
|
279
|
-
|
280
|
-
リスト1.1 this is test<&>_
|
281
|
-
|
282
|
-
EOS
|
283
|
-
assert_equal expected, actual
|
284
|
-
end
|
285
|
-
|
286
|
-
def test_listnum
|
287
|
-
def @chapter.list(_id)
|
288
|
-
Book::Index::Item.new('test', 1)
|
289
|
-
end
|
290
|
-
actual = compile_block("//listnum[test][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
291
|
-
expected = <<-EOS
|
292
|
-
リスト1.1 this is test<&>_
|
293
|
-
|
294
|
-
1: foo
|
295
|
-
2: bar
|
296
|
-
|
297
|
-
EOS
|
298
|
-
assert_equal expected, actual
|
299
|
-
|
300
|
-
@config['caption_position']['list'] = 'bottom'
|
301
|
-
actual = compile_block("//listnum[test][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
302
|
-
expected = <<-EOS
|
303
|
-
1: foo
|
304
|
-
2: bar
|
305
|
-
|
306
|
-
リスト1.1 this is test<&>_
|
307
|
-
|
308
|
-
EOS
|
309
|
-
assert_equal expected, actual
|
310
|
-
end
|
311
|
-
|
312
|
-
def test_source
|
313
|
-
actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
|
314
|
-
expected = <<-EOS
|
315
|
-
foo/bar/test.rb
|
316
|
-
foo
|
317
|
-
bar
|
318
|
-
|
319
|
-
buz
|
320
|
-
|
321
|
-
EOS
|
322
|
-
assert_equal expected, actual
|
323
|
-
|
324
|
-
@config['caption_position']['list'] = 'bottom'
|
325
|
-
actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
|
326
|
-
expected = <<-EOS
|
327
|
-
foo
|
328
|
-
bar
|
329
|
-
|
330
|
-
buz
|
331
|
-
foo/bar/test.rb
|
332
|
-
|
333
|
-
EOS
|
334
|
-
assert_equal expected, actual
|
335
|
-
end
|
336
|
-
|
337
|
-
def test_source_empty_caption
|
338
|
-
actual = compile_block("//source[]{\nfoo\nbar\n\nbuz\n//}\n")
|
339
|
-
expected = <<-EOS
|
340
|
-
foo
|
341
|
-
bar
|
342
|
-
|
343
|
-
buz
|
344
|
-
|
345
|
-
EOS
|
346
|
-
assert_equal expected, actual
|
347
|
-
end
|
348
|
-
|
349
|
-
def test_box
|
350
|
-
actual = compile_block("//box{\nfoo\nbar\n//}\n")
|
351
|
-
expected = <<-EOS
|
352
|
-
foo
|
353
|
-
bar
|
354
|
-
|
355
|
-
EOS
|
356
|
-
assert_equal expected, actual
|
357
|
-
|
358
|
-
actual = compile_block("//box[FOO]{\nfoo\nbar\n//}\n")
|
359
|
-
expected = <<-EOS
|
360
|
-
FOO
|
361
|
-
foo
|
362
|
-
bar
|
363
|
-
|
364
|
-
EOS
|
365
|
-
assert_equal expected, actual
|
366
|
-
|
367
|
-
@config['caption_position']['list'] = 'bottom'
|
368
|
-
actual = compile_block("//box[FOO]{\nfoo\nbar\n//}\n")
|
369
|
-
expected = <<-EOS
|
370
|
-
foo
|
371
|
-
bar
|
372
|
-
FOO
|
373
|
-
|
374
|
-
EOS
|
375
|
-
assert_equal expected, actual
|
376
|
-
end
|
377
|
-
|
378
|
-
def test_cmd
|
379
|
-
actual = compile_block("//cmd{\nlineA\nlineB\n//}\n")
|
380
|
-
expected = <<-EOS
|
381
|
-
lineA
|
382
|
-
lineB
|
383
|
-
|
384
|
-
EOS
|
385
|
-
assert_equal expected, actual
|
386
|
-
|
387
|
-
actual = compile_block("//cmd[cap1]{\nlineA\nlineB\n//}\n")
|
388
|
-
expected = <<-EOS
|
389
|
-
cap1
|
390
|
-
lineA
|
391
|
-
lineB
|
392
|
-
|
393
|
-
EOS
|
394
|
-
assert_equal expected, actual
|
395
|
-
|
396
|
-
@config['caption_position']['list'] = 'bottom'
|
397
|
-
actual = compile_block("//cmd[cap1]{\nlineA\nlineB\n//}\n")
|
398
|
-
expected = <<-EOS
|
399
|
-
lineA
|
400
|
-
lineB
|
401
|
-
cap1
|
402
|
-
|
403
|
-
EOS
|
404
|
-
assert_equal expected, actual
|
405
|
-
end
|
406
|
-
|
407
|
-
def test_emlist
|
408
|
-
actual = compile_block("//emlist{\nlineA\nlineB\n//}\n")
|
409
|
-
expected = <<-EOS
|
410
|
-
lineA
|
411
|
-
lineB
|
412
|
-
|
413
|
-
EOS
|
414
|
-
assert_equal expected, actual
|
415
|
-
end
|
416
|
-
|
417
|
-
def test_emlist_caption
|
418
|
-
actual = compile_block("//emlist[cap1]{\nlineA\nlineB\n//}\n")
|
419
|
-
expected = <<-EOS
|
420
|
-
cap1
|
421
|
-
lineA
|
422
|
-
lineB
|
423
|
-
|
424
|
-
EOS
|
425
|
-
assert_equal expected, actual
|
426
|
-
|
427
|
-
@config['caption_position']['list'] = 'bottom'
|
428
|
-
actual = compile_block("//emlist[cap1]{\nlineA\nlineB\n//}\n")
|
429
|
-
expected = <<-EOS
|
430
|
-
lineA
|
431
|
-
lineB
|
432
|
-
cap1
|
433
|
-
|
434
|
-
EOS
|
435
|
-
assert_equal expected, actual
|
436
|
-
end
|
437
|
-
|
438
|
-
def test_emlistnum
|
439
|
-
actual = compile_block("//emlistnum[this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
440
|
-
expected = <<-EOS
|
441
|
-
this is test<&>_
|
442
|
-
1: foo
|
443
|
-
2: bar
|
444
|
-
|
445
|
-
EOS
|
446
|
-
assert_equal expected, actual
|
447
|
-
|
448
|
-
@config['caption_position']['list'] = 'bottom'
|
449
|
-
actual = compile_block("//emlistnum[this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
450
|
-
expected = <<-EOS
|
451
|
-
1: foo
|
452
|
-
2: bar
|
453
|
-
this is test<&>_
|
454
|
-
|
455
|
-
EOS
|
456
|
-
assert_equal expected, actual
|
457
|
-
end
|
458
|
-
|
459
|
-
def test_bib
|
460
|
-
def @chapter.bibpaper(_id)
|
461
|
-
Book::Index::Item.new('samplebib', 1, 'sample bib')
|
462
|
-
end
|
463
|
-
|
464
|
-
assert_equal '1 ', compile_inline('@<bib>{samplebib}')
|
465
|
-
end
|
466
|
-
|
467
|
-
def test_table
|
468
|
-
actual = compile_block("//table{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
469
|
-
expected = <<-EOS
|
470
|
-
aaa\tbbb
|
471
|
-
ccc\tddd<>&
|
472
|
-
|
473
|
-
EOS
|
474
|
-
assert_equal expected, actual
|
475
|
-
|
476
|
-
actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
477
|
-
expected = <<-EOS
|
478
|
-
表1.1 FOO
|
479
|
-
|
480
|
-
aaa\tbbb
|
481
|
-
ccc\tddd<>&
|
482
|
-
|
483
|
-
EOS
|
484
|
-
assert_equal expected, actual
|
485
|
-
|
486
|
-
@config['caption_position']['table'] = 'bottom'
|
487
|
-
actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
488
|
-
expected = <<-EOS
|
489
|
-
aaa\tbbb
|
490
|
-
ccc\tddd<>&
|
491
|
-
|
492
|
-
表1.1 FOO
|
493
|
-
EOS
|
494
|
-
assert_equal expected, actual
|
495
|
-
end
|
496
|
-
|
497
|
-
def test_empty_table
|
498
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n//}\n") }
|
499
|
-
assert_equal 'no rows in the table', e.message
|
500
|
-
|
501
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n------------\n//}\n") }
|
502
|
-
assert_equal 'no rows in the table', e.message
|
503
|
-
end
|
504
|
-
|
505
|
-
def test_inline_table
|
506
|
-
def @chapter.table(_id)
|
507
|
-
Book::Index::Item.new('sampletable', 1)
|
508
|
-
end
|
509
|
-
actual = compile_block("@<table>{sampletest}\n")
|
510
|
-
assert_equal "表1.1\n", actual
|
511
|
-
end
|
512
|
-
|
513
|
-
def test_emtable
|
514
|
-
actual = compile_block("//emtable[foo]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n//emtable{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
515
|
-
expected = <<-EOS
|
516
|
-
foo
|
517
|
-
|
518
|
-
aaa\tbbb
|
519
|
-
ccc\tddd<>&
|
520
|
-
|
521
|
-
aaa\tbbb
|
522
|
-
ccc\tddd<>&
|
523
|
-
|
524
|
-
EOS
|
525
|
-
assert_equal expected, actual
|
526
|
-
end
|
527
|
-
|
528
|
-
def test_major_blocks
|
529
|
-
actual = compile_block("//note{\nA\n\nB\n//}\n//note[caption]{\nA\n//}")
|
530
|
-
expected = <<-EOS
|
531
|
-
A
|
532
|
-
B
|
533
|
-
|
534
|
-
caption
|
535
|
-
A
|
536
|
-
|
537
|
-
EOS
|
538
|
-
assert_equal expected, actual
|
539
|
-
|
540
|
-
actual = compile_block("//memo{\nA\n\nB\n//}\n//memo[caption]{\nA\n//}")
|
541
|
-
expected = <<-EOS
|
542
|
-
A
|
543
|
-
B
|
544
|
-
|
545
|
-
caption
|
546
|
-
A
|
547
|
-
|
548
|
-
EOS
|
549
|
-
assert_equal expected, actual
|
550
|
-
|
551
|
-
actual = compile_block("//info{\nA\n\nB\n//}\n//info[caption]{\nA\n//}")
|
552
|
-
expected = <<-EOS
|
553
|
-
A
|
554
|
-
B
|
555
|
-
|
556
|
-
caption
|
557
|
-
A
|
558
|
-
|
559
|
-
EOS
|
560
|
-
assert_equal expected, actual
|
561
|
-
|
562
|
-
actual = compile_block("//important{\nA\n\nB\n//}\n//important[caption]{\nA\n//}")
|
563
|
-
expected = <<-EOS
|
564
|
-
A
|
565
|
-
B
|
566
|
-
|
567
|
-
caption
|
568
|
-
A
|
569
|
-
|
570
|
-
EOS
|
571
|
-
assert_equal expected, actual
|
572
|
-
|
573
|
-
actual = compile_block("//caution{\nA\n\nB\n//}\n//caution[caption]{\nA\n//}")
|
574
|
-
expected = <<-EOS
|
575
|
-
A
|
576
|
-
B
|
577
|
-
|
578
|
-
caption
|
579
|
-
A
|
580
|
-
|
581
|
-
EOS
|
582
|
-
assert_equal expected, actual
|
583
|
-
|
584
|
-
actual = compile_block("//notice{\nA\n\nB\n//}\n//notice[caption]{\nA\n//}")
|
585
|
-
expected = <<-EOS
|
586
|
-
A
|
587
|
-
B
|
588
|
-
|
589
|
-
caption
|
590
|
-
A
|
591
|
-
|
592
|
-
EOS
|
593
|
-
assert_equal expected, actual
|
594
|
-
|
595
|
-
actual = compile_block("//warning{\nA\n\nB\n//}\n//warning[caption]{\nA\n//}")
|
596
|
-
expected = <<-EOS
|
597
|
-
A
|
598
|
-
B
|
599
|
-
|
600
|
-
caption
|
601
|
-
A
|
602
|
-
|
603
|
-
EOS
|
604
|
-
assert_equal expected, actual
|
605
|
-
|
606
|
-
actual = compile_block("//tip{\nA\n\nB\n//}\n//tip[caption]{\nA\n//}")
|
607
|
-
expected = <<-EOS
|
608
|
-
A
|
609
|
-
B
|
610
|
-
|
611
|
-
caption
|
612
|
-
A
|
613
|
-
|
614
|
-
EOS
|
615
|
-
assert_equal expected, actual
|
616
|
-
end
|
617
|
-
|
618
|
-
def test_minicolumn_blocks
|
619
|
-
%w[note memo tip info warning important caution notice].each do |type|
|
620
|
-
@builder.doc_status.clear
|
621
|
-
src = <<-EOS
|
622
|
-
//#{type}[#{type}1]{
|
623
|
-
|
624
|
-
//}
|
625
|
-
|
626
|
-
//#{type}[#{type}2]{
|
627
|
-
//}
|
628
|
-
EOS
|
629
|
-
|
630
|
-
expected = <<-EOS
|
631
|
-
#{type}1
|
632
|
-
|
633
|
-
#{type}2
|
634
|
-
|
635
|
-
EOS
|
636
|
-
assert_equal expected, compile_block(src)
|
637
|
-
|
638
|
-
src = <<-EOS
|
639
|
-
//#{type}[#{type}2]{
|
640
|
-
|
641
|
-
//}
|
642
|
-
|
643
|
-
//#{type}[#{type}3]{
|
644
|
-
|
645
|
-
//}
|
646
|
-
|
647
|
-
//#{type}[#{type}4]{
|
648
|
-
|
649
|
-
//}
|
650
|
-
|
651
|
-
//#{type}[#{type}5]{
|
652
|
-
|
653
|
-
//}
|
654
|
-
|
655
|
-
//#{type}[#{type}6]{
|
656
|
-
|
657
|
-
//}
|
658
|
-
EOS
|
659
|
-
|
660
|
-
expected = <<-EOS
|
661
|
-
#{type}2
|
662
|
-
|
663
|
-
#{type}3
|
664
|
-
|
665
|
-
#{type}4
|
666
|
-
|
667
|
-
#{type}5
|
668
|
-
|
669
|
-
#{type}6
|
670
|
-
|
671
|
-
EOS
|
672
|
-
assert_equal expected, compile_block(src)
|
673
|
-
|
674
|
-
src = <<-EOS
|
675
|
-
//#{type}{
|
676
|
-
|
677
|
-
* A
|
678
|
-
|
679
|
-
1. B
|
680
|
-
|
681
|
-
//}
|
682
|
-
|
683
|
-
//#{type}[OMITEND1]{
|
684
|
-
|
685
|
-
//emlist{
|
686
|
-
LIST
|
687
|
-
//}
|
688
|
-
|
689
|
-
//}
|
690
|
-
//#{type}[OMITEND2]{
|
691
|
-
//}
|
692
|
-
EOS
|
693
|
-
|
694
|
-
expected = <<-EOS
|
695
|
-
A
|
696
|
-
|
697
|
-
1 B
|
698
|
-
|
699
|
-
OMITEND1
|
700
|
-
|
701
|
-
LIST
|
702
|
-
|
703
|
-
OMITEND2
|
704
|
-
|
705
|
-
EOS
|
706
|
-
assert_equal expected, compile_block(src)
|
707
|
-
end
|
708
|
-
end
|
709
|
-
|
710
|
-
def test_minicolumn_blocks_nest_error1
|
711
|
-
%w[note memo tip info warning important caution notice].each do |type|
|
712
|
-
@builder.doc_status.clear
|
713
|
-
src = <<-EOS
|
714
|
-
//#{type}{
|
715
|
-
|
716
|
-
//#{type}{
|
717
|
-
//}
|
718
|
-
|
719
|
-
//}
|
720
|
-
EOS
|
721
|
-
assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
722
|
-
assert_match(/minicolumn cannot be nested:/, @log_io.string)
|
723
|
-
end
|
724
|
-
end
|
725
|
-
|
726
|
-
def test_minicolumn_blocks_nest_error2
|
727
|
-
%w[note memo tip info warning important caution notice].each do |type|
|
728
|
-
@builder.doc_status.clear
|
729
|
-
src = <<-EOS
|
730
|
-
//#{type}{
|
731
|
-
|
732
|
-
//#{type}{
|
733
|
-
|
734
|
-
//}
|
735
|
-
|
736
|
-
//}
|
737
|
-
EOS
|
738
|
-
assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
739
|
-
assert_match(/minicolumn cannot be nested:/, @log_io.string)
|
740
|
-
end
|
741
|
-
end
|
742
|
-
|
743
|
-
def test_minicolumn_blocks_nest_error3
|
744
|
-
%w[memo tip info warning important caution notice].each do |type|
|
745
|
-
@builder.doc_status.clear
|
746
|
-
src = <<-EOS
|
747
|
-
//#{type}{
|
748
|
-
|
749
|
-
//note{
|
750
|
-
//}
|
751
|
-
|
752
|
-
//}
|
753
|
-
EOS
|
754
|
-
assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
755
|
-
assert_match(/minicolumn cannot be nested:/, @log_io.string)
|
756
|
-
end
|
757
|
-
end
|
758
|
-
|
759
|
-
def test_image
|
760
|
-
def @chapter.image(_id)
|
761
|
-
item = Book::Index::Item.new('sampleimg', 1)
|
762
|
-
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
763
|
-
item
|
764
|
-
end
|
765
|
-
|
766
|
-
actual = compile_block("//image[sampleimg][sample photo]{\nfoo\n//}\n")
|
767
|
-
assert_equal %Q(図1.1 sample photo\n\n), actual
|
768
|
-
|
769
|
-
@config['caption_position']['image'] = 'top'
|
770
|
-
actual = compile_block("//image[sampleimg][sample photo]{\nfoo\n//}\n")
|
771
|
-
assert_equal %Q(図1.1 sample photo\n\n), actual
|
772
|
-
end
|
773
|
-
|
774
|
-
def test_image_with_metric
|
775
|
-
def @chapter.image(_id)
|
776
|
-
item = Book::Index::Item.new('sampleimg', 1)
|
777
|
-
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
778
|
-
item
|
779
|
-
end
|
780
|
-
|
781
|
-
actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\nfoo\n//}\n")
|
782
|
-
assert_equal %Q(図1.1 sample photo\n\n), actual
|
783
|
-
end
|
784
|
-
|
785
|
-
def test_texequation
|
786
|
-
actual = compile_block("//texequation{\n\\sin\n1^{2}\n//}\n")
|
787
|
-
assert_equal %Q(\\sin\n1^{2}\n\n), actual
|
788
|
-
end
|
789
|
-
|
790
|
-
def test_endnote
|
791
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block("//endnote[foo][bar]\n\n@<endnote>{foo}\n") }
|
792
|
-
assert_equal ':4: //endnote is found but //printendnotes is not found.', e.message
|
793
|
-
|
794
|
-
actual = compile_block("@<endnote>{foo}\n//endnote[foo][bar]\n//printendnotes\n")
|
795
|
-
expected = <<-'EOS'
|
796
|
-
(1)
|
797
|
-
(1) bar
|
798
|
-
EOS
|
799
|
-
assert_equal expected, actual
|
800
|
-
end
|
801
|
-
|
802
|
-
def test_inline_unknown
|
803
|
-
assert_raises(ReVIEW::ApplicationError) { compile_block("@<img>{n}\n") }
|
804
|
-
assert_match(/unknown image: n/, @log_io.string)
|
805
|
-
|
806
|
-
@log_io.string = ''
|
807
|
-
assert_raises(ReVIEW::ApplicationError) { compile_block("@<fn>{n}\n") }
|
808
|
-
assert_match(/unknown footnote: n/, @log_io.string)
|
809
|
-
|
810
|
-
@log_io.string = ''
|
811
|
-
assert_raises(ReVIEW::ApplicationError) { compile_block("@<endnote>{n}\n") }
|
812
|
-
assert_match(/unknown endnote: n/, @log_io.string)
|
813
|
-
|
814
|
-
@log_io.string = ''
|
815
|
-
assert_raises(ReVIEW::ApplicationError) { compile_block("@<hd>{n}\n") }
|
816
|
-
assert_match(/unknown headline: n/, @log_io.string)
|
817
|
-
%w[list table column].each do |name|
|
818
|
-
@log_io.string = ''
|
819
|
-
assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
|
820
|
-
assert_match(/unknown #{name}: n/, @log_io.string)
|
821
|
-
end
|
822
|
-
%w[chap chapref title].each do |name|
|
823
|
-
@log_io.string = ''
|
824
|
-
assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
|
825
|
-
assert_match(/key not found: "n"/, @log_io.string)
|
826
|
-
end
|
827
|
-
end
|
828
|
-
|
829
|
-
def test_inline_raw0
|
830
|
-
assert_equal 'normal', compile_inline('@<raw>{normal}')
|
831
|
-
end
|
832
|
-
|
833
|
-
def test_inline_raw1
|
834
|
-
assert_equal 'body', compile_inline('@<raw>{|plaintext|body}')
|
835
|
-
end
|
836
|
-
|
837
|
-
def test_inline_raw2
|
838
|
-
assert_equal 'body', compile_inline('@<raw>{|plaintext, latex|body}')
|
839
|
-
end
|
840
|
-
|
841
|
-
def test_inline_raw3
|
842
|
-
assert_equal '', compile_inline('@<raw>{|idgxml, html|body}')
|
843
|
-
end
|
844
|
-
|
845
|
-
def test_inline_raw4
|
846
|
-
assert_equal '|plaintext body', compile_inline('@<raw>{|plaintext body}')
|
847
|
-
end
|
848
|
-
|
849
|
-
def test_inline_raw5
|
850
|
-
assert_equal "nor\nmal", compile_inline('@<raw>{|plaintext|nor\\nmal}')
|
851
|
-
end
|
852
|
-
|
853
|
-
def test_block_raw0
|
854
|
-
actual = compile_block(%Q(//raw[<>!"\\n& ]\n))
|
855
|
-
expected = %Q(<>!"\n& )
|
856
|
-
assert_equal expected.chomp, actual
|
857
|
-
end
|
858
|
-
|
859
|
-
def test_block_raw1
|
860
|
-
actual = compile_block(%Q(//raw[|plaintext|<>!"\\n& ]\n))
|
861
|
-
expected = %Q(<>!"\n& )
|
862
|
-
assert_equal expected.chomp, actual
|
863
|
-
end
|
864
|
-
|
865
|
-
def test_block_raw2
|
866
|
-
actual = compile_block(%Q(//raw[|plaintext, latex|<>!"\\n& ]\n))
|
867
|
-
expected = %Q(<>!"\n& )
|
868
|
-
assert_equal expected.chomp, actual
|
869
|
-
end
|
870
|
-
|
871
|
-
def test_block_raw3
|
872
|
-
actual = compile_block(%Q(//raw[|latex, idgxml|<>!"\\n& ]\n))
|
873
|
-
expected = ''
|
874
|
-
assert_equal expected.chomp, actual
|
875
|
-
end
|
876
|
-
|
877
|
-
def test_block_raw4
|
878
|
-
actual = compile_block(%Q(//raw[|plaintext <>!"\\n& ]\n))
|
879
|
-
expected = %Q(|plaintext <>!"\n& )
|
880
|
-
assert_equal expected.chomp, actual
|
881
|
-
end
|
882
|
-
|
883
|
-
def column_helper(review)
|
884
|
-
compile_block(review)
|
885
|
-
end
|
886
|
-
|
887
|
-
def test_column_ref
|
888
|
-
review = <<-EOS
|
889
|
-
===[column]{foo} test
|
890
|
-
|
891
|
-
inside column
|
892
|
-
|
893
|
-
=== next level
|
894
|
-
|
895
|
-
this is @<column>{foo}.
|
896
|
-
EOS
|
897
|
-
expected = <<-EOS
|
898
|
-
test
|
899
|
-
inside column
|
900
|
-
|
901
|
-
next level
|
902
|
-
this is コラム「test」.
|
903
|
-
EOS
|
904
|
-
|
905
|
-
assert_equal expected, column_helper(review)
|
906
|
-
end
|
907
|
-
|
908
|
-
def test_texequation_with_caption
|
909
|
-
src = <<-EOS
|
910
|
-
@<eq>{emc2}
|
911
|
-
|
912
|
-
//texequation[emc2][The Equivalence of Mass @<i>{and} Energy]{
|
913
|
-
e=mc^2
|
914
|
-
//}
|
915
|
-
EOS
|
916
|
-
expected = <<-EOS
|
917
|
-
式1.1
|
918
|
-
|
919
|
-
式1.1 The Equivalence of Mass and Energy
|
920
|
-
e=mc^2
|
921
|
-
|
922
|
-
EOS
|
923
|
-
actual = compile_block(src)
|
924
|
-
assert_equal expected, actual
|
925
|
-
|
926
|
-
@config['caption_position']['equation'] = 'bottom'
|
927
|
-
expected = <<-EOS
|
928
|
-
式1.1
|
929
|
-
|
930
|
-
e=mc^2
|
931
|
-
式1.1 The Equivalence of Mass and Energy
|
932
|
-
|
933
|
-
EOS
|
934
|
-
actual = compile_block(src)
|
935
|
-
assert_equal expected, actual
|
936
|
-
end
|
937
|
-
|
938
|
-
def test_nest_error_open
|
939
|
-
src = <<-EOS
|
940
|
-
//endchild
|
941
|
-
EOS
|
942
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
943
|
-
assert_equal ":1: //endchild is shown, but any opened //beginchild doesn't exist", e.message
|
944
|
-
end
|
945
|
-
|
946
|
-
def test_nest_error_close1
|
947
|
-
src = <<-EOS
|
948
|
-
//beginchild
|
949
|
-
EOS
|
950
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
951
|
-
assert_equal ":1: //beginchild is shown, but previous element isn't ul, ol, or dl", e.message
|
952
|
-
end
|
953
|
-
|
954
|
-
def test_nest_error_close2
|
955
|
-
src = <<-EOS
|
956
|
-
* foo
|
957
|
-
|
958
|
-
//beginchild
|
959
|
-
|
960
|
-
1. foo
|
961
|
-
|
962
|
-
//beginchild
|
963
|
-
|
964
|
-
: foo
|
965
|
-
|
966
|
-
//beginchild
|
967
|
-
EOS
|
968
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
969
|
-
assert_equal ':12: //beginchild of dl,ol,ul misses //endchild', e.message
|
970
|
-
end
|
971
|
-
|
972
|
-
def test_nest_error_close3
|
973
|
-
src = <<-EOS
|
974
|
-
* foo
|
975
|
-
|
976
|
-
//beginchild
|
977
|
-
|
978
|
-
1. foo
|
979
|
-
|
980
|
-
//beginchild
|
981
|
-
|
982
|
-
: foo
|
983
|
-
|
984
|
-
//beginchild
|
985
|
-
|
986
|
-
//endchild
|
987
|
-
EOS
|
988
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
989
|
-
assert_equal ':14: //beginchild of ol,ul misses //endchild', e.message
|
990
|
-
end
|
991
|
-
|
992
|
-
def test_nest_ul
|
993
|
-
src = <<-EOS
|
994
|
-
* UL1
|
995
|
-
|
996
|
-
//beginchild
|
997
|
-
|
998
|
-
1. UL1-OL1
|
999
|
-
2. UL1-OL2
|
1000
|
-
|
1001
|
-
* UL1-UL1
|
1002
|
-
* UL1-UL2
|
1003
|
-
|
1004
|
-
: UL1-DL1
|
1005
|
-
UL1-DD1
|
1006
|
-
: UL1-DL2
|
1007
|
-
UL1-DD2
|
1008
|
-
|
1009
|
-
//endchild
|
1010
|
-
|
1011
|
-
* UL2
|
1012
|
-
|
1013
|
-
//beginchild
|
1014
|
-
|
1015
|
-
UL2-PARA
|
1016
|
-
|
1017
|
-
//endchild
|
1018
|
-
EOS
|
1019
|
-
|
1020
|
-
expected = <<-EOS
|
1021
|
-
UL1
|
1022
|
-
|
1023
|
-
1 UL1-OL1
|
1024
|
-
2 UL1-OL2
|
1025
|
-
|
1026
|
-
UL1-UL1
|
1027
|
-
UL1-UL2
|
1028
|
-
|
1029
|
-
UL1-DL1
|
1030
|
-
UL1-DD1
|
1031
|
-
UL1-DL2
|
1032
|
-
UL1-DD2
|
1033
|
-
|
1034
|
-
UL2
|
1035
|
-
UL2-PARA
|
1036
|
-
EOS
|
1037
|
-
|
1038
|
-
actual = compile_block(src)
|
1039
|
-
assert_equal expected, actual
|
1040
|
-
end
|
1041
|
-
|
1042
|
-
def test_nest_ol
|
1043
|
-
src = <<-EOS
|
1044
|
-
1. OL1
|
1045
|
-
|
1046
|
-
//beginchild
|
1047
|
-
|
1048
|
-
1. OL1-OL1
|
1049
|
-
2. OL1-OL2
|
1050
|
-
|
1051
|
-
* OL1-UL1
|
1052
|
-
* OL1-UL2
|
1053
|
-
|
1054
|
-
: OL1-DL1
|
1055
|
-
OL1-DD1
|
1056
|
-
: OL1-DL2
|
1057
|
-
OL1-DD2
|
1058
|
-
|
1059
|
-
//endchild
|
1060
|
-
|
1061
|
-
2. OL2
|
1062
|
-
|
1063
|
-
//beginchild
|
1064
|
-
|
1065
|
-
OL2-PARA
|
1066
|
-
|
1067
|
-
//endchild
|
1068
|
-
EOS
|
1069
|
-
|
1070
|
-
expected = <<-EOS
|
1071
|
-
1 OL1
|
1072
|
-
|
1073
|
-
1 OL1-OL1
|
1074
|
-
2 OL1-OL2
|
1075
|
-
|
1076
|
-
OL1-UL1
|
1077
|
-
OL1-UL2
|
1078
|
-
|
1079
|
-
OL1-DL1
|
1080
|
-
OL1-DD1
|
1081
|
-
OL1-DL2
|
1082
|
-
OL1-DD2
|
1083
|
-
|
1084
|
-
2 OL2
|
1085
|
-
OL2-PARA
|
1086
|
-
EOS
|
1087
|
-
|
1088
|
-
actual = compile_block(src)
|
1089
|
-
assert_equal expected, actual
|
1090
|
-
end
|
1091
|
-
|
1092
|
-
def test_nest_dl
|
1093
|
-
src = <<-EOS
|
1094
|
-
: DL1
|
1095
|
-
|
1096
|
-
//beginchild
|
1097
|
-
|
1098
|
-
1. DL1-OL1
|
1099
|
-
2. DL1-OL2
|
1100
|
-
|
1101
|
-
* DL1-UL1
|
1102
|
-
* DL1-UL2
|
1103
|
-
|
1104
|
-
: DL1-DL1
|
1105
|
-
DL1-DD1
|
1106
|
-
: DL1-DL2
|
1107
|
-
DL1-DD2
|
1108
|
-
|
1109
|
-
//endchild
|
1110
|
-
|
1111
|
-
: DL2
|
1112
|
-
DD2
|
1113
|
-
|
1114
|
-
//beginchild
|
1115
|
-
|
1116
|
-
* DD2-UL1
|
1117
|
-
* DD2-UL2
|
1118
|
-
|
1119
|
-
DD2-PARA
|
1120
|
-
|
1121
|
-
//endchild
|
1122
|
-
EOS
|
1123
|
-
|
1124
|
-
expected = <<-EOS
|
1125
|
-
DL1
|
1126
|
-
|
1127
|
-
1 DL1-OL1
|
1128
|
-
2 DL1-OL2
|
1129
|
-
|
1130
|
-
DL1-UL1
|
1131
|
-
DL1-UL2
|
1132
|
-
|
1133
|
-
DL1-DL1
|
1134
|
-
DL1-DD1
|
1135
|
-
DL1-DL2
|
1136
|
-
DL1-DD2
|
1137
|
-
|
1138
|
-
DL2
|
1139
|
-
DD2
|
1140
|
-
|
1141
|
-
DD2-UL1
|
1142
|
-
DD2-UL2
|
1143
|
-
|
1144
|
-
DD2-PARA
|
1145
|
-
EOS
|
1146
|
-
|
1147
|
-
actual = compile_block(src)
|
1148
|
-
assert_equal expected, actual
|
1149
|
-
end
|
1150
|
-
|
1151
|
-
def test_nest_multi
|
1152
|
-
src = <<-EOS
|
1153
|
-
1. OL1
|
1154
|
-
|
1155
|
-
//beginchild
|
1156
|
-
|
1157
|
-
1. OL1-OL1
|
1158
|
-
|
1159
|
-
//beginchild
|
1160
|
-
|
1161
|
-
* OL1-OL1-UL1
|
1162
|
-
|
1163
|
-
OL1-OL1-PARA
|
1164
|
-
|
1165
|
-
//endchild
|
1166
|
-
|
1167
|
-
2. OL1-OL2
|
1168
|
-
|
1169
|
-
* OL1-UL1
|
1170
|
-
|
1171
|
-
//beginchild
|
1172
|
-
|
1173
|
-
: OL1-UL1-DL1
|
1174
|
-
OL1-UL1-DD1
|
1175
|
-
|
1176
|
-
OL1-UL1-PARA
|
1177
|
-
|
1178
|
-
//endchild
|
1179
|
-
|
1180
|
-
* OL1-UL2
|
1181
|
-
|
1182
|
-
//endchild
|
1183
|
-
EOS
|
1184
|
-
expected = <<-EOS
|
1185
|
-
1 OL1
|
1186
|
-
|
1187
|
-
1 OL1-OL1
|
1188
|
-
|
1189
|
-
|
1190
|
-
OL1-OL1-UL1
|
1191
|
-
|
1192
|
-
OL1-OL1-PARA
|
1193
|
-
|
1194
|
-
2 OL1-OL2
|
1195
|
-
|
1196
|
-
OL1-UL1
|
1197
|
-
|
1198
|
-
|
1199
|
-
OL1-UL1-DL1
|
1200
|
-
OL1-UL1-DD1
|
1201
|
-
|
1202
|
-
OL1-UL1-PARA
|
1203
|
-
|
1204
|
-
OL1-UL2
|
1205
|
-
|
1206
|
-
EOS
|
1207
|
-
|
1208
|
-
actual = compile_block(src)
|
1209
|
-
assert_equal expected, actual
|
1210
|
-
end
|
1211
|
-
end
|