review 2.3.0 → 2.4.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.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +90 -66
  3. data/.travis.yml +1 -1
  4. data/Gemfile +0 -1
  5. data/NEWS.ja.md +82 -0
  6. data/NEWS.md +83 -0
  7. data/README.md +5 -3
  8. data/Rakefile +8 -8
  9. data/bin/review +1 -5
  10. data/bin/review-catalog-converter +22 -27
  11. data/bin/review-check +36 -43
  12. data/bin/review-checkdep +10 -15
  13. data/bin/review-compile +37 -55
  14. data/bin/review-epubmaker +4 -5
  15. data/bin/review-index +21 -29
  16. data/bin/review-init +26 -37
  17. data/bin/review-pdfmaker +0 -2
  18. data/bin/review-preproc +25 -45
  19. data/bin/review-validate +19 -18
  20. data/bin/review-vol +15 -27
  21. data/doc/config.yml.sample +5 -2
  22. data/doc/format.ja.md +20 -1
  23. data/doc/format.md +21 -5
  24. data/doc/images/review-generate.png +0 -0
  25. data/lib/epubmaker.rb +1 -3
  26. data/lib/epubmaker/content.rb +24 -27
  27. data/lib/epubmaker/epubcommon.rb +135 -148
  28. data/lib/epubmaker/epubv2.rb +39 -46
  29. data/lib/epubmaker/epubv3.rb +93 -103
  30. data/lib/epubmaker/producer.rb +138 -151
  31. data/lib/epubmaker/zip_exporter.rb +21 -26
  32. data/lib/review/book.rb +3 -6
  33. data/lib/review/book/base.rb +78 -103
  34. data/lib/review/book/chapter.rb +36 -40
  35. data/lib/review/book/compilable.rb +28 -31
  36. data/lib/review/book/image_finder.rb +6 -13
  37. data/lib/review/book/index.rb +100 -121
  38. data/lib/review/book/page_metric.rb +2 -7
  39. data/lib/review/book/part.rb +18 -20
  40. data/lib/review/book/volume.rb +9 -13
  41. data/lib/review/builder.rb +81 -116
  42. data/lib/review/catalog.rb +15 -19
  43. data/lib/review/compiler.rb +64 -83
  44. data/lib/review/configure.rb +87 -97
  45. data/lib/review/converter.rb +2 -7
  46. data/lib/review/epubbuilder.rb +1 -3
  47. data/lib/review/epubmaker.rb +213 -205
  48. data/lib/review/exception.rb +2 -4
  49. data/lib/review/extentions.rb +0 -1
  50. data/lib/review/extentions/hash.rb +2 -2
  51. data/lib/review/extentions/string.rb +5 -30
  52. data/lib/review/htmlbuilder.rb +320 -375
  53. data/lib/review/htmltoc.rb +4 -7
  54. data/lib/review/htmlutils.rb +29 -32
  55. data/lib/review/i18n.rb +33 -44
  56. data/lib/review/i18n.yml +3 -3
  57. data/lib/review/idgxmlbuilder.rb +309 -345
  58. data/lib/review/latexbuilder.rb +175 -212
  59. data/lib/review/latexindex.rb +2 -8
  60. data/lib/review/latexutils.rb +33 -43
  61. data/lib/review/lineinput.rb +1 -1
  62. data/lib/review/logger.rb +21 -0
  63. data/lib/review/makerhelper.rb +1 -4
  64. data/lib/review/markdownbuilder.rb +44 -53
  65. data/lib/review/md2inaobuilder.rb +6 -12
  66. data/lib/review/pdfmaker.rb +143 -173
  67. data/lib/review/preprocessor.rb +64 -101
  68. data/lib/review/rstbuilder.rb +126 -158
  69. data/lib/review/sec_counter.rb +18 -34
  70. data/lib/review/template.rb +4 -5
  71. data/lib/review/textbuilder.rb +2 -3
  72. data/lib/review/textutils.rb +7 -13
  73. data/lib/review/tocparser.rb +31 -56
  74. data/lib/review/tocprinter.rb +26 -52
  75. data/lib/review/topbuilder.rb +219 -247
  76. data/lib/review/unfold.rb +15 -24
  77. data/lib/review/version.rb +1 -1
  78. data/lib/review/webmaker.rb +75 -99
  79. data/lib/review/webtocprinter.rb +15 -20
  80. data/lib/review/yamlloader.rb +13 -15
  81. data/review.gemspec +20 -22
  82. data/templates/latex/layout.tex.erb +2 -2
  83. data/templates/opf/epubv2.opf.erb +7 -7
  84. data/templates/opf/epubv3.opf.erb +7 -7
  85. data/templates/web/html/layout-html5.html.erb +2 -2
  86. data/test/assets/black.eps +280 -0
  87. data/test/assets/fit.png +0 -0
  88. data/test/assets/large.gif +0 -0
  89. data/test/assets/large.jpg +0 -0
  90. data/test/assets/large.png +0 -0
  91. data/test/assets/large.svg +65 -0
  92. data/test/assets/test_template.tex +1 -1
  93. data/test/book_test_helper.rb +2 -2
  94. data/test/run_test.rb +4 -4
  95. data/test/sample-book/src/Rakefile +21 -22
  96. data/test/syntax-book/Gemfile +4 -0
  97. data/test/syntax-book/Rakefile +72 -0
  98. data/test/syntax-book/appA.re +22 -0
  99. data/test/syntax-book/bib.re +6 -0
  100. data/test/syntax-book/catalog.yml +15 -0
  101. data/test/syntax-book/ch01.re +136 -0
  102. data/test/syntax-book/ch02.re +351 -0
  103. data/test/syntax-book/ch03.re +82 -0
  104. data/test/syntax-book/config.yml +35 -0
  105. data/test/syntax-book/images/ball.png +0 -0
  106. data/test/syntax-book/images/cover.jpg +0 -0
  107. data/test/syntax-book/images/fractal.png +0 -0
  108. data/test/syntax-book/images/img3-1.png +0 -0
  109. data/test/syntax-book/images/inlineicon.jpg +0 -0
  110. data/test/syntax-book/images/logic.png +0 -0
  111. data/test/syntax-book/images/logic2.png +0 -0
  112. data/test/syntax-book/images/puzzle.jpg +0 -0
  113. data/test/syntax-book/images/table.jpg +0 -0
  114. data/test/syntax-book/part2.re +6 -0
  115. data/test/syntax-book/pre01.re +26 -0
  116. data/test/syntax-book/review-ext.rb +14 -0
  117. data/test/syntax-book/sty/jumoline.sty +310 -0
  118. data/test/syntax-book/sty/reviewmacro.sty +39 -0
  119. data/test/syntax-book/style.css +494 -0
  120. data/test/syntax-book/syntax.dic +2 -0
  121. data/test/test_book.rb +106 -111
  122. data/test/test_book_chapter.rb +21 -22
  123. data/test/test_book_part.rb +3 -5
  124. data/test/test_builder.rb +11 -22
  125. data/test/test_catalog.rb +17 -18
  126. data/test/test_catalog_converter_cmd.rb +5 -5
  127. data/test/test_compiler.rb +18 -16
  128. data/test/test_configure.rb +35 -38
  129. data/test/test_converter.rb +3 -4
  130. data/test/test_epub3maker.rb +136 -117
  131. data/test/test_epubmaker.rb +107 -114
  132. data/test/test_epubmaker_cmd.rb +2 -4
  133. data/test/test_extentions_hash.rb +32 -33
  134. data/test/test_helper.rb +9 -11
  135. data/test/test_htmlbuilder.rb +454 -420
  136. data/test/test_htmltoc.rb +8 -12
  137. data/test/test_htmlutils.rb +0 -2
  138. data/test/test_i18n.rb +159 -150
  139. data/test/test_idgxmlbuilder.rb +190 -197
  140. data/test/test_image_finder.rb +21 -22
  141. data/test/test_index.rb +24 -29
  142. data/test/test_latexbuilder.rb +274 -264
  143. data/test/test_lineinput.rb +7 -10
  144. data/test/test_location.rb +7 -7
  145. data/test/test_makerhelper.rb +13 -25
  146. data/test/test_markdownbuilder.rb +23 -26
  147. data/test/test_md2inaobuilder.rb +8 -11
  148. data/test/test_pdfmaker.rb +114 -123
  149. data/test/test_pdfmaker_cmd.rb +1 -3
  150. data/test/test_review_ext.rb +3 -5
  151. data/test/test_rstbuilder.rb +92 -97
  152. data/test/test_template.rb +3 -7
  153. data/test/test_textutils.rb +27 -27
  154. data/test/test_tocparser.rb +2 -2
  155. data/test/test_topbuilder.rb +98 -103
  156. data/test/test_webtocprinter.rb +5 -6
  157. data/test/test_yamlloader.rb +42 -42
  158. data/test/test_zip_exporter.rb +12 -18
  159. metadata +86 -9
  160. data/lib/review/ewbbuilder.rb +0 -382
@@ -28,51 +28,51 @@ class TextUtilsTest < Test::Unit::TestCase
28
28
 
29
29
  def test_detab
30
30
  detabed = detab("\t\tabc")
31
- assert_equal " abc", detabed
31
+ assert_equal ' abc', detabed
32
32
  detabed = detab("\tabc\tbcd")
33
- assert_equal " abc bcd", detabed
33
+ assert_equal ' abc bcd', detabed
34
34
  end
35
35
 
36
36
  def test_detab_with_arg
37
- detabed = detab("\t\tabcd\tef",2)
38
- assert_equal " abcd ef", detabed
37
+ detabed = detab("\t\tabcd\tef", 2)
38
+ assert_equal ' abcd ef', detabed
39
39
  detabed = detab("\tabc\tdef", 4)
40
- assert_equal " abc def", detabed
40
+ assert_equal ' abc def', detabed
41
41
  end
42
42
 
43
43
  def test_split_paragraph_empty_nil
44
44
  ret = @tu_nil.split_paragraph([])
45
- assert_equal ret, [""]
45
+ assert_equal ret, ['']
46
46
  end
47
47
 
48
48
  def test_split_paragraph_empty_p
49
49
  ret = @tu_p.split_paragraph([])
50
- assert_equal ret, ["<p></p>"]
50
+ assert_equal ret, ['<p></p>']
51
51
  end
52
52
 
53
53
  def test_split_paragraph_p
54
- ret = @tu_p.split_paragraph(["abc"])
55
- assert_equal ["<p>abc</p>"], ret
56
- ret = @tu_p.split_paragraph(["abc","def"])
57
- assert_equal ["<p>abcdef</p>"], ret
58
- ret = @tu_p.split_paragraph(["abc","","def"])
59
- assert_equal ["<p>abc</p>","<p>def</p>"], ret
60
- ret = @tu_p.split_paragraph(["abc","","","def"])
61
- assert_equal ["<p>abc</p>","<p>def</p>"], ret
62
- ret = @tu_p.split_paragraph(["abc","","","def","ghi"])
63
- assert_equal ["<p>abc</p>","<p>defghi</p>"], ret
54
+ ret = @tu_p.split_paragraph(['abc'])
55
+ assert_equal ['<p>abc</p>'], ret
56
+ ret = @tu_p.split_paragraph(['abc', 'def'])
57
+ assert_equal ['<p>abcdef</p>'], ret
58
+ ret = @tu_p.split_paragraph(['abc', '', 'def'])
59
+ assert_equal ['<p>abc</p>', '<p>def</p>'], ret
60
+ ret = @tu_p.split_paragraph(['abc', '', '', 'def'])
61
+ assert_equal ['<p>abc</p>', '<p>def</p>'], ret
62
+ ret = @tu_p.split_paragraph(['abc', '', '', 'def', 'ghi'])
63
+ assert_equal ['<p>abc</p>', '<p>defghi</p>'], ret
64
64
  end
65
65
 
66
66
  def test_split_paragraph_nil
67
- ret = @tu_nil.split_paragraph(["abc"])
68
- assert_equal ["abc"], ret
69
- ret = @tu_nil.split_paragraph(["abc","def"])
70
- assert_equal ["abcdef"], ret
71
- ret = @tu_nil.split_paragraph(["abc","","def"])
72
- assert_equal ["abc","def"], ret
73
- ret = @tu_nil.split_paragraph(["abc","","","def"])
74
- assert_equal ["abc","def"], ret
75
- ret = @tu_nil.split_paragraph(["abc","","","def","ghi"])
76
- assert_equal ["abc","defghi"], ret
67
+ ret = @tu_nil.split_paragraph(['abc'])
68
+ assert_equal ['abc'], ret
69
+ ret = @tu_nil.split_paragraph(['abc', 'def'])
70
+ assert_equal ['abcdef'], ret
71
+ ret = @tu_nil.split_paragraph(['abc', '', 'def'])
72
+ assert_equal ['abc', 'def'], ret
73
+ ret = @tu_nil.split_paragraph(['abc', '', '', 'def'])
74
+ assert_equal ['abc', 'def'], ret
75
+ ret = @tu_nil.split_paragraph(['abc', '', '', 'def', 'ghi'])
76
+ assert_equal ['abc', 'defghi'], ret
77
77
  end
78
78
  end
@@ -14,12 +14,12 @@ class TOCParserTest < Test::Unit::TestCase
14
14
  def test_tocparser_parse
15
15
  dummy_book = ReVIEW::Book::Base.load
16
16
  io = StringIO.new("= test\n\naaa\n//image[foo][bar]{\n//}\n\n== test2\n\n=== test3\n\n==test21\n\n=test11\n")
17
- chap = ReVIEW::Book::Chapter.new(dummy_book, 1, 'foo', "bar/foo.re", io)
17
+ chap = ReVIEW::Book::Chapter.new(dummy_book, 1, 'foo', 'bar/foo.re', io)
18
18
  ret = TOCParser.parse(chap)
19
19
  assert_equal 2, ret.size ## XXX how to count chapters including multiple L1 headlines ??
20
20
  chap_node = ret[0]
21
21
  assert_equal ReVIEW::TOCParser::Chapter, chap_node.class
22
- assert_equal "foo", chap_node.chapter_id
22
+ assert_equal 'foo', chap_node.chapter_id
23
23
  assert_equal 1, chap_node.number
24
24
  end
25
25
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'test_helper'
4
2
  require 'review/compiler'
5
3
  require 'review/book'
@@ -10,12 +8,10 @@ class TOPBuidlerTest < Test::Unit::TestCase
10
8
  include ReVIEW
11
9
 
12
10
  def setup
13
- @builder = TOPBuilder.new()
11
+ @builder = TOPBuilder.new
14
12
  @config = ReVIEW::Configure.values
15
- @config.merge!({
16
- "secnolevel" => 2,
17
- "language" => "ja",
18
- })
13
+ @config['secnolevel'] = 2
14
+ @config['language'] = 'ja'
19
15
  @book = Book::Base.new(nil)
20
16
  @book.config = @config
21
17
  @compiler = ReVIEW::Compiler.new(@builder)
@@ -29,209 +25,209 @@ class TOPBuidlerTest < Test::Unit::TestCase
29
25
  puts msg
30
26
  end
31
27
  end
32
- I18n.setup(@config["language"])
28
+ I18n.setup(@config['language'])
33
29
  end
34
30
 
35
31
  def test_headline_level1
36
32
  actual = compile_block("={test} this is test.\n")
37
- assert_equal %Q|■H1■第1章 this is test.\n|, actual
33
+ assert_equal %Q(■H1■第1章 this is test.\n), actual
38
34
  end
39
35
 
40
36
  def test_headline_level1_without_secno
41
- @config["secnolevel"] = 0
37
+ @config['secnolevel'] = 0
42
38
  actual = compile_block("={test} this is test.\n")
43
- assert_equal %Q|■H1■this is test.\n|, actual
39
+ assert_equal %Q(■H1■this is test.\n), actual
44
40
  end
45
41
 
46
42
  def test_headline_level2
47
43
  actual = compile_block("=={test} this is test.\n")
48
- assert_equal %Q|■H2■1.1 this is test.\n|, actual
44
+ assert_equal %Q(■H2■1.1 this is test.\n), actual
49
45
  end
50
46
 
51
47
  def test_headline_level3
52
48
  actual = compile_block("==={test} this is test.\n")
53
- assert_equal %Q|■H3■this is test.\n|, actual
49
+ assert_equal %Q(■H3■this is test.\n), actual
54
50
  end
55
51
 
56
52
  def test_headline_level3_with_secno
57
- @config["secnolevel"] = 3
53
+ @config['secnolevel'] = 3
58
54
  actual = compile_block("==={test} this is test.\n")
59
- assert_equal %Q|■H3■1.0.1 this is test.\n|, actual
55
+ assert_equal %Q(■H3■1.0.1 this is test.\n), actual
60
56
  end
61
57
 
62
58
  def test_href
63
- actual = compile_inline("@<href>{http://github.com, GitHub}")
64
- assert_equal %Q|GitHub(△http://github.com☆)|, actual
59
+ actual = compile_inline('@<href>{http://github.com, GitHub}')
60
+ assert_equal 'GitHub(△http://github.com☆)', actual
65
61
  end
66
62
 
67
63
  def test_href_without_label
68
- actual = compile_inline("@<href>{http://github.com}")
69
- assert_equal %Q|△http://github.com☆|, actual
64
+ actual = compile_inline('@<href>{http://github.com}')
65
+ assert_equal '△http://github.com☆', actual
70
66
  end
71
67
 
72
68
  def test_inline_raw
73
- actual = compile_inline("@<raw>{@<tt>{inline\}}")
74
- assert_equal %Q|@<tt>{inline}|, actual
69
+ actual = compile_inline('@<raw>{@<tt>{inline\}}')
70
+ assert_equal '@<tt>{inline}', actual
75
71
  end
76
72
 
77
73
  def test_inline_ruby
78
- actual = compile_inline("@<ruby>{coffin,bed}")
79
- assert_equal %Q|coffin◆→DTP連絡:「coffin」に「bed」とルビ←◆|, actual
74
+ actual = compile_inline('@<ruby>{coffin,bed}')
75
+ assert_equal 'coffin◆→DTP連絡:「coffin」に「bed」とルビ←◆', actual
80
76
  end
81
77
 
82
78
  def test_inline_kw
83
- actual = compile_inline("@<kw>{ISO, International Organization for Standardization } @<kw>{Ruby<>}")
84
- assert_equal %Q|★ISO☆(International Organization for Standardization) ★Ruby<>☆|, actual
79
+ actual = compile_inline('@<kw>{ISO, International Organization for Standardization } @<kw>{Ruby<>}')
80
+ assert_equal '★ISO☆(International Organization for Standardization) ★Ruby<>☆', actual
85
81
  end
86
82
 
87
83
  def test_inline_maru
88
- actual = compile_inline("@<maru>{1}@<maru>{20}@<maru>{A}@<maru>{z}")
89
- assert_equal %Q|1◆→丸数字1←◆20◆→丸数字20←◆A◆→丸数字A←◆z◆→丸数字z←◆|, actual
84
+ actual = compile_inline('@<maru>{1}@<maru>{20}@<maru>{A}@<maru>{z}')
85
+ assert_equal '1◆→丸数字1←◆20◆→丸数字20←◆A◆→丸数字A←◆z◆→丸数字z←◆', actual
90
86
  end
91
87
 
92
88
  def test_inline_br
93
- actual = compile_inline("@<br>{}")
94
- assert_equal %Q|\n|, actual
89
+ actual = compile_inline('@<br>{}')
90
+ assert_equal "\n", actual
95
91
  end
96
92
 
97
93
  def test_inline_i
98
- actual = compile_inline("test @<i>{inline test} test2")
99
- assert_equal %Q|test ▲inline test☆ test2|, actual
94
+ actual = compile_inline('test @<i>{inline test} test2')
95
+ assert_equal 'test ▲inline test☆ test2', actual
100
96
  end
101
97
 
102
98
  def test_inline_i_and_escape
103
- actual = compile_inline("test @<i>{inline<&;\\ test} test2")
104
- assert_equal %Q|test ▲inline<&;\\ test☆ test2|, actual
99
+ actual = compile_inline('test @<i>{inline<&;\\ test} test2')
100
+ assert_equal 'test ▲inline<&;\\ test☆ test2', actual
105
101
  end
106
102
 
107
103
  def test_inline_b
108
- actual = compile_inline("test @<b>{inline test} test2")
109
- assert_equal %Q|test ★inline test☆ test2|, actual
104
+ actual = compile_inline('test @<b>{inline test} test2')
105
+ assert_equal 'test ★inline test☆ test2', actual
110
106
  end
111
107
 
112
108
  def test_inline_b_and_escape
113
- actual = compile_inline("test @<b>{inline<&;\\ test} test2")
114
- assert_equal %Q|test ★inline<&;\\ test☆ test2|, actual
109
+ actual = compile_inline('test @<b>{inline<&;\\ test} test2')
110
+ assert_equal 'test ★inline<&;\\ test☆ test2', actual
115
111
  end
116
112
 
117
113
  def test_inline_tt
118
- actual = compile_inline("test @<tt>{inline test} test2@<tt>{\\}}")
119
- assert_equal %Q|test △inline test☆ test2△}☆|, actual
114
+ actual = compile_inline('test @<tt>{inline test} test2@<tt>{\\}}')
115
+ assert_equal 'test △inline test☆ test2△}☆', actual
120
116
  end
121
117
 
122
118
  def test_inline_tti
123
- actual = compile_inline("test @<tti>{inline test} test2")
124
- assert_equal %Q|test ▲inline test☆◆→等幅フォントイタ←◆ test2|, actual
119
+ actual = compile_inline('test @<tti>{inline test} test2')
120
+ assert_equal 'test ▲inline test☆◆→等幅フォントイタ←◆ test2', actual
125
121
  end
126
122
 
127
123
  def test_inline_ttb
128
- actual = compile_inline("test @<ttb>{inline test} test2")
129
- assert_equal %Q|test ★inline test☆◆→等幅フォント太字←◆ test2|, actual
124
+ actual = compile_inline('test @<ttb>{inline test} test2')
125
+ assert_equal 'test ★inline test☆◆→等幅フォント太字←◆ test2', actual
130
126
  end
131
127
 
132
128
  def test_inline_uchar
133
- actual = compile_inline("test @<uchar>{2460} test2")
134
- assert_equal %Q|test ① test2|, actual
129
+ actual = compile_inline('test @<uchar>{2460} test2')
130
+ assert_equal 'test ① test2', actual
135
131
  end
136
132
 
137
133
  def test_inline_comment
138
- actual = compile_inline("test @<comment>{コメント} test2")
139
- assert_equal %Q|test test2|, actual
134
+ actual = compile_inline('test @<comment>{コメント} test2')
135
+ assert_equal 'test test2', actual
140
136
  end
141
137
 
142
138
  def test_inline_comment_for_draft
143
- @config["draft"] = true
144
- actual = compile_inline("test @<comment>{コメント} test2")
145
- assert_equal %Q|test ◆→コメント←◆ test2|, actual
139
+ @config['draft'] = true
140
+ actual = compile_inline('test @<comment>{コメント} test2')
141
+ assert_equal 'test ◆→コメント←◆ test2', actual
146
142
  end
147
143
 
148
144
  def test_inline_in_table
149
145
  actual = compile_block("//table{\n★1☆\t▲2☆\n------------\n★3☆\t▲4☆<>&\n//}\n")
150
- assert_equal %Q|◆→開始:表←◆\n★★1☆☆\t★▲2☆☆\n★3☆\t▲4☆<>&\n◆→終了:表←◆\n\n|, actual
146
+ assert_equal %Q(◆→開始:表←◆\n★★1☆☆\t★▲2☆☆\n★3☆\t▲4☆<>&\n◆→終了:表←◆\n\n), actual
151
147
  end
152
148
 
153
149
  def test_dlist_beforeulol
154
150
  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")
155
- assert_equal %Q|★foo☆\n\tfoo.\n\t\n\npara\n\n★foo☆\n\tfoo.\n\t\n\n1\tbar\n\n★foo☆\n\tfoo.\n\t\n\n●\tbar\n\n|, actual
151
+ assert_equal %Q(★foo☆\n\tfoo.\n\t\n\npara\n\n★foo☆\n\tfoo.\n\t\n\n1\tbar\n\n★foo☆\n\tfoo.\n\t\n\n●\tbar\n\n), actual
156
152
  end
157
153
 
158
154
  def test_paragraph
159
155
  actual = compile_block("foo\nbar\n")
160
- assert_equal %Q|foobar\n|, actual
156
+ assert_equal %Q(foobar\n), actual
161
157
  end
162
158
 
163
159
  def test_tabbed_paragraph
164
160
  actual = compile_block("\tfoo\nbar\n")
165
- assert_equal %Q|\tfoobar\n|, actual
161
+ assert_equal %Q(\tfoobar\n), actual
166
162
  end
167
163
 
168
164
  def test_flushright
169
165
  actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
170
- assert_equal %Q|◆→開始:右寄せ←◆\nfoobar\nbuz\n◆→終了:右寄せ←◆\n\n|, actual
166
+ assert_equal %Q(◆→開始:右寄せ←◆\nfoobar\nbuz\n◆→終了:右寄せ←◆\n\n), actual
171
167
  end
172
168
 
173
169
  def test_noindent
174
170
  actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
175
- assert_equal %Q|◆→DTP連絡:次の1行インデントなし←◆\nfoobar\nfoo2bar2\n|, actual
171
+ assert_equal %Q(◆→DTP連絡:次の1行インデントなし←◆\nfoobar\nfoo2bar2\n), actual
176
172
  end
177
173
 
178
174
  def test_comment
179
- actual = compile_block("//comment[コメント]")
180
- assert_equal %Q||, actual
175
+ actual = compile_block('//comment[コメント]')
176
+ assert_equal '', actual
181
177
  end
182
178
 
183
179
  def test_comment_for_draft
184
- @config["draft"] = true
185
- actual = compile_block("//comment[コメント]")
186
- assert_equal %Q|◆→コメント←◆\n|, actual
180
+ @config['draft'] = true
181
+ actual = compile_block('//comment[コメント]')
182
+ assert_equal %Q(◆→コメント←◆\n), actual
187
183
  end
188
184
 
189
185
  def test_list
190
- def @chapter.list(id)
191
- Book::ListIndex::Item.new("test",1)
186
+ def @chapter.list(_id)
187
+ Book::ListIndex::Item.new('test', 1)
192
188
  end
193
189
  actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
194
- assert_equal %Q|◆→開始:リスト←◆\nリスト1.1 this is ★test☆<&>_\n\nfoo\nbar\n◆→終了:リスト←◆\n\n|, actual
190
+ assert_equal %Q(◆→開始:リスト←◆\nリスト1.1 this is ★test☆<&>_\n\nfoo\nbar\n◆→終了:リスト←◆\n\n), actual
195
191
  end
196
192
 
197
193
  def test_listnum
198
- def @chapter.list(id)
199
- Book::ListIndex::Item.new("test",1)
194
+ def @chapter.list(_id)
195
+ Book::ListIndex::Item.new('test', 1)
200
196
  end
201
197
  actual = compile_block("//listnum[test][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
202
- assert_equal %Q|◆→開始:リスト←◆\nリスト1.1 this is ★test☆<&>_\n\n 1: foo\n 2: bar\n◆→終了:リスト←◆\n\n|, actual
198
+ assert_equal %Q(◆→開始:リスト←◆\nリスト1.1 this is ★test☆<&>_\n\n 1: foo\n 2: bar\n◆→終了:リスト←◆\n\n), actual
203
199
  end
204
200
 
205
201
  def test_emlistnum
206
202
  actual = compile_block("//emlistnum[this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
207
- assert_equal %Q|◆→開始:インラインリスト←◆\n■this is ★test☆<&>_\n 1: foo\n 2: bar\n◆→終了:インラインリスト←◆\n\n|, actual
203
+ assert_equal %Q(◆→開始:インラインリスト←◆\n■this is ★test☆<&>_\n 1: foo\n 2: bar\n◆→終了:インラインリスト←◆\n\n), actual
208
204
  end
209
205
 
210
206
  def test_bib
211
- def @chapter.bibpaper(id)
212
- Book::BibpaperIndex::Item.new("samplebib",1,"sample bib")
207
+ def @chapter.bibpaper(_id)
208
+ Book::BibpaperIndex::Item.new('samplebib', 1, 'sample bib')
213
209
  end
214
210
 
215
- assert_equal %Q|[1]|, compile_inline("@<bib>{samplebib}")
211
+ assert_equal '[1]', compile_inline('@<bib>{samplebib}')
216
212
  end
217
213
 
218
214
  def test_table
219
215
  actual = compile_block("//table{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
220
- assert_equal %Q|◆→開始:表←◆\n★aaa☆\t★bbb☆\nccc\tddd<>&\n◆→終了:表←◆\n\n|,
216
+ assert_equal %Q(◆→開始:表←◆\n★aaa☆\t★bbb☆\nccc\tddd<>&\n◆→終了:表←◆\n\n),
221
217
  actual
222
218
  end
223
219
 
224
220
  def test_inline_table
225
- def @chapter.table(id)
226
- Book::TableIndex::Item.new("sampletable",1)
221
+ def @chapter.table(_id)
222
+ Book::TableIndex::Item.new('sampletable', 1)
227
223
  end
228
224
  actual = compile_block("@<table>{sampletest}\n")
229
- assert_equal %Q|表1.1\n|, actual
225
+ assert_equal "表1.1\n", actual
230
226
  end
231
227
 
232
228
  def test_emtable
233
229
  actual = compile_block("//emtable[foo]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n//emtable{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
234
- assert_equal %Q|◆→開始:表←◆\nfoo\n\n★aaa☆\t★bbb☆\nccc\tddd<>&\n◆→終了:表←◆\n\n◆→開始:表←◆\n★aaa☆\t★bbb☆\nccc\tddd<>&\n◆→終了:表←◆\n\n|,
230
+ assert_equal %Q(◆→開始:表←◆\nfoo\n\n★aaa☆\t★bbb☆\nccc\tddd<>&\n◆→終了:表←◆\n\n◆→開始:表←◆\n★aaa☆\t★bbb☆\nccc\tddd<>&\n◆→終了:表←◆\n\n),
235
231
  actual
236
232
  end
237
233
 
@@ -270,83 +266,83 @@ class TOPBuidlerTest < Test::Unit::TestCase
270
266
  end
271
267
 
272
268
  def test_image
273
- def @chapter.image(id)
274
- item = Book::ImageIndex::Item.new("sampleimg",1)
275
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
269
+ def @chapter.image(_id)
270
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
271
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
276
272
  item
277
273
  end
278
274
 
279
275
  actual = compile_block("//image[sampleimg][sample photo]{\nfoo\n//}\n")
280
- assert_equal %Q|◆→開始:図←◆\n図1.1 sample photo\n\n◆→./images/chap1-sampleimg.png←◆\n◆→終了:図←◆\n\n|, actual
276
+ assert_equal %Q(◆→開始:図←◆\n図1.1 sample photo\n\n◆→./images/chap1-sampleimg.png←◆\n◆→終了:図←◆\n\n), actual
281
277
  end
282
278
 
283
279
  def test_image_with_metric
284
- def @chapter.image(id)
285
- item = Book::ImageIndex::Item.new("sampleimg",1)
286
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
280
+ def @chapter.image(_id)
281
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
282
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
287
283
  item
288
284
  end
289
285
 
290
286
  actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\nfoo\n//}\n")
291
- assert_equal %Q|◆→開始:図←◆\n図1.1 sample photo\n\n◆→./images/chap1-sampleimg.png←◆\n◆→終了:図←◆\n\n|, actual
287
+ assert_equal %Q(◆→開始:図←◆\n図1.1 sample photo\n\n◆→./images/chap1-sampleimg.png scale=1.2←◆\n◆→終了:図←◆\n\n), actual
292
288
  end
293
289
 
294
290
  def test_texequation
295
291
  actual = compile_block("//texequation{\n\\sin\n1^{2}\n//}\n")
296
- assert_equal %Q|◆→開始:TeX式←◆\n\\sin\n1^{2}\n◆→終了:TeX式←◆\n\n|, actual
292
+ assert_equal %Q(◆→開始:TeX式←◆\n\\sin\n1^{2}\n◆→終了:TeX式←◆\n\n), actual
297
293
  end
298
294
 
299
295
  def test_inline_raw0
300
- assert_equal "normal", compile_inline("@<raw>{normal}")
296
+ assert_equal 'normal', compile_inline('@<raw>{normal}')
301
297
  end
302
298
 
303
299
  def test_inline_raw1
304
- assert_equal "body", compile_inline("@<raw>{|top|body}")
300
+ assert_equal 'body', compile_inline('@<raw>{|top|body}')
305
301
  end
306
302
 
307
303
  def test_inline_raw2
308
- assert_equal "body", compile_inline("@<raw>{|top, latex|body}")
304
+ assert_equal 'body', compile_inline('@<raw>{|top, latex|body}')
309
305
  end
310
306
 
311
307
  def test_inline_raw3
312
- assert_equal "", compile_inline("@<raw>{|idgxml, html|body}")
308
+ assert_equal '', compile_inline('@<raw>{|idgxml, html|body}')
313
309
  end
314
310
 
315
311
  def test_inline_raw4
316
- assert_equal "|top body", compile_inline("@<raw>{|top body}")
312
+ assert_equal '|top body', compile_inline('@<raw>{|top body}')
317
313
  end
318
314
 
319
315
  def test_inline_raw5
320
- assert_equal "nor\nmal", compile_inline("@<raw>{|top|nor\\nmal}")
316
+ assert_equal "nor\nmal", compile_inline('@<raw>{|top|nor\\nmal}')
321
317
  end
322
318
 
323
319
  def test_block_raw0
324
- actual = compile_block("//raw[<>!\"\\n& ]\n")
325
- expected = %Q(<>!\"\n& )
320
+ actual = compile_block(%Q(//raw[<>!"\\n& ]\n))
321
+ expected = %Q(<>!"\n& )
326
322
  assert_equal expected.chomp, actual
327
323
  end
328
324
 
329
325
  def test_block_raw1
330
- actual = compile_block("//raw[|top|<>!\"\\n& ]\n")
331
- expected = %Q(<>!\"\n& )
326
+ actual = compile_block(%Q(//raw[|top|<>!"\\n& ]\n))
327
+ expected = %Q(<>!"\n& )
332
328
  assert_equal expected.chomp, actual
333
329
  end
334
330
 
335
331
  def test_block_raw2
336
- actual = compile_block("//raw[|top, latex|<>!\"\\n& ]\n")
337
- expected = %Q(<>!\"\n& )
332
+ actual = compile_block(%Q(//raw[|top, latex|<>!"\\n& ]\n))
333
+ expected = %Q(<>!"\n& )
338
334
  assert_equal expected.chomp, actual
339
335
  end
340
336
 
341
337
  def test_block_raw3
342
- actual = compile_block("//raw[|latex, idgxml|<>!\"\\n& ]\n")
338
+ actual = compile_block(%Q(//raw[|latex, idgxml|<>!"\\n& ]\n))
343
339
  expected = ''
344
340
  assert_equal expected.chomp, actual
345
341
  end
346
342
 
347
343
  def test_block_raw4
348
- actual = compile_block("//raw[|top <>!\"\\n& ]\n")
349
- expected = %Q(|top <>!\"\n& )
344
+ actual = compile_block(%Q(//raw[|top <>!"\\n& ]\n))
345
+ expected = %Q(|top <>!"\n& )
350
346
  assert_equal expected.chomp, actual
351
347
  end
352
348
 
@@ -355,7 +351,7 @@ class TOPBuidlerTest < Test::Unit::TestCase
355
351
  end
356
352
 
357
353
  def test_column_ref
358
- review =<<-EOS
354
+ review = <<-EOS
359
355
  ===[column]{foo} test
360
356
 
361
357
  inside column
@@ -364,7 +360,7 @@ inside column
364
360
 
365
361
  this is @<column>{foo}.
366
362
  EOS
367
- expected =<<-EOS
363
+ expected = <<-EOS
368
364
  ◆→開始:コラム←◆
369
365
  ■test
370
366
  inside column
@@ -376,5 +372,4 @@ EOS
376
372
 
377
373
  assert_equal expected, column_helper(review)
378
374
  end
379
-
380
375
  end