review 2.0.0.beta1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +66 -1
  3. data/.rubocop_todo.yml +617 -0
  4. data/.travis.yml +16 -1
  5. data/ChangeLog +48 -0
  6. data/Dockerfile +22 -0
  7. data/Gemfile +0 -1
  8. data/README.md +97 -0
  9. data/Rakefile +10 -11
  10. data/appveyor.yml +9 -0
  11. data/bin/review +46 -0
  12. data/bin/review-check +8 -21
  13. data/bin/review-compile +26 -43
  14. data/bin/review-index +9 -22
  15. data/bin/review-init +21 -25
  16. data/bin/review-preproc +9 -13
  17. data/bin/review-validate +1 -1
  18. data/bin/review-vol +3 -17
  19. data/bin/review-webmaker +15 -0
  20. data/doc/NEWS.ja.md +534 -0
  21. data/doc/NEWS.md +538 -0
  22. data/doc/catalog.ja.md +10 -18
  23. data/doc/catalog.md +5 -9
  24. data/doc/config.yml.sample +319 -0
  25. data/doc/customize_epub.ja.md +42 -0
  26. data/doc/format.ja.md +320 -288
  27. data/doc/format.md +277 -170
  28. data/doc/format_idg.ja.md +82 -175
  29. data/doc/pdfmaker.ja.md +61 -0
  30. data/doc/pdfmaker.md +65 -0
  31. data/doc/quickstart.ja.md +88 -98
  32. data/doc/quickstart.md +72 -110
  33. data/doc/sample.css +41 -0
  34. data/doc/writing_vertical.ja.md +55 -0
  35. data/doc/writing_vertical.md +5 -0
  36. data/lib/epubmaker/content.rb +3 -3
  37. data/lib/epubmaker/epubcommon.rb +173 -145
  38. data/lib/epubmaker/epubv2.rb +24 -77
  39. data/lib/epubmaker/epubv3.rb +72 -73
  40. data/lib/epubmaker/producer.rb +54 -30
  41. data/lib/lineinput.rb +48 -0
  42. data/lib/review/book.rb +0 -1
  43. data/lib/review/book/base.rb +47 -27
  44. data/lib/review/book/chapter.rb +48 -19
  45. data/lib/review/book/compilable.rb +10 -14
  46. data/lib/review/book/index.rb +10 -19
  47. data/lib/review/book/page_metric.rb +0 -10
  48. data/lib/review/book/part.rb +17 -3
  49. data/lib/review/builder.rb +84 -68
  50. data/lib/review/catalog.rb +5 -1
  51. data/lib/review/compiler.rb +327 -4657
  52. data/lib/review/configure.rb +84 -10
  53. data/lib/review/converter.rb +28 -0
  54. data/lib/review/epubbuilder.rb +1 -1
  55. data/lib/review/epubmaker.rb +142 -158
  56. data/lib/review/ewbbuilder.rb +5 -5
  57. data/lib/review/exception.rb +1 -1
  58. data/lib/review/extentions.rb +1 -1
  59. data/lib/review/extentions/hash.rb +15 -0
  60. data/lib/review/extentions/string.rb +2 -1
  61. data/lib/review/htmlbuilder.rb +364 -348
  62. data/lib/review/htmltoc.rb +44 -0
  63. data/lib/review/htmlutils.rb +12 -6
  64. data/lib/review/i18n.rb +78 -6
  65. data/lib/review/i18n.yml +7 -4
  66. data/lib/review/idgxmlbuilder.rb +226 -267
  67. data/lib/review/latexbuilder.rb +281 -274
  68. data/lib/review/latexutils.rb +56 -49
  69. data/lib/review/makerhelper.rb +8 -4
  70. data/lib/review/markdownbuilder.rb +80 -124
  71. data/lib/review/pdfmaker.rb +197 -138
  72. data/lib/review/preprocessor.rb +16 -67
  73. data/lib/review/template.rb +24 -0
  74. data/lib/review/textbuilder.rb +1 -1
  75. data/lib/review/textutils.rb +18 -24
  76. data/lib/review/tocparser.rb +51 -106
  77. data/lib/review/tocprinter.rb +61 -117
  78. data/lib/review/topbuilder.rb +119 -126
  79. data/lib/review/unfold.rb +2 -2
  80. data/lib/review/version.rb +1 -1
  81. data/lib/review/webmaker.rb +302 -0
  82. data/lib/review/webtocprinter.rb +48 -0
  83. data/lib/review/yamlloader.rb +47 -0
  84. data/review.gemspec +3 -3
  85. data/templates/html/layout-html5.html.erb +17 -0
  86. data/templates/html/layout-xhtml1.html.erb +20 -0
  87. data/{lib/review → templates/latex}/layout.tex.erb +107 -115
  88. data/templates/ncx/epubv2.ncx.erb +11 -0
  89. data/templates/opf/epubv2.opf.erb +21 -0
  90. data/templates/opf/epubv3.opf.erb +18 -0
  91. data/templates/web/html/layout-html5.html.erb +56 -0
  92. data/templates/web/html/layout-xhtml1.html.erb +20 -0
  93. data/templates/xml/container.xml.erb +6 -0
  94. data/test/assets/test.xml.erb +3 -0
  95. data/test/assets/test_template.tex +28 -71
  96. data/test/assets/test_template_backmatter.tex +1 -9
  97. data/test/sample-book/src/Rakefile +12 -3
  98. data/{doc/sample.yml → test/sample-book/src/config-epub2.yml} +92 -147
  99. data/test/sample-book/src/config.yml +40 -154
  100. data/test/sample-book/src/style-web.css +45 -0
  101. data/test/sample-book/src/style.css +23 -1
  102. data/test/test.re +1 -1
  103. data/test/test_book.rb +15 -17
  104. data/test/test_book_chapter.rb +2 -80
  105. data/test/test_book_part.rb +1 -1
  106. data/test/test_builder.rb +28 -6
  107. data/test/test_catalog.rb +17 -0
  108. data/test/test_compiler.rb +14 -59
  109. data/test/test_configure.rb +94 -0
  110. data/test/test_converter.rb +21 -0
  111. data/test/test_epub3maker.rb +155 -3
  112. data/test/test_epubmaker.rb +245 -30
  113. data/test/test_epubmaker_cmd.rb +2 -2
  114. data/test/test_extentions_hash.rb +60 -0
  115. data/test/test_helper.rb +4 -47
  116. data/test/test_htmlbuilder.rb +282 -175
  117. data/test/test_htmltoc.rb +33 -0
  118. data/test/test_i18n.rb +134 -70
  119. data/test/test_idgxmlbuilder.rb +58 -39
  120. data/test/test_latexbuilder.rb +132 -14
  121. data/test/test_lineinput.rb +5 -26
  122. data/test/test_makerhelper.rb +6 -4
  123. data/test/test_markdownbuilder.rb +23 -5
  124. data/test/test_pdfmaker.rb +86 -20
  125. data/test/test_pdfmaker_cmd.rb +1 -3
  126. data/test/test_review_ext.rb +1 -1
  127. data/test/test_template.rb +27 -0
  128. data/test/test_textutils.rb +36 -0
  129. data/test/test_tocparser.rb +25 -0
  130. data/test/test_topbuilder.rb +34 -2
  131. data/test/test_yamlloader.rb +188 -0
  132. metadata +71 -29
  133. data/README.rdoc +0 -81
  134. data/bin/review-epubmaker-legacy +0 -1024
  135. data/doc/ruby-uuid/README +0 -11
  136. data/doc/ruby-uuid/README.ja +0 -34
  137. data/lib/review/compiler/literals_1_8.kpeg +0 -19
  138. data/lib/review/compiler/literals_1_8.rb +0 -432
  139. data/lib/review/compiler/literals_1_9.kpeg +0 -22
  140. data/lib/review/compiler/literals_1_9.rb +0 -435
  141. data/lib/review/extentions/array.rb +0 -25
  142. data/lib/review/htmllayout.rb +0 -41
  143. data/lib/review/inaobuilder.rb +0 -357
  144. data/lib/review/location.rb +0 -24
  145. data/lib/review/node.rb +0 -267
  146. data/lib/review/review.kpeg +0 -724
  147. data/lib/uuid.rb +0 -312
  148. data/rubocop-todo.yml +0 -456
  149. data/test/test_inaobuilder.rb +0 -247
  150. data/test/test_uuid.rb +0 -157
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ require 'test_helper'
4
+ require 'review/htmltoc'
5
+
6
+ class HTMLTocTest < Test::Unit::TestCase
7
+ include ReVIEW
8
+
9
+ def setup
10
+ end
11
+
12
+ def teardown
13
+ end
14
+
15
+ def test_tocfilename
16
+ toc = HTMLToc.new("/var/tmp")
17
+ assert_equal "/var/tmp/toc-html.txt", toc.tocfilename
18
+ end
19
+
20
+ def test_encode_args
21
+ toc = HTMLToc.new("/var/tmp")
22
+ assert_equal "chaptype=pre", toc.encode_args({:chaptype => "pre"})
23
+ assert_equal "force_include=true,chaptype=body,properties=foo", toc.encode_args({:force_include => true, :chaptype => "body", "properties"=>"foo"})
24
+ end
25
+
26
+ def test_decode_args
27
+ toc = HTMLToc.new("/var/tmp")
28
+ assert_equal({:chaptype => "pre"}, toc.decode_args("chaptype=pre"))
29
+ assert_equal({:force_include => "true", :chaptype => "body",:properties=>"foo"}, toc.decode_args("force_include=true,chaptype=body,properties=foo"))
30
+ end
31
+
32
+ end
33
+
@@ -1,96 +1,154 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require 'test_helper'
3
- require 'review/i18n'
4
-
5
- require 'review/compiler'
6
- require 'review/book'
7
- require 'review/htmlbuilder'
3
+ require 'review'
8
4
  require 'tmpdir'
9
5
 
10
6
  class I18nTest < Test::Unit::TestCase
11
7
  include ReVIEW
12
8
 
13
- if RUBY_VERSION !~ /^1.8/ ## to avoid Travis error :-(
14
- def test_load_locale_yml
15
- Dir.mktmpdir do |dir|
16
- Dir.chdir(dir) do
17
- file = File.join(dir, "locale.yml")
18
- File.open(file, "w"){|f| f.write("locale: ja\nfoo: \"bar\"\n")}
19
- I18n.setup
20
- assert_equal "bar", I18n.t("foo")
21
- end
9
+ def test_load_locale_yml
10
+ Dir.mktmpdir do |dir|
11
+ Dir.chdir(dir) do
12
+ file = File.join(dir, "locale.yml")
13
+ File.open(file, "w"){|f| f.write("locale: ja\nfoo: \"bar\"\n")}
14
+ I18n.setup
15
+ assert_equal "bar", I18n.t("foo")
22
16
  end
23
17
  end
18
+ end
24
19
 
25
- def test_load_locale_yaml
26
- Dir.mktmpdir do |dir|
27
- Dir.chdir(dir) do
28
- file = File.join(dir, "locale.yaml")
29
- File.open(file, "w"){|f| f.write("locale: ja\nfoo: \"bar\"\n")}
20
+ def test_load_locale_yaml
21
+ Dir.mktmpdir do |dir|
22
+ Dir.chdir(dir) do
23
+ file = File.join(dir, "locale.yaml")
24
+ File.open(file, "w"){|f| f.write("locale: ja\nfoo: \"bar\"\n")}
25
+ assert_raise ReVIEW::ConfigError do
30
26
  I18n.setup
31
- assert_equal "bar", I18n.t("foo")
32
27
  end
33
28
  end
34
29
  end
30
+ end
35
31
 
36
- def test_load_foo_yaml
37
- Dir.mktmpdir do |dir|
38
- Dir.chdir(dir) do
39
- file = File.join(dir, "foo.yml")
40
- File.open(file, "w"){|f| f.write("locale: ja\nfoo: \"bar\"\n")}
41
- I18n.setup("ja","foo.yml")
42
- assert_equal "bar", I18n.t("foo")
43
- end
32
+ def test_load_foo_yaml
33
+ Dir.mktmpdir do |dir|
34
+ Dir.chdir(dir) do
35
+ file = File.join(dir, "foo.yml")
36
+ File.open(file, "w"){|f| f.write("locale: ja\nfoo: \"bar\"\n")}
37
+ I18n.setup("ja","foo.yml")
38
+ assert_equal "bar", I18n.t("foo")
44
39
  end
45
40
  end
41
+ end
46
42
 
47
- def test_update_foo_yaml
48
- Dir.mktmpdir do |dir|
49
- Dir.chdir(dir) do
50
- file = File.join(dir, "foo.yml")
51
- File.open(file, "w"){|f| f.write("locale: ja\nfoo: \"bar\"\n")}
52
- i18n = ReVIEW::I18n.new("ja")
53
- i18n.update_localefile(File.join(Dir.pwd, "foo.yml"))
54
- assert_equal "bar", i18n.t("foo")
55
- end
43
+ def test_update_foo_yaml
44
+ Dir.mktmpdir do |dir|
45
+ Dir.chdir(dir) do
46
+ file = File.join(dir, "foo.yml")
47
+ File.open(file, "w"){|f| f.write("locale: ja\nfoo: \"bar\"\n")}
48
+ i18n = ReVIEW::I18n.new("ja")
49
+ i18n.update_localefile(File.join(Dir.pwd, "foo.yml"))
50
+ assert_equal "bar", i18n.t("foo")
56
51
  end
57
52
  end
53
+ end
58
54
 
59
- def test_update_foo_yaml_i18nclass
60
- Dir.mktmpdir do |dir|
61
- Dir.chdir(dir) do
62
- file = File.join(dir, "foo.yml")
63
- File.open(file, "w"){|f| f.write("locale: ja\nfoo: \"bar\"\n")}
64
- I18n.setup("ja", "foo.yml")
65
- assert_equal "bar", I18n.t("foo")
66
- end
55
+ def test_update_foo_yaml_i18nclass
56
+ Dir.mktmpdir do |dir|
57
+ Dir.chdir(dir) do
58
+ file = File.join(dir, "foo.yml")
59
+ File.open(file, "w"){|f| f.write("locale: ja\nfoo: \"bar\"\n")}
60
+ I18n.setup("ja", "foo.yml")
61
+ assert_equal "bar", I18n.t("foo")
67
62
  end
68
63
  end
64
+ end
65
+
66
+ def test_load_locale_yml_i18n
67
+ Dir.mktmpdir do |dir|
68
+ Dir.chdir(dir) do
69
+ file = File.join(dir, "locale.yml")
70
+ File.open(file, "w"){|f| f.write("ja:\n foo: \"bar\"\nen:\n foo: \"buz\"\n")}
71
+ I18n.setup
72
+ assert_equal "bar", I18n.t("foo")
73
+ assert_equal "図", I18n.t("image")
74
+ I18n.setup("en")
75
+ assert_equal "buz", I18n.t("foo")
76
+ assert_equal "Figure ", I18n.t("image")
77
+ end
78
+ end
79
+ end
69
80
 
70
- def test_load_locale_yml_i18n
71
- Dir.mktmpdir do |dir|
72
- Dir.chdir(dir) do
73
- file = File.join(dir, "locale.yml")
74
- File.open(file, "w"){|f| f.write("ja:\n foo: \"bar\"\nen:\n foo: \"buz\"\n")}
81
+ def test_load_locale_invalid_yml
82
+ Dir.mktmpdir do |dir|
83
+ Dir.chdir(dir) do
84
+ file = File.join(dir, "locale.yml")
85
+ File.open(file, "w"){|f| f.write("local: ja\nfoo: \"bar\"\n")}
86
+ assert_raises(ReVIEW::KeyError) do
75
87
  I18n.setup
76
- assert_equal "bar", I18n.t("foo")
77
- assert_equal "図", I18n.t("image")
78
- I18n.setup("en")
79
- assert_equal "buz", I18n.t("foo")
80
- assert_equal "Figure ", I18n.t("image")
81
88
  end
82
89
  end
83
90
  end
91
+ end
84
92
 
85
- def test_load_locale_invalid_yml
86
- Dir.mktmpdir do |dir|
87
- Dir.chdir(dir) do
88
- file = File.join(dir, "locale.yml")
89
- File.open(file, "w"){|f| f.write("local: ja\nfoo: \"bar\"\n")}
90
- assert_raises(ReVIEW::KeyError) do
91
- I18n.setup
92
- end
93
- end
93
+ def test_custom_format
94
+ Dir.mktmpdir do |dir|
95
+ Dir.chdir(dir) do
96
+ file = File.join(dir, "locale.yml")
97
+ File.open(file, "w"){|f| f.write("locale: ja\nchapter: 第%pa章")}
98
+ I18n.setup("ja")
99
+ assert_equal "第a章", I18n.t("chapter", 1)
100
+
101
+ File.open(file, "w"){|f| f.write("locale: ja\nchapter: 第%pA章")}
102
+ I18n.setup("ja")
103
+ assert_equal "第B章", I18n.t("chapter", 2)
104
+
105
+ File.open(file, "w"){|f| f.write("locale: ja\nchapter: 第%pAW章")}
106
+ I18n.setup("ja")
107
+ assert_equal "第B章", I18n.t("chapter", 2)
108
+
109
+ File.open(file, "w"){|f| f.write("locale: ja\nchapter: 第%paW章")}
110
+ I18n.setup("ja")
111
+ assert_equal "第b章", I18n.t("chapter", 2)
112
+
113
+ File.open(file, "w"){|f| f.write("locale: ja\nchapter: 第%pR章")}
114
+ I18n.setup("ja")
115
+ assert_equal "第I章", I18n.t("chapter", 1)
116
+
117
+ File.open(file, "w"){|f| f.write("locale: ja\nchapter: 第%pr章")}
118
+ I18n.setup("ja")
119
+ assert_equal "第ii章", I18n.t("chapter", 2)
120
+
121
+ File.open(file, "w"){|f| f.write("locale: ja\nchapter: 第%pRW章")}
122
+ I18n.setup("ja")
123
+ assert_equal "第Ⅻ章", I18n.t("chapter", 12)
124
+
125
+ File.open(file, "w"){|f| f.write("locale: ja\nchapter: 第%pJ章")}
126
+ I18n.setup("ja")
127
+ assert_equal "第二十七章", I18n.t("chapter", 27)
128
+
129
+ File.open(file, "w"){|f| f.write("locale: ja\nchapter: 第%pdW章")}
130
+ I18n.setup("ja")
131
+ assert_equal "第1章", I18n.t("chapter", 1)
132
+
133
+ File.open(file, "w"){|f| f.write("locale: ja\nchapter: 第%pdW章")}
134
+ I18n.setup("ja")
135
+ assert_equal "第27章", I18n.t("chapter", 27)
136
+
137
+ File.open(file, "w"){|f| f.write("locale: ja\nchapter: 第%pDW章")}
138
+ I18n.setup("ja")
139
+ assert_equal "第1章", I18n.t("chapter", 1)
140
+
141
+ File.open(file, "w"){|f| f.write("locale: ja\nchapter: 第%pDW章")}
142
+ I18n.setup("ja")
143
+ assert_equal "第27章", I18n.t("chapter", 27)
144
+
145
+ File.open(file, "w"){|f| f.write("locale: ja\npart: Part %pRW")}
146
+ I18n.setup("ja")
147
+ assert_equal "Part 0", I18n.t("part", 0)
148
+
149
+ File.open(file, "w"){|f| f.write("locale: ja\npart: 第%pJ部")}
150
+ I18n.setup("ja")
151
+ assert_equal "第一部", I18n.t("part", 1)
94
152
  end
95
153
  end
96
154
  end
@@ -136,13 +194,11 @@ class I18nTest < Test::Unit::TestCase
136
194
  def _setup_htmlbuilder
137
195
  I18n.setup "en"
138
196
  @builder = HTMLBuilder.new()
139
- @config = {
140
- "secnolevel" => 2, # for IDGXMLBuilder, HTMLBuilder
141
- "inencoding" => "UTF-8",
142
- "outencoding" => "UTF-8",
143
- "stylesheet" => nil, # for HTMLBuilder
197
+ @config = ReVIEW::Configure[
198
+ "secnolevel" => 2, # for IDGXMLBuilder, HTMLBuilder
199
+ "stylesheet" => nil, # for HTMLBuilder
144
200
  "ext" => ".re"
145
- }
201
+ ]
146
202
  @book = Book::Base.new(".")
147
203
  @book.config = @config
148
204
  @compiler = ReVIEW::Compiler.new(@builder)
@@ -166,6 +222,14 @@ class I18nTest < Test::Unit::TestCase
166
222
  assert_equal "bar", i18n.t("foo")
167
223
  end
168
224
 
225
+ def test_ja_appendix_alphabet
226
+ i18n = I18n.new("ja")
227
+ i18n.update({"appendix" => "付録%pA"}, "ja")
228
+ assert_equal "付録A", i18n.t("appendix", 1)
229
+ assert_equal "付録B", i18n.t("appendix", 2)
230
+ assert_equal "付録C", i18n.t("appendix", 3)
231
+ end
232
+
169
233
  def test_i18n_error
170
234
  I18n.setup
171
235
  assert_raises NotImplementedError do
@@ -14,9 +14,6 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
14
14
  @config = ReVIEW::Configure.values
15
15
  @config.merge!({
16
16
  "secnolevel" => 2,
17
- "inencoding" => "UTF-8",
18
- "outencoding" => "UTF-8",
19
- "nolf" => true,
20
17
  "tableopt" => "10"
21
18
  })
22
19
  @book = Book::Base.new(nil)
@@ -88,26 +85,48 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
88
85
 
89
86
  def test_inline_in_table
90
87
  actual = compile_block("//table{\n@<b>{1}\t@<i>{2}\n------------\n@<b>{3}\t@<i>{4}<>&\n//}\n")
91
- assert_equal %Q|<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>&lt;&gt;&amp;</td></tbody></table>|, actual
88
+ assert_equal %Q|<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.172"><b>1</b></td><td xyh="2,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172"><i>2</i></td><td xyh="1,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172"><b>3</b></td><td xyh="2,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172"><i>4</i>&lt;&gt;&amp;</td></tbody></table>|, actual
92
89
  end
93
90
 
94
91
  def test_inline_in_table_without_header
95
92
  actual = compile_block("//table{\n@<b>{1}\t@<i>{2}\n@<b>{3}\t@<i>{4}<>&\n//}\n")
96
- assert_equal %Q|<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>&lt;&gt;&amp;</td></tbody></table>|, actual
93
+ assert_equal %Q|<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.172"><b>1</b></td><td xyh="2,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172"><i>2</i></td><td xyh="1,2,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172"><b>3</b></td><td xyh="2,2,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172"><i>4</i>&lt;&gt;&amp;</td></tbody></table>|, actual
97
94
  end
98
95
 
99
96
  def test_inline_in_table_without_cellwidth
100
97
  @config["tableopt"] = nil
101
98
  actual = compile_block("//table{\n@<b>{1}\t@<i>{2}\n------------\n@<b>{3}\t@<i>{4}<>&\n//}\n")
102
99
  assert_equal %Q|<table><tbody><tr type="header"><b>1</b>\t<i>2</i></tr><tr type="lastline"><b>3</b>\t<i>4</i>&lt;&gt;&amp;</tr></tbody></table>|, actual
103
- @config["tableopt"] = 10
104
100
  end
105
101
 
106
102
  def test_inline_in_table_without_header_and_cellwidth
107
103
  @config["tableopt"] = nil
108
104
  actual = compile_block("//table{\n@<b>{1}\t@<i>{2}\n@<b>{3}\t@<i>{4}<>&\n//}\n")
109
105
  assert_equal %Q|<table><tbody><tr><b>1</b>\t<i>2</i></tr><tr type="lastline"><b>3</b>\t<i>4</i>&lt;&gt;&amp;</tr></tbody></table>|, actual
110
- @config["tableopt"] = 10
106
+ end
107
+
108
+ def test_customize_cellwidth
109
+ actual = compile_block("//tsize[2,3,5]\n//table{\nA\tB\tC\n//}\n")
110
+ assert_equal %Q|<table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="3"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="5.669">A</td><td xyh="2,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="8.503">B</td><td xyh="3,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">C</td></tbody></table>|, actual
111
+
112
+ actual = compile_block("//tsize[2,3]\n//table{\nA\tB\tC\n//}\n")
113
+ assert_equal %Q|<table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="3"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="5.669">A</td><td xyh="2,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="8.503">B</td><td xyh="3,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">C</td></tbody></table>|, actual
114
+
115
+ actual = compile_block("//tsize[2]\n//table{\nA\tB\tC\n//}\n")
116
+ assert_equal %Q|<table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="3"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="5.669">A</td><td xyh="2,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="11.338">B</td><td xyh="3,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="11.338">C</td></tbody></table>|, actual
117
+ end
118
+
119
+ def test_customize_mmtopt
120
+ actual = compile_block("//table{\nA\n//}\n")
121
+ assert_equal %Q|<table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="1"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="28.345">A</td></tbody></table>|, actual
122
+
123
+ @config["pt_to_mm_unit"] = 0.3514
124
+ actual = compile_block("//table{\nA\n//}\n")
125
+ assert_equal %Q|<table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="1"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="28.458">A</td></tbody></table>|, actual
126
+
127
+ @config["pt_to_mm_unit"] = "0.3514"
128
+ actual = compile_block("//table{\nA\n//}\n")
129
+ assert_equal %Q|<table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="1"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="28.458">A</td></tbody></table>|, actual
111
130
  end
112
131
 
113
132
  def test_inline_br
@@ -170,45 +189,44 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
170
189
  assert_equal %Q|<quote><p>foobar</p><p>buz</p></quote>|, actual
171
190
  end
172
191
 
173
- def test_quote_deprecated
174
- @book.config["deprecated-blocklines"] = true
175
- actual = compile_block("//quote{\nfoo\n\nbuz\n//}\n")
176
- @book.config["deprecated-blocklines"] = nil
177
- assert_equal %Q|<quote>foo\n\nbuz</quote>|, actual
178
- end
192
+ def test_major_blocks
193
+ actual = compile_block("//note{\nA\n\nB\n//}\n//note[caption]{\nA\n//}")
194
+ expected = %Q(<note><p>A</p><p>B</p></note><note><title aid:pstyle='note-title'>caption</title><p>A</p></note>)
195
+ assert_equal expected, actual
179
196
 
180
- ## XXX block content should be escaped.
181
- def test_note
182
- actual = compile_block("//note[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
183
- assert_equal %Q|<note><title aid:pstyle='note-title'>this is <b>test</b>&lt;&amp;&gt;_</title><p>test1test1.5</p><p>test<i>2</i></p></note>|, actual
184
- end
197
+ actual = compile_block("//memo{\nA\n\nB\n//}\n//memo[caption]{\nA\n//}")
198
+ expected = %Q(<memo><p>A</p><p>B</p></memo><memo><title aid:pstyle='memo-title'>caption</title><p>A</p></memo>)
199
+ assert_equal expected, actual
185
200
 
186
- ## XXX block content should be escaped.
187
- def test_memo
188
- actual = compile_block("//memo[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
189
- assert_equal %Q|<memo><title aid:pstyle='memo-title'>this is <b>test</b>&lt;&amp;&gt;_</title><p>test1test1.5</p><p>test<i>2</i></p></memo>|, actual
190
- end
201
+ actual = compile_block("//info{\nA\n\nB\n//}\n//info[caption]{\nA\n//}")
202
+ expected = %Q(<info><p>A</p><p>B</p></info><info><title aid:pstyle='info-title'>caption</title><p>A</p></info>)
203
+ assert_equal expected, actual
191
204
 
192
- def test_term
193
- actual = compile_block("//term{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
194
- assert_equal %Q|<term><p>test1test1.5</p><p>test<i>2</i></p></term>|, actual
195
- end
205
+ actual = compile_block("//important{\nA\n\nB\n//}\n//important[caption]{\nA\n//}")
206
+ expected = %Q(<important><p>A</p><p>B</p></important><important><title aid:pstyle='important-title'>caption</title><p>A</p></important>)
207
+ assert_equal expected, actual
196
208
 
197
- def test_term_deprecated
198
- @book.config["deprecated-blocklines"] = true
199
- actual = compile_block("//term{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
200
- @book.config["deprecated-blocklines"] = nil
201
- assert_equal %Q|<term>test1test1.5\n\ntest<i>2</i></term>|, actual
202
- end
209
+ actual = compile_block("//caution{\nA\n\nB\n//}\n//caution[caption]{\nA\n//}")
210
+ expected = %Q(<caution><p>A</p><p>B</p></caution><caution><title aid:pstyle='caution-title'>caption</title><p>A</p></caution>)
211
+ assert_equal expected, actual
212
+
213
+ # notice uses special tag notice-t if it includes caption
214
+ actual = compile_block("//notice{\nA\n\nB\n//}\n//notice[caption]{\nA\n//}")
215
+ expected = %Q(<notice><p>A</p><p>B</p></notice><notice-t><title aid:pstyle='notice-title'>caption</title><p>A</p></notice-t>)
216
+ assert_equal expected, actual
203
217
 
204
- def test_notice
205
- actual = compile_block("//notice[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
206
- assert_equal %Q|<notice-t><title aid:pstyle='notice-title'>this is <b>test</b>&lt;&amp;&gt;_</title><p>test1test1.5</p><p>test<i>2</i></p></notice-t>|, actual
218
+ actual = compile_block("//warning{\nA\n\nB\n//}\n//warning[caption]{\nA\n//}")
219
+ expected = %Q(<warning><p>A</p><p>B</p></warning><warning><title aid:pstyle='warning-title'>caption</title><p>A</p></warning>)
220
+ assert_equal expected, actual
221
+
222
+ actual = compile_block("//tip{\nA\n\nB\n//}\n//tip[caption]{\nA\n//}")
223
+ expected = %Q(<tip><p>A</p><p>B</p></tip><tip><title aid:pstyle='tip-title'>caption</title><p>A</p></tip>)
224
+ assert_equal expected, actual
207
225
  end
208
226
 
209
- def test_notice_without_caption
210
- actual = compile_block("//notice{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
211
- assert_equal %Q|<notice><p>test1test1.5</p><p>test<i>2</i></p></notice>|, actual
227
+ def test_term
228
+ actual = compile_block("//term{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
229
+ assert_equal %Q|<term><p>test1test1.5</p><p>test<i>2</i></p></term>|, actual
212
230
  end
213
231
 
214
232
  def test_point
@@ -607,4 +625,5 @@ EOS
607
625
  expected = %Q(|idgxml <>!\"\n& )
608
626
  assert_equal expected.chomp, actual
609
627
  end
628
+
610
629
  end
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require 'test_helper'
3
- require 'review/book'
4
3
  require 'review/compiler'
4
+ require 'review/book'
5
5
  require 'review/latexbuilder'
6
6
  require 'review/i18n'
7
7
 
@@ -12,11 +12,11 @@ class LATEXBuidlerTest < Test::Unit::TestCase
12
12
  @builder = LATEXBuilder.new()
13
13
  @config = ReVIEW::Configure.values
14
14
  @config.merge!( {
15
- "secnolevel" => 2, # for IDGXMLBuilder, EPUBBuilder
15
+ "secnolevel" => 2, # for IDGXMLBuilder, EPUBBuilder
16
16
  "toclevel" => 2,
17
- "inencoding" => "UTF-8",
18
- "outencoding" => "UTF-8",
19
- "stylesheet" => nil, # for EPUBBuilder
17
+ "stylesheet" => nil, # for EPUBBuilder
18
+ "image_scale2width" => false,
19
+ "texcommand" => "uplatex"
20
20
  })
21
21
  @book = Book::Base.new(nil)
22
22
  @book.config = @config
@@ -156,7 +156,7 @@ class LATEXBuidlerTest < Test::Unit::TestCase
156
156
 
157
157
  def test_inline_u
158
158
  actual = compile_inline("abc@<u>{def}ghi")
159
- assert_equal %Q|abc\\Underline{def}ghi|, actual
159
+ assert_equal %Q|abc\\reviewunderline{def}ghi|, actual
160
160
  end
161
161
 
162
162
  def test_inline_m
@@ -211,8 +211,10 @@ class LATEXBuidlerTest < Test::Unit::TestCase
211
211
  end
212
212
 
213
213
  def test_jis_x_0201_kana
214
+ # uplatex can handle half-width kana natively
214
215
  actual = compile_inline("foo・カンジ、テスト")
215
- assert_equal %Q|foo\\aj半角{・}\\aj半角{カ}\\aj半角{ン}\\aj半角{シ}\\aj半角{゛}\\aj半角{、}テスト|, actual
216
+ assert_equal %Q|foo・カンジ、テスト|, actual
217
+ # assert_equal %Q|foo\\aj半角{・}\\aj半角{カ}\\aj半角{ン}\\aj半角{シ}\\aj半角{゛}\\aj半角{、}テスト|, actual
216
218
  end
217
219
 
218
220
  def test_dlist
@@ -279,9 +281,34 @@ class LATEXBuidlerTest < Test::Unit::TestCase
279
281
  assert_equal %Q|\n\\begin{reviewemlist}\n foo\n bar\n\n buz\n\\end{reviewemlist}\n|, actual
280
282
  end
281
283
 
284
+ def test_emlistnum_caption
285
+ actual = compile_block("//emlistnum[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
286
+ assert_equal %Q|\n\\reviewemlistcaption{cap1}\n\\begin{reviewemlist}\n 1: foo\n 2: bar\n 3: \n 4: buz\n\\end{reviewemlist}\n|, actual
287
+ end
288
+
289
+ def test_list
290
+ actual = compile_block("//list[id1][cap1]{\nfoo\nbar\n\nbuz\n//}\n")
291
+ assert_equal %Q|\\reviewlistcaption{リスト1.1: cap1}\n\\begin{reviewlist}\nfoo\nbar\n\nbuz\n\\end{reviewlist}\n|, actual
292
+ end
293
+
294
+ def test_list_lst
295
+ @book.config["highlight"] = {}
296
+ @book.config["highlight"]["latex"] = "listings"
297
+ actual = compile_block("//list[id1][cap1][sql]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
298
+ assert_equal %Q|\\begin{reviewlistlst}[caption={cap1},language={sql}]\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n\\end{reviewlistlst}\n|, actual
299
+ end
300
+
301
+ def test_list_lst_with_lang
302
+ @book.config["highlight"] = {}
303
+ @book.config["highlight"]["latex"] = "listings"
304
+ @book.config["highlight"]["lang"] = "sql"
305
+ actual = compile_block("//list[id1][cap1]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
306
+ assert_equal %Q|\\begin{reviewlistlst}[caption={cap1},language={sql}]\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n\\end{reviewlistlst}\n|, actual
307
+ end
308
+
282
309
  def test_listnum
283
310
  actual = compile_block("//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
284
- assert_equal %Q|\\reviewlistcaption{リスト1.1: ruby}\n\\reviewlistcaption{ruby}\n\\begin{reviewlist}\n 1: class Foo\n 2: def foo\n 3: bar\n 4: \n 5: buz\n 6: end\n 7: end\n\\end{reviewlist}\n|, actual
311
+ assert_equal %Q|\\reviewlistcaption{リスト1.1: ruby}\n\\begin{reviewlist}\n 1: class Foo\n 2: def foo\n 3: bar\n 4: \n 5: buz\n 6: end\n 7: end\n\\end{reviewlist}\n|, actual
285
312
  end
286
313
 
287
314
  def test_listnum_lst
@@ -313,7 +340,7 @@ class LATEXBuidlerTest < Test::Unit::TestCase
313
340
 
314
341
  def test_noindent
315
342
  actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
316
- assert_equal %Q|\\noindent\nfoobar\n\nfoo2bar2\n|, actual
343
+ assert_equal %Q|\\noindent\nfoo\nbar\n\nfoo2\nbar2\n|, actual
317
344
  end
318
345
 
319
346
  def test_image
@@ -338,6 +365,18 @@ class LATEXBuidlerTest < Test::Unit::TestCase
338
365
  assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n|, actual
339
366
  end
340
367
 
368
+ def test_image_with_metric_width
369
+ def @chapter.image(id)
370
+ item = Book::ImageIndex::Item.new("sampleimg",1)
371
+ item.instance_eval{@path="./images/chap1-sampleimg.png"}
372
+ item
373
+ end
374
+
375
+ @config["image_scale2width"] = true
376
+ actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\n//}\n")
377
+ assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[width=1.2\\maxwidth]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n|, actual
378
+ end
379
+
341
380
  def test_image_with_metric2
342
381
  def @chapter.image(id)
343
382
  item = Book::ImageIndex::Item.new("sampleimg",1)
@@ -349,25 +388,26 @@ class LATEXBuidlerTest < Test::Unit::TestCase
349
388
  assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[scale=1.2,ignore=params]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n|, actual
350
389
  end
351
390
 
352
- def test_indepimage
391
+ def test_image_with_metric2_width
353
392
  def @chapter.image(id)
354
393
  item = Book::ImageIndex::Item.new("sampleimg",1)
355
394
  item.instance_eval{@path="./images/chap1-sampleimg.png"}
356
395
  item
357
396
  end
358
397
 
359
- actual = compile_block("//indepimage[sampleimg][sample photo]\n")
360
- assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n|, actual
398
+ @config["image_scale2width"] = true
399
+ actual = compile_block("//image[sampleimg][sample photo][scale=1.2,html::class=sample,latex::ignore=params]{\n//}\n")
400
+ assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[width=1.2\\maxwidth,ignore=params]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n|, actual
361
401
  end
362
402
 
363
- def test_indepimage_esc
403
+ def test_indepimage
364
404
  def @chapter.image(id)
365
405
  item = Book::ImageIndex::Item.new("sampleimg",1)
366
406
  item.instance_eval{@path="./images/chap1-sampleimg.png"}
367
407
  item
368
408
  end
369
409
 
370
- actual = compile_block("//indepimage[sean_2_10][sample photo][]\n")
410
+ actual = compile_block("//indepimage[sampleimg][sample photo]\n")
371
411
  assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n|, actual
372
412
  end
373
413
 
@@ -394,6 +434,18 @@ class LATEXBuidlerTest < Test::Unit::TestCase
394
434
  assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n|, actual
395
435
  end
396
436
 
437
+ def test_indepimage_with_metric_width
438
+ def @chapter.image(id)
439
+ item = Book::ImageIndex::Item.new("sampleimg",1)
440
+ item.instance_eval{@path="./images/chap1-sampleimg.png"}
441
+ item
442
+ end
443
+
444
+ @config["image_scale2width"] = true
445
+ actual = compile_block("//indepimage[sampleimg][sample photo][scale=1.2]\n")
446
+ assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[width=1.2\\maxwidth]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n|, actual
447
+ end
448
+
397
449
  def test_indepimage_with_metric2
398
450
  def @chapter.image(id)
399
451
  item = Book::ImageIndex::Item.new("sampleimg",1)
@@ -417,6 +469,31 @@ class LATEXBuidlerTest < Test::Unit::TestCase
417
469
  assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}\n\\end{reviewimage}\n|, actual
418
470
  end
419
471
 
472
+ def test_table
473
+ actual = compile_block("//table{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
474
+ assert_equal "\\begin{reviewtable}{|l|l|}\n\\hline\n\\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline\nccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline\n\\end{reviewtable}\n",
475
+ actual
476
+ end
477
+
478
+ def test_imgtable
479
+ def @chapter.image(id)
480
+ item = Book::ImageIndex::Item.new("sampleimg",1, 'sample img')
481
+ item.instance_eval{@path="./images/chap1-sampleimg.png"}
482
+ item
483
+ end
484
+
485
+ actual = compile_block("//imgtable[sampleimg][test for imgtable]{\n//}\n")
486
+
487
+ assert_equal "\\begin{table}[h]\n"+
488
+ "\\reviewimgtablecaption{test for imgtable}\n"+
489
+ "\\label{table:chap1:sampleimg}\n"+
490
+ "\\begin{reviewimage}\n"+
491
+ "\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n"+
492
+ "\\end{reviewimage}\n"+
493
+ "\\end{table}\n",
494
+ actual
495
+ end
496
+
420
497
  def test_bib
421
498
  def @chapter.bibpaper(id)
422
499
  Book::BibpaperIndex::Item.new("samplebib",1,"sample bib")
@@ -467,6 +544,7 @@ EOS
467
544
  \\addcontentsline{toc}{subsection}{prev column}
468
545
 
469
546
  inside prev column
547
+
470
548
  \\end{reviewcolumn}
471
549
 
472
550
  \\begin{reviewcolumn}
@@ -475,6 +553,7 @@ inside prev column
475
553
  \\addcontentsline{toc}{subsection}{test}
476
554
 
477
555
  inside column
556
+
478
557
  \\end{reviewcolumn}
479
558
  EOS
480
559
  @config["toclevel"] = 3
@@ -496,7 +575,9 @@ EOS
496
575
  \\reviewcolumnhead{}{test}
497
576
 
498
577
  inside column
578
+
499
579
  \\end{reviewcolumn}
580
+
500
581
  \\subsection*{next level}
501
582
  \\label{sec:1-0-1}
502
583
  EOS
@@ -582,6 +663,7 @@ EOS
582
663
  \\begin{itemize}
583
664
  \\item AA
584
665
  \\end{itemize}
666
+
585
667
  \\end{itemize}
586
668
  EOS
587
669
  actual = compile_block(src)
@@ -604,11 +686,13 @@ EOS
604
686
  \\begin{itemize}
605
687
  \\item AA
606
688
  \\end{itemize}
689
+
607
690
  \\item BBB
608
691
 
609
692
  \\begin{itemize}
610
693
  \\item BB
611
694
  \\end{itemize}
695
+
612
696
  \\end{itemize}
613
697
  EOS
614
698
  actual = compile_block(src)
@@ -648,6 +732,40 @@ EOS
648
732
  assert_equal expected, actual
649
733
  end
650
734
 
735
+ def test_major_blocks
736
+ actual = compile_block("//note{\nA\n\nB\n//}\n//note[caption]{\nA\n//}")
737
+ expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
738
+ assert_equal expected, actual
739
+
740
+ actual = compile_block("//memo{\nA\n\nB\n//}\n//memo[caption]{\nA\n//}")
741
+ expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
742
+ assert_equal expected, actual
743
+
744
+ actual = compile_block("//info{\nA\n\nB\n//}\n//info[caption]{\nA\n//}")
745
+ expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
746
+ assert_equal expected, actual
747
+
748
+ actual = compile_block("//important{\nA\n\nB\n//}\n//important[caption]{\nA\n//}")
749
+ expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
750
+ assert_equal expected, actual
751
+
752
+ actual = compile_block("//caution{\nA\n\nB\n//}\n//caution[caption]{\nA\n//}")
753
+ expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
754
+ assert_equal expected, actual
755
+
756
+ actual = compile_block("//notice{\nA\n\nB\n//}\n//notice[caption]{\nA\n//}")
757
+ expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
758
+ assert_equal expected, actual
759
+
760
+ actual = compile_block("//warning{\nA\n\nB\n//}\n//warning[caption]{\nA\n//}")
761
+ expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
762
+ assert_equal expected, actual
763
+
764
+ actual = compile_block("//tip{\nA\n\nB\n//}\n//tip[caption]{\nA\n//}")
765
+ expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
766
+ assert_equal expected, actual
767
+ end
768
+
651
769
  def test_inline_raw0
652
770
  assert_equal "normal", compile_inline("@<raw>{normal}")
653
771
  end