review 0.9.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +9 -0
- data/ChangeLog +326 -0
- data/Rakefile +3 -5
- data/VERSION +1 -1
- data/bin/review-compile +50 -50
- data/bin/review-epubmaker +62 -75
- data/bin/review-epubmaker-ng +185 -0
- data/bin/review-index +2 -1
- data/bin/review-pdfmaker +158 -101
- data/bin/review-vol +6 -2
- data/doc/format.rdoc +111 -46
- data/doc/libepubmaker/sample.yaml +90 -0
- data/doc/quickstart.rdoc +188 -0
- data/doc/sample.yaml +8 -0
- data/lib/epubmaker.rb +28 -0
- data/lib/epubmaker/content.rb +82 -0
- data/lib/epubmaker/epubv2.rb +419 -0
- data/lib/epubmaker/epubv3.rb +249 -0
- data/lib/epubmaker/producer.rb +204 -0
- data/lib/epubmaker/resource.rb +66 -0
- data/lib/review.rb +1 -1
- data/lib/review/book.rb +27 -4
- data/lib/review/builder.rb +153 -20
- data/lib/review/compiler.rb +61 -10
- data/lib/review/ewbbuilder.rb +3 -2
- data/lib/review/htmlbuilder.rb +174 -67
- data/lib/review/i18n.rb +30 -0
- data/lib/review/i18n.yaml +23 -0
- data/lib/review/idgxmlbuilder.rb +110 -63
- data/lib/review/index.rb +34 -12
- data/lib/review/latexbuilder.rb +128 -33
- data/lib/review/latexutils.rb +18 -1
- data/lib/review/textbuilder.rb +17 -0
- data/lib/review/tocparser.rb +3 -1
- data/lib/review/tocprinter.rb +1 -0
- data/lib/review/topbuilder.rb +397 -198
- data/review.gemspec +101 -100
- data/test/test_book.rb +27 -0
- data/test/test_epubmaker.rb +507 -0
- data/test/test_helper.rb +8 -0
- data/test/test_htmlbuilder.rb +295 -10
- data/test/test_i18n.rb +64 -0
- data/test/test_idgxmlbuilder.rb +268 -10
- data/test/test_latexbuilder.rb +316 -20
- data/test/test_preprocessor.rb +23 -0
- data/test/test_topbuilder.rb +246 -0
- metadata +46 -53
- data/doc/format.re +0 -505
- data/test/test_index.rb +0 -15
data/test/test_helper.rb
CHANGED
data/test/test_htmlbuilder.rb
CHANGED
@@ -71,9 +71,19 @@ class HTMLBuidlerTest < Test::Unit::TestCase
|
|
71
71
|
assert_equal %Q|<a href="http://github.com" class="link">http://github.com</a>|, ret
|
72
72
|
end
|
73
73
|
|
74
|
+
def test_inline_href
|
75
|
+
ret = @builder.inline_href("http://github.com, Git\\,Hub")
|
76
|
+
assert_equal %Q|<a href="http://github.com" class="link">Git,Hub</a>|, ret
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_inline_href_without_label
|
80
|
+
ret = @builder.inline_href("http://github.com")
|
81
|
+
assert_equal %Q|<a href="http://github.com" class="link">http://github.com</a>|, ret
|
82
|
+
end
|
83
|
+
|
74
84
|
def test_inline_raw
|
75
85
|
ret = @builder.inline_raw("@<tt>{inline}")
|
76
|
-
assert_equal %Q
|
86
|
+
assert_equal %Q|@<tt>{inline}|, ret
|
77
87
|
end
|
78
88
|
|
79
89
|
def test_inline_in_table
|
@@ -126,6 +136,11 @@ class HTMLBuidlerTest < Test::Unit::TestCase
|
|
126
136
|
assert_equal %Q|test ① test2|, ret
|
127
137
|
end
|
128
138
|
|
139
|
+
def test_inline_ruby
|
140
|
+
ret = @builder.compile_inline("@<ruby>{粗雑,クルード}と思われているなら@<ruby>{繊細,テクニカル}にやり、繊細と思われているなら粗雑にやる。")
|
141
|
+
assert_equal "<ruby><rb>粗雑</rb><rp>(</rp><rt>クルード</rt><rp>)</rp></ruby>と思われているなら<ruby><rb>繊細</rb><rp>(</rp><rt>テクニカル</rt><rp>)</rp></ruby>にやり、繊細と思われているなら粗雑にやる。", ret
|
142
|
+
end
|
143
|
+
|
129
144
|
def test_quote
|
130
145
|
lines = ["foo", "bar", "","buz"]
|
131
146
|
@builder.quote(lines)
|
@@ -149,11 +164,6 @@ class HTMLBuidlerTest < Test::Unit::TestCase
|
|
149
164
|
assert_equal %Q|<p class="flushright">foobar</p>\n<p class="flushright">buz</p>\n|, @builder.raw_result
|
150
165
|
end
|
151
166
|
|
152
|
-
def test_raw
|
153
|
-
@builder.raw("<&>\\n")
|
154
|
-
assert_equal %Q|<&>\n|, @builder.raw_result
|
155
|
-
end
|
156
|
-
|
157
167
|
def test_image
|
158
168
|
def @chapter.image(id)
|
159
169
|
item = ImageIndex::Item.new("sampleimg",1)
|
@@ -173,7 +183,17 @@ class HTMLBuidlerTest < Test::Unit::TestCase
|
|
173
183
|
end
|
174
184
|
|
175
185
|
@builder.image_image("sampleimg","sample photo","scale=1.2")
|
176
|
-
assert_equal %Q|<div class="image">\n<img src="images/chap1-sampleimg.png" alt="sample photo" />\n<p class="caption">\n図1.1: sample photo\n</p>\n</div>\n|, @builder.raw_result
|
186
|
+
assert_equal %Q|<div class="image">\n<img src="images/chap1-sampleimg.png" alt="sample photo" width="120%" />\n<p class="caption">\n図1.1: sample photo\n</p>\n</div>\n|, @builder.raw_result
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_image_with_metric2
|
190
|
+
def @chapter.image(id)
|
191
|
+
item = ImageIndex::Item.new("sampleimg",1)
|
192
|
+
item.instance_eval{@pathes=["./images/chap1-sampleimg.png"]}
|
193
|
+
item
|
194
|
+
end
|
195
|
+
@builder.image_image("sampleimg","sample photo","scale=1.2,html::class=sample,latex::ignore=params")
|
196
|
+
assert_equal %Q|<div class="image">\n<img src="images/chap1-sampleimg.png" alt="sample photo" width="120%" class="sample" />\n<p class="caption">\n図1.1: sample photo\n</p>\n</div>\n|, @builder.raw_result
|
177
197
|
end
|
178
198
|
|
179
199
|
def test_indepimage
|
@@ -195,7 +215,7 @@ class HTMLBuidlerTest < Test::Unit::TestCase
|
|
195
215
|
end
|
196
216
|
|
197
217
|
@builder.indepimage("sampleimg",nil,nil)
|
198
|
-
assert_equal %Q|<div class="image">\n<img src="images/chap1-sampleimg.png" alt="" />\n|, @builder.raw_result
|
218
|
+
assert_equal %Q|<div class="image">\n<img src="images/chap1-sampleimg.png" alt="" />\n</div>\n|, @builder.raw_result
|
199
219
|
end
|
200
220
|
|
201
221
|
def test_indepimage_with_metric
|
@@ -206,7 +226,18 @@ class HTMLBuidlerTest < Test::Unit::TestCase
|
|
206
226
|
end
|
207
227
|
|
208
228
|
@builder.indepimage("sampleimg","sample photo","scale=1.2")
|
209
|
-
assert_equal %Q|<div class="image">\n<img src="images/chap1-sampleimg.png" alt="sample photo" />\n<p class="caption">\n図: sample photo\n</p>\n</div>\n|, @builder.raw_result
|
229
|
+
assert_equal %Q|<div class="image">\n<img src="images/chap1-sampleimg.png" alt="sample photo" width="120%" />\n<p class="caption">\n図: sample photo\n</p>\n</div>\n|, @builder.raw_result
|
230
|
+
end
|
231
|
+
|
232
|
+
def test_indepimage_with_metric2
|
233
|
+
def @chapter.image(id)
|
234
|
+
item = ImageIndex::Item.new("sampleimg",1)
|
235
|
+
item.instance_eval{@pathes=["./images/chap1-sampleimg.png"]}
|
236
|
+
item
|
237
|
+
end
|
238
|
+
|
239
|
+
@builder.indepimage("sampleimg","sample photo","scale=1.2, html::class=\"sample\",latex::ignore=params")
|
240
|
+
assert_equal %Q|<div class="image">\n<img src="images/chap1-sampleimg.png" alt="sample photo" width="120%" class="sample" />\n<p class="caption">\n図: sample photo\n</p>\n</div>\n|, @builder.raw_result
|
210
241
|
end
|
211
242
|
|
212
243
|
def test_indepimage_without_caption_but_with_metric
|
@@ -217,7 +248,261 @@ class HTMLBuidlerTest < Test::Unit::TestCase
|
|
217
248
|
end
|
218
249
|
|
219
250
|
@builder.indepimage("sampleimg",nil,"scale=1.2")
|
220
|
-
assert_equal %Q|<div class="image">\n<img src="images/chap1-sampleimg.png" alt="" />\n|, @builder.raw_result
|
251
|
+
assert_equal %Q|<div class="image">\n<img src="images/chap1-sampleimg.png" alt="" width="120%" />\n</div>\n|, @builder.raw_result
|
252
|
+
end
|
253
|
+
|
254
|
+
def test_emlist
|
255
|
+
@builder.emlist(["lineA","lineB"])
|
256
|
+
assert_equal %Q|<div class="emlist-code">\n<pre class="emlist">lineA\nlineB\n</pre>\n</div>\n|, @builder.raw_result
|
257
|
+
end
|
258
|
+
|
259
|
+
def test_emlist_caption
|
260
|
+
@builder.emlist(["lineA","lineB"],"cap1")
|
261
|
+
assert_equal %Q|<div class="emlist-code">\n<p class="caption">cap1</p>\n<pre class="emlist">lineA\nlineB\n</pre>\n</div>\n|, @builder.raw_result
|
262
|
+
end
|
263
|
+
|
264
|
+
def test_cmd
|
265
|
+
@builder.cmd(["lineA","lineB"])
|
266
|
+
assert_equal %Q|<div class="cmd-code">\n<pre class="cmd">lineA\nlineB\n</pre>\n</div>\n|, @builder.raw_result
|
221
267
|
end
|
222
268
|
|
269
|
+
def test_cmd_caption
|
270
|
+
@builder.cmd(["lineA","lineB"], "cap1")
|
271
|
+
assert_equal %Q|<div class="cmd-code">\n<p class="caption">cap1</p>\n<pre class="cmd">lineA\nlineB\n</pre>\n</div>\n|, @builder.raw_result
|
272
|
+
end
|
273
|
+
|
274
|
+
def test_bib
|
275
|
+
def @chapter.bibpaper(id)
|
276
|
+
BibpaperIndex::Item.new("samplebib",1,"sample bib")
|
277
|
+
end
|
278
|
+
|
279
|
+
assert_equal %Q|<a href="./bib.html#bib-samplebib">[1]</a>|, @builder.inline_bib("samplebib")
|
280
|
+
end
|
281
|
+
|
282
|
+
def test_bibpaper
|
283
|
+
def @chapter.bibpaper(id)
|
284
|
+
BibpaperIndex::Item.new("samplebib",1,"sample bib")
|
285
|
+
end
|
286
|
+
|
287
|
+
@builder.bibpaper(["a", "b"], "samplebib", "sample bib @<b>{bold}")
|
288
|
+
assert_equal %Q|<div>\n<a id=\"bib-samplebib\">\n[1] sample bib <b>bold</b>\n</a>\n<p>\na\nb\n</p>\n</div>\n|, @builder.raw_result
|
289
|
+
end
|
290
|
+
|
291
|
+
def column_helper(review)
|
292
|
+
chap_singleton = class << @chapter; self; end
|
293
|
+
chap_singleton.send(:define_method, :content) { review }
|
294
|
+
@compiler.compile(@chapter).match(/<body>\n(.+)<\/body>/m)[1]
|
295
|
+
end
|
296
|
+
|
297
|
+
def test_column_1
|
298
|
+
review =<<-EOS
|
299
|
+
===[column] prev column
|
300
|
+
|
301
|
+
inside prev column
|
302
|
+
|
303
|
+
===[column] test
|
304
|
+
|
305
|
+
inside column
|
306
|
+
|
307
|
+
===[/column]
|
308
|
+
EOS
|
309
|
+
expect =<<-EOS
|
310
|
+
<div class="column">
|
311
|
+
|
312
|
+
<h3><a id="h1-0-1" />prev column</h3>
|
313
|
+
<p>inside prev column</p>
|
314
|
+
</div>
|
315
|
+
<div class="column">
|
316
|
+
|
317
|
+
<h3><a id="h1-0-2" />test</h3>
|
318
|
+
<p>inside column</p>
|
319
|
+
</div>
|
320
|
+
EOS
|
321
|
+
assert_equal expect, column_helper(review)
|
322
|
+
end
|
323
|
+
|
324
|
+
def test_column_2
|
325
|
+
review =<<-EOS
|
326
|
+
===[column] test
|
327
|
+
|
328
|
+
inside column
|
329
|
+
|
330
|
+
=== next level
|
331
|
+
EOS
|
332
|
+
expect =<<-EOS
|
333
|
+
<div class="column">
|
334
|
+
|
335
|
+
<h3><a id="h1-0-1" />test</h3>
|
336
|
+
<p>inside column</p>
|
337
|
+
</div>
|
338
|
+
|
339
|
+
<h3><a id="h1-0-2" />next level</h3>
|
340
|
+
EOS
|
341
|
+
|
342
|
+
assert_equal expect, column_helper(review)
|
343
|
+
end
|
344
|
+
|
345
|
+
def test_column_3
|
346
|
+
review =<<-EOS
|
347
|
+
===[column] test
|
348
|
+
|
349
|
+
inside column
|
350
|
+
|
351
|
+
===[/column_dummy]
|
352
|
+
EOS
|
353
|
+
assert_raise(ReVIEW::CompileError) do
|
354
|
+
column_helper(review)
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
def test_ul
|
359
|
+
src =<<-EOS
|
360
|
+
* AAA
|
361
|
+
* BBB
|
362
|
+
EOS
|
363
|
+
expect = "<ul>\n<li>AAA</li>\n<li>BBB</li>\n</ul>\n"
|
364
|
+
ul_helper(src, expect)
|
365
|
+
end
|
366
|
+
|
367
|
+
def test_ul_cont
|
368
|
+
src =<<-EOS
|
369
|
+
* AAA
|
370
|
+
-AA
|
371
|
+
* BBB
|
372
|
+
-BB
|
373
|
+
EOS
|
374
|
+
expect = "<ul>\n<li>AAA-AA</li>\n<li>BBB-BB</li>\n</ul>\n"
|
375
|
+
ul_helper(src, expect)
|
376
|
+
end
|
377
|
+
|
378
|
+
def test_ul_nest1
|
379
|
+
src =<<-EOS
|
380
|
+
* AAA
|
381
|
+
** AA
|
382
|
+
EOS
|
383
|
+
|
384
|
+
expect =<<-EOS
|
385
|
+
<ul>
|
386
|
+
<li>AAA<ul>
|
387
|
+
<li>AA</li>
|
388
|
+
</ul>
|
389
|
+
</li>
|
390
|
+
</ul>
|
391
|
+
EOS
|
392
|
+
ul_helper(src, expect)
|
393
|
+
end
|
394
|
+
|
395
|
+
def test_ul_nest2
|
396
|
+
src =<<-EOS
|
397
|
+
* AAA
|
398
|
+
** AA
|
399
|
+
* BBB
|
400
|
+
** BB
|
401
|
+
EOS
|
402
|
+
|
403
|
+
expect =<<-EOS
|
404
|
+
<ul>
|
405
|
+
<li>AAA<ul>
|
406
|
+
<li>AA</li>
|
407
|
+
</ul>
|
408
|
+
</li>
|
409
|
+
<li>BBB<ul>
|
410
|
+
<li>BB</li>
|
411
|
+
</ul>
|
412
|
+
</li>
|
413
|
+
</ul>
|
414
|
+
EOS
|
415
|
+
ul_helper(src, expect)
|
416
|
+
end
|
417
|
+
|
418
|
+
def test_ul_nest3
|
419
|
+
src =<<-EOS
|
420
|
+
** AAA
|
421
|
+
* AA
|
422
|
+
* BBB
|
423
|
+
** BB
|
424
|
+
EOS
|
425
|
+
|
426
|
+
expect =<<-EOS
|
427
|
+
<ul>
|
428
|
+
<li><ul>
|
429
|
+
<li>AAA</li>
|
430
|
+
</ul>
|
431
|
+
</li>
|
432
|
+
<li>AA</li>
|
433
|
+
<li>BBB<ul>
|
434
|
+
<li>BB</li>
|
435
|
+
</ul>
|
436
|
+
</li>
|
437
|
+
</ul>
|
438
|
+
EOS
|
439
|
+
ul_helper(src, expect)
|
440
|
+
end
|
441
|
+
|
442
|
+
def test_inline_raw0
|
443
|
+
assert_equal "normal", @builder.inline_raw("normal")
|
444
|
+
end
|
445
|
+
|
446
|
+
def test_inline_raw1
|
447
|
+
assert_equal "body", @builder.inline_raw("|html|body")
|
448
|
+
end
|
449
|
+
|
450
|
+
def test_inline_raw2
|
451
|
+
assert_equal "body", @builder.inline_raw("|html, latex|body")
|
452
|
+
end
|
453
|
+
|
454
|
+
def test_inline_raw3
|
455
|
+
assert_equal "", @builder.inline_raw("|idgxml, latex|body")
|
456
|
+
end
|
457
|
+
|
458
|
+
def test_inline_raw4
|
459
|
+
assert_equal "|html body", @builder.inline_raw("|html body")
|
460
|
+
end
|
461
|
+
|
462
|
+
def test_inline_raw5
|
463
|
+
assert_equal "nor\nmal", @builder.inline_raw("|html|nor\\nmal")
|
464
|
+
end
|
465
|
+
|
466
|
+
def test_block_raw0
|
467
|
+
@builder.raw("<>!\"\\n& ")
|
468
|
+
expect =<<-EOS
|
469
|
+
<>!"
|
470
|
+
&
|
471
|
+
EOS
|
472
|
+
assert_equal expect.chomp, @builder.raw_result
|
473
|
+
end
|
474
|
+
|
475
|
+
def test_block_raw1
|
476
|
+
@builder.raw("|html|<>!\"\\n& ")
|
477
|
+
expect =<<-EOS
|
478
|
+
<>!"
|
479
|
+
&
|
480
|
+
EOS
|
481
|
+
assert_equal expect.chomp, @builder.raw_result
|
482
|
+
end
|
483
|
+
|
484
|
+
def test_block_raw2
|
485
|
+
@builder.raw("|html, latex|<>!\"\\n& ")
|
486
|
+
expect =<<-EOS
|
487
|
+
<>!\"
|
488
|
+
&
|
489
|
+
EOS
|
490
|
+
assert_equal expect.chomp, @builder.raw_result
|
491
|
+
end
|
492
|
+
|
493
|
+
def test_block_raw3
|
494
|
+
@builder.raw("|latex, idgxml|<>!\"\\n& ")
|
495
|
+
expect =<<-EOS
|
496
|
+
EOS
|
497
|
+
assert_equal expect.chomp, @builder.raw_result
|
498
|
+
end
|
499
|
+
|
500
|
+
def test_block_raw4
|
501
|
+
@builder.raw("|html <>!\"\\n& ")
|
502
|
+
expect =<<-EOS
|
503
|
+
|html <>!\"
|
504
|
+
&
|
505
|
+
EOS
|
506
|
+
assert_equal expect.chomp, @builder.raw_result
|
507
|
+
end
|
223
508
|
end
|
data/test/test_i18n.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'test_helper'
|
3
|
+
require 'review/i18n'
|
4
|
+
|
5
|
+
class I18nTest < Test::Unit::TestCase
|
6
|
+
include ReVIEW
|
7
|
+
|
8
|
+
def test_ja
|
9
|
+
I18n.i18n "ja"
|
10
|
+
assert_equal I18n.t("image"), "図"
|
11
|
+
assert_equal I18n.t("table"), "表"
|
12
|
+
assert_equal I18n.t("chapter", 1), "第1章"
|
13
|
+
assert_equal I18n.t("etc"), "etc"
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_ja_with_user_i18n
|
17
|
+
I18n.i18n "ja", {"image" => "ず"}
|
18
|
+
assert_equal I18n.t("image"), "ず"
|
19
|
+
assert_equal I18n.t("table"), "表"
|
20
|
+
assert_equal I18n.t("chapter", 1), "第1章"
|
21
|
+
assert_equal I18n.t("etc"), "etc"
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_en
|
25
|
+
I18n.i18n "en"
|
26
|
+
assert_equal I18n.t("image"), "Figure "
|
27
|
+
assert_equal I18n.t("table"), "Table "
|
28
|
+
assert_equal I18n.t("chapter", 1), "Chapter 1"
|
29
|
+
assert_equal I18n.t("etc"), "etc"
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_nil
|
33
|
+
I18n.i18n "nil"
|
34
|
+
assert_equal I18n.t("image"), "image"
|
35
|
+
assert_equal I18n.t("table"), "table"
|
36
|
+
assert_equal I18n.t("etc"), "etc"
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_htmlbuilder
|
40
|
+
_setup_htmlbuilder
|
41
|
+
@builder.headline(1,"test","this is test.")
|
42
|
+
assert_equal %Q|<h1 id="test"><a id="h1" />Chapter 1. this is test.</h1>\n|, @builder.raw_result
|
43
|
+
end
|
44
|
+
|
45
|
+
def _setup_htmlbuilder
|
46
|
+
I18n.i18n "en"
|
47
|
+
@builder = HTMLBuilder.new()
|
48
|
+
@param = {
|
49
|
+
"secnolevel" => 2, # for IDGXMLBuilder, HTMLBuilder
|
50
|
+
"inencoding" => "UTF-8",
|
51
|
+
"outencoding" => "UTF-8",
|
52
|
+
"stylesheet" => nil, # for HTMLBuilder
|
53
|
+
}
|
54
|
+
ReVIEW.book.param = @param
|
55
|
+
@compiler = ReVIEW::Compiler.new(@builder)
|
56
|
+
@chapter = Chapter.new(nil, 1, '-', nil, StringIO.new)
|
57
|
+
location = Location.new(nil, nil)
|
58
|
+
@builder.bind(@compiler, @chapter, location)
|
59
|
+
end
|
60
|
+
|
61
|
+
def teardown
|
62
|
+
I18n.i18n "ja"
|
63
|
+
end
|
64
|
+
end
|
data/test/test_idgxmlbuilder.rb
CHANGED
@@ -68,6 +68,11 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
68
68
|
assert_equal %Q|<a linkurl='http://github.com'>http://github.com</a>|, ret
|
69
69
|
end
|
70
70
|
|
71
|
+
def test_inline_href
|
72
|
+
ret = @builder.inline_href("http://github.com, Git\\,Hub")
|
73
|
+
assert_equal %Q|<a linkurl='http://github.com'>Git,Hub</a>|, ret
|
74
|
+
end
|
75
|
+
|
71
76
|
def test_inline_raw
|
72
77
|
ret = @builder.inline_raw("@<tt>{inline}")
|
73
78
|
assert_equal %Q|@<tt>{inline}|, ret
|
@@ -75,12 +80,12 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
75
80
|
|
76
81
|
def test_inline_in_table
|
77
82
|
ret = @builder.table(["<b>1</b>\t<i>2</i>", "------------", "<b>3</b>\t<i>4</i><>&"])
|
78
|
-
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="2" aid:tcols="2"><td aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><b>1</b></td><td aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><i>2</i></td><td aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><b>3</b></td><td aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><i>4</i><>&</td></tbody></table>|, @builder.raw_result
|
83
|
+
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="2" aid:tcols="2"><td xyh="1,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><b>1</b></td><td xyh="2,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><i>2</i></td><td xyh="1,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><b>3</b></td><td xyh="2,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><i>4</i><>&</td></tbody></table>|, @builder.raw_result
|
79
84
|
end
|
80
85
|
|
81
86
|
def test_inline_in_table_without_header
|
82
87
|
ret = @builder.table(["<b>1</b>\t<i>2</i>", "<b>3</b>\t<i>4</i><>&"])
|
83
|
-
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="2" aid:tcols="2"><td aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><b>1</b></td><td aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><i>2</i></td><td aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><b>3</b></td><td aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><i>4</i><>&</td></tbody></table>|, @builder.raw_result
|
88
|
+
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="2" aid:tcols="2"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><b>1</b></td><td xyh="2,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><i>2</i></td><td xyh="1,2,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><b>3</b></td><td xyh="2,2,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><i>4</i><>&</td></tbody></table>|, @builder.raw_result
|
84
89
|
end
|
85
90
|
|
86
91
|
def test_inline_in_table_without_cellwidth
|
@@ -210,6 +215,34 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
210
215
|
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><point><p>test1test1.5</p><p>test<i>2</i></p></point>|, @builder.raw_result
|
211
216
|
end
|
212
217
|
|
218
|
+
def test_emlist
|
219
|
+
@builder.emlist(["test1", "test1.5", "", "test<i>2</i>"], "this is @<b>{test}<&>_")
|
220
|
+
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><list type='emlist'><caption aid:pstyle='emlist-title'>this is <b>test</b><&>_</caption><pre>test1\ntest1.5\n\ntest<i>2</i>\n</pre></list>|, @builder.raw_result
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_emlist_listinfo
|
224
|
+
@param["listinfo"] = true
|
225
|
+
@builder.emlist(["test1", "test1.5", "", "test<i>2</i>"], "this is @<b>{test}<&>_")
|
226
|
+
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><list type='emlist'><caption aid:pstyle='emlist-title'>this is <b>test</b><&>_</caption><pre><listinfo line="1" begin="1">test1\n</listinfo><listinfo line="2">test1.5\n</listinfo><listinfo line="3">\n</listinfo><listinfo line="4" end="4">test<i>2</i>\n</listinfo></pre></list>|, @builder.raw_result
|
227
|
+
end
|
228
|
+
|
229
|
+
def test_list
|
230
|
+
def @chapter.list(id)
|
231
|
+
ListIndex::Item.new("samplelist",1)
|
232
|
+
end
|
233
|
+
@builder.list(["test1", "test1.5", "", "test<i>2</i>"], "samplelist", "this is @<b>{test}<&>_")
|
234
|
+
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><codelist><caption>リスト1.1 this is <b>test</b><&>_</caption><pre>test1\ntest1.5\n\ntest<i>2</i>\n</pre></codelist>|, @builder.raw_result
|
235
|
+
end
|
236
|
+
|
237
|
+
def test_list_listinfo
|
238
|
+
def @chapter.list(id)
|
239
|
+
ListIndex::Item.new("samplelist",1)
|
240
|
+
end
|
241
|
+
@param["listinfo"] = true
|
242
|
+
@builder.list(["test1", "test1.5", "", "test<i>2</i>"], "samplelist", "this is @<b>{test}<&>_")
|
243
|
+
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><codelist><caption>リスト1.1 this is <b>test</b><&>_</caption><pre><listinfo line="1" begin="1">test1\n</listinfo><listinfo line="2">test1.5\n</listinfo><listinfo line="3">\n</listinfo><listinfo line="4" end="4">test<i>2</i>\n</listinfo></pre></codelist>|, @builder.raw_result
|
244
|
+
end
|
245
|
+
|
213
246
|
def test_insn
|
214
247
|
@param["listinfo"] = true
|
215
248
|
@builder.insn(["test1", "test1.5", "", "test<i>2</i>"], "this is @<b>{test}<&>_")
|
@@ -236,11 +269,6 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
236
269
|
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><p aid:pstyle="noindent" noindent='1'>foobar</p><p>foo2bar2</p>|, @builder.raw_result
|
237
270
|
end
|
238
271
|
|
239
|
-
def test_raw
|
240
|
-
@builder.raw("<&>\\n")
|
241
|
-
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><&>\n|, @builder.raw_result
|
242
|
-
end
|
243
|
-
|
244
272
|
def test_image
|
245
273
|
def @chapter.image(id)
|
246
274
|
item = ImageIndex::Item.new("sampleimg",1)
|
@@ -249,7 +277,7 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
249
277
|
end
|
250
278
|
|
251
279
|
@builder.image_image("sampleimg","sample photo",nil)
|
252
|
-
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><img><Image href="file://images/chap1-sampleimg.png"
|
280
|
+
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><img><Image href="file://images/chap1-sampleimg.png" /><caption>図1.1 sample photo</caption></img>|, @builder.raw_result
|
253
281
|
end
|
254
282
|
|
255
283
|
def test_image_with_metric
|
@@ -263,6 +291,17 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
263
291
|
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><img><Image href="file://images/chap1-sampleimg.png" scale="1.2" /><caption>図1.1 sample photo</caption></img>|, @builder.raw_result
|
264
292
|
end
|
265
293
|
|
294
|
+
def test_image_with_metric2
|
295
|
+
def @chapter.image(id)
|
296
|
+
item = ImageIndex::Item.new("sampleimg",1)
|
297
|
+
item.instance_eval{@pathes=["./images/chap1-sampleimg.png"]}
|
298
|
+
item
|
299
|
+
end
|
300
|
+
|
301
|
+
@builder.image_image("sampleimg","sample photo","scale=1.2, html::class=\"sample\", latex::ignore=params, idgxml::ostyle=object")
|
302
|
+
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><img><Image href="file://images/chap1-sampleimg.png" scale="1.2" ostyle="object" /><caption>図1.1 sample photo</caption></img>|, @builder.raw_result
|
303
|
+
end
|
304
|
+
|
266
305
|
def test_indepimage
|
267
306
|
def @chapter.image(id)
|
268
307
|
item = ImageIndex::Item.new("sampleimg",1)
|
@@ -271,7 +310,7 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
271
310
|
end
|
272
311
|
|
273
312
|
@builder.indepimage("sampleimg","sample photo",nil)
|
274
|
-
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><img><Image href="file://images/chap1-sampleimg.png"
|
313
|
+
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><img><Image href="file://images/chap1-sampleimg.png" /><caption>sample photo</caption></img>|, @builder.raw_result
|
275
314
|
end
|
276
315
|
|
277
316
|
def test_indepimage_without_caption
|
@@ -282,7 +321,7 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
282
321
|
end
|
283
322
|
|
284
323
|
@builder.indepimage("sampleimg",nil,nil)
|
285
|
-
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><img><Image href="file://images/chap1-sampleimg.png"
|
324
|
+
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><img><Image href="file://images/chap1-sampleimg.png" /></img>|, @builder.raw_result
|
286
325
|
end
|
287
326
|
|
288
327
|
def test_indepimage_with_metric
|
@@ -296,6 +335,17 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
296
335
|
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><img><Image href="file://images/chap1-sampleimg.png" scale="1.2" /><caption>sample photo</caption></img>|, @builder.raw_result
|
297
336
|
end
|
298
337
|
|
338
|
+
def test_indepimage_with_metric2
|
339
|
+
def @chapter.image(id)
|
340
|
+
item = ImageIndex::Item.new("sampleimg",1)
|
341
|
+
item.instance_eval{@pathes=["./images/chap1-sampleimg.png"]}
|
342
|
+
item
|
343
|
+
end
|
344
|
+
|
345
|
+
@builder.indepimage("sampleimg","sample photo","scale=1.2, html::class=\"sample\", latex::ignore=params, idgxml::ostyle=\"object\"")
|
346
|
+
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><img><Image href="file://images/chap1-sampleimg.png" scale="1.2" ostyle="object" /><caption>sample photo</caption></img>|, @builder.raw_result
|
347
|
+
end
|
348
|
+
|
299
349
|
def test_indepimage_without_caption_but_with_metric
|
300
350
|
def @chapter.image(id)
|
301
351
|
item = ImageIndex::Item.new("sampleimg",1)
|
@@ -307,4 +357,212 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
307
357
|
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><img><Image href="file://images/chap1-sampleimg.png" scale="1.2" /></img>|, @builder.raw_result
|
308
358
|
end
|
309
359
|
|
360
|
+
def column_helper(review)
|
361
|
+
chap_singleton = class << @chapter; self; end
|
362
|
+
chap_singleton.send(:define_method, :content) { review }
|
363
|
+
@compiler.compile(@chapter)
|
364
|
+
end
|
365
|
+
|
366
|
+
def test_column_1
|
367
|
+
review =<<-EOS
|
368
|
+
===[column] prev column
|
369
|
+
|
370
|
+
inside prev column
|
371
|
+
|
372
|
+
===[column] test
|
373
|
+
|
374
|
+
inside column
|
375
|
+
|
376
|
+
===[/column]
|
377
|
+
EOS
|
378
|
+
expect =<<-EOS
|
379
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
380
|
+
<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><column><title aid:pstyle="column-title">prev column</title><p>inside prev column</p></column><column><title aid:pstyle="column-title">test</title><p>inside column</p></column></doc>
|
381
|
+
EOS
|
382
|
+
assert_equal expect, column_helper(review)
|
383
|
+
end
|
384
|
+
|
385
|
+
def test_column_2
|
386
|
+
review =<<-EOS
|
387
|
+
===[column] test
|
388
|
+
|
389
|
+
inside column
|
390
|
+
|
391
|
+
=== next level
|
392
|
+
EOS
|
393
|
+
expect =<<-EOS
|
394
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
395
|
+
<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><column><title aid:pstyle="column-title">test</title><p>inside column</p></column><title aid:pstyle=\"h3\">next level</title><?dtp level="3" section="next level"?></doc>
|
396
|
+
EOS
|
397
|
+
|
398
|
+
assert_equal expect, column_helper(review)
|
399
|
+
end
|
400
|
+
|
401
|
+
def test_column_3
|
402
|
+
review =<<-EOS
|
403
|
+
===[column] test
|
404
|
+
|
405
|
+
inside column
|
406
|
+
|
407
|
+
===[/column_dummy]
|
408
|
+
EOS
|
409
|
+
assert_raise(ReVIEW::CompileError) do
|
410
|
+
column_helper(review)
|
411
|
+
end
|
412
|
+
end
|
413
|
+
|
414
|
+
def test_ul
|
415
|
+
src =<<-EOS
|
416
|
+
* AAA
|
417
|
+
* BBB
|
418
|
+
EOS
|
419
|
+
|
420
|
+
expect =<<-EOS
|
421
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
422
|
+
<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><ul><li aid:pstyle="ul-item">AAA</li><li aid:pstyle="ul-item">BBB</li></ul>
|
423
|
+
EOS
|
424
|
+
ul_helper(src, expect.chomp)
|
425
|
+
end
|
426
|
+
|
427
|
+
def test_ul_cont
|
428
|
+
src =<<-EOS
|
429
|
+
* AAA
|
430
|
+
-AA
|
431
|
+
* BBB
|
432
|
+
-BB
|
433
|
+
EOS
|
434
|
+
|
435
|
+
expect =<<-EOS
|
436
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
437
|
+
<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><ul><li aid:pstyle="ul-item">AAA-AA</li><li aid:pstyle="ul-item">BBB-BB</li></ul>
|
438
|
+
EOS
|
439
|
+
ul_helper(src, expect.chomp)
|
440
|
+
end
|
441
|
+
|
442
|
+
def test_ul_nest1
|
443
|
+
src =<<-EOS
|
444
|
+
* AAA
|
445
|
+
** AA
|
446
|
+
EOS
|
447
|
+
|
448
|
+
expect =<<-EOS
|
449
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
450
|
+
<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><ul><li aid:pstyle="ul-item">AAA<ul2><li aid:pstyle="ul-item">AA</li></ul2></li></ul>
|
451
|
+
EOS
|
452
|
+
ul_helper(src, expect.chomp)
|
453
|
+
end
|
454
|
+
|
455
|
+
def test_ul_nest2
|
456
|
+
src =<<-EOS
|
457
|
+
* AAA
|
458
|
+
** AA
|
459
|
+
* BBB
|
460
|
+
** BB
|
461
|
+
EOS
|
462
|
+
|
463
|
+
expect =<<-EOS
|
464
|
+
<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><ul><li aid:pstyle="ul-item">AAA<ul2><li aid:pstyle="ul-item">AA</li></ul2></li><li aid:pstyle="ul-item">BBB<ul2><li aid:pstyle="ul-item">BB</li></ul2></li></ul>
|
465
|
+
EOS
|
466
|
+
ul_helper(src, expect.chomp)
|
467
|
+
end
|
468
|
+
|
469
|
+
def test_ul_nest3
|
470
|
+
src =<<-EOS
|
471
|
+
** AAA
|
472
|
+
* AA
|
473
|
+
* BBB
|
474
|
+
** BB
|
475
|
+
EOS
|
476
|
+
|
477
|
+
expect =<<-EOS
|
478
|
+
<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><ul><li aid:pstyle="ul-item"><ul2><li aid:pstyle="ul-item">AAA</li></ul2></li><li aid:pstyle="ul-item">AA</li><li aid:pstyle="ul-item">BBB<ul2><li aid:pstyle="ul-item">BB</li></ul2></li></ul>
|
479
|
+
EOS
|
480
|
+
ul_helper(src, expect.chomp)
|
481
|
+
end
|
482
|
+
|
483
|
+
def test_ul_nest4
|
484
|
+
src =<<-EOS
|
485
|
+
* A
|
486
|
+
** B
|
487
|
+
** C
|
488
|
+
*** D
|
489
|
+
** E
|
490
|
+
* F
|
491
|
+
** G
|
492
|
+
EOS
|
493
|
+
|
494
|
+
expect =<<-EOS
|
495
|
+
<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><ul><li aid:pstyle="ul-item">A<ul2><li aid:pstyle="ul-item">B</li><li aid:pstyle="ul-item">C<ul3><li aid:pstyle="ul-item">D</li></ul3></li><li aid:pstyle="ul-item">E</li></ul2></li><li aid:pstyle="ul-item">F<ul2><li aid:pstyle="ul-item">G</li></ul2></li></ul>
|
496
|
+
EOS
|
497
|
+
ul_helper(src, expect.chomp)
|
498
|
+
end
|
499
|
+
|
500
|
+
def test_inline_raw0
|
501
|
+
assert_equal "normal", @builder.inline_raw("normal")
|
502
|
+
end
|
503
|
+
|
504
|
+
def test_inline_raw1
|
505
|
+
assert_equal "body", @builder.inline_raw("|idgxml|body")
|
506
|
+
end
|
507
|
+
|
508
|
+
def test_inline_raw2
|
509
|
+
assert_equal "body", @builder.inline_raw("|idgxml, latex|body")
|
510
|
+
end
|
511
|
+
|
512
|
+
def test_inline_raw3
|
513
|
+
assert_equal "", @builder.inline_raw("|latex, html|body")
|
514
|
+
end
|
515
|
+
|
516
|
+
def test_inline_raw4
|
517
|
+
assert_equal "|idgxml body", @builder.inline_raw("|idgxml body")
|
518
|
+
end
|
519
|
+
|
520
|
+
def test_inline_raw5
|
521
|
+
assert_equal "nor\nmal", @builder.inline_raw("|idgxml|nor\\nmal")
|
522
|
+
end
|
523
|
+
|
524
|
+
def test_block_raw0
|
525
|
+
@builder.raw("<>!\"\\n& ")
|
526
|
+
expect =<<-EOS
|
527
|
+
<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><>!"
|
528
|
+
&
|
529
|
+
EOS
|
530
|
+
assert_equal expect.chomp, @builder.raw_result
|
531
|
+
end
|
532
|
+
|
533
|
+
def test_block_raw1
|
534
|
+
@builder.raw("|idgxml|<>!\"\\n& ")
|
535
|
+
expect =<<-EOS
|
536
|
+
<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><>!"
|
537
|
+
&
|
538
|
+
EOS
|
539
|
+
assert_equal expect.chomp, @builder.raw_result
|
540
|
+
end
|
541
|
+
|
542
|
+
def test_block_raw2
|
543
|
+
@builder.raw("|idgxml, latex|<>!\"\\n& ")
|
544
|
+
expect =<<-EOS
|
545
|
+
<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><>!\"
|
546
|
+
&
|
547
|
+
EOS
|
548
|
+
assert_equal expect.chomp, @builder.raw_result
|
549
|
+
end
|
550
|
+
|
551
|
+
def test_block_raw3
|
552
|
+
@builder.raw("|latex, html|<>!\"\\n& ")
|
553
|
+
expect =<<-EOS
|
554
|
+
<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/">
|
555
|
+
EOS
|
556
|
+
assert_equal expect.chomp, @builder.raw_result
|
557
|
+
end
|
558
|
+
|
559
|
+
def test_block_raw4
|
560
|
+
@builder.raw("|idgxml <>!\"\\n& ")
|
561
|
+
expect =<<-EOS
|
562
|
+
<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/">|idgxml <>!\"
|
563
|
+
&
|
564
|
+
EOS
|
565
|
+
assert_equal expect.chomp, @builder.raw_result
|
566
|
+
end
|
567
|
+
|
310
568
|
end
|