review 4.0.0 → 5.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (268) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-tex.yml +31 -0
  3. data/.github/workflows/ruby-win.yml +45 -0
  4. data/.github/workflows/ruby.yml +27 -0
  5. data/.rubocop.yml +141 -38
  6. data/Dockerfile +21 -5
  7. data/NEWS.ja.md +338 -1
  8. data/NEWS.md +339 -2
  9. data/README.md +11 -7
  10. data/Rakefile +7 -2
  11. data/appveyor.yml +0 -20
  12. data/bin/review +2 -4
  13. data/bin/review-catalog-converter +4 -4
  14. data/bin/review-check +8 -12
  15. data/bin/review-checkdep +2 -5
  16. data/bin/review-compile +11 -20
  17. data/bin/review-epub2html +1 -4
  18. data/bin/review-epubmaker +3 -4
  19. data/bin/review-idgxmlmaker +1 -3
  20. data/bin/review-index +5 -86
  21. data/bin/review-init +1 -4
  22. data/bin/review-pdfmaker +1 -3
  23. data/bin/review-preproc +3 -5
  24. data/bin/review-textmaker +1 -3
  25. data/bin/review-update +1 -4
  26. data/bin/review-validate +5 -5
  27. data/bin/review-vol +5 -82
  28. data/bin/review-webmaker +1 -3
  29. data/doc/config.yml.sample +55 -12
  30. data/doc/config.yml.sample-simple +4 -3
  31. data/doc/format.ja.md +119 -17
  32. data/doc/format.md +106 -17
  33. data/doc/makeindex.ja.md +2 -2
  34. data/doc/pdfmaker.ja.md +42 -0
  35. data/doc/pdfmaker.md +41 -0
  36. data/doc/quickstart.ja.md +55 -25
  37. data/doc/quickstart.md +47 -17
  38. data/lib/review.rb +1 -1
  39. data/lib/review/book.rb +2 -2
  40. data/lib/review/book/base.rb +69 -30
  41. data/lib/review/book/bib.rb +21 -0
  42. data/lib/review/book/book_unit.rb +158 -0
  43. data/lib/review/book/chapter.rb +33 -26
  44. data/lib/review/book/index.rb +39 -206
  45. data/lib/review/book/index/item.rb +8 -2
  46. data/lib/review/book/page_metric.rb +7 -7
  47. data/lib/review/book/part.rb +26 -11
  48. data/lib/review/book/volume.rb +5 -5
  49. data/lib/review/builder.rb +124 -27
  50. data/lib/review/call_hook.rb +20 -0
  51. data/lib/review/catalog.rb +3 -2
  52. data/lib/review/compiler.rb +197 -91
  53. data/lib/review/configure.rb +95 -9
  54. data/lib/review/converter.rb +1 -1
  55. data/lib/review/epub2html.rb +6 -1
  56. data/lib/review/epubmaker.rb +116 -117
  57. data/lib/review/epubmaker/content.rb +113 -0
  58. data/lib/review/epubmaker/epubcommon.rb +372 -0
  59. data/lib/review/epubmaker/epubv2.rb +178 -0
  60. data/lib/review/epubmaker/epubv3.rb +231 -0
  61. data/lib/review/epubmaker/producer.rb +168 -0
  62. data/lib/review/epubmaker/reviewheaderlistener.rb +12 -2
  63. data/lib/review/epubmaker/zip_exporter.rb +84 -0
  64. data/lib/review/exception.rb +6 -0
  65. data/lib/review/extentions/string.rb +0 -4
  66. data/lib/review/htmlbuilder.rb +132 -87
  67. data/lib/review/htmlutils.rb +8 -11
  68. data/lib/review/i18n.rb +2 -1
  69. data/lib/review/idgxmlbuilder.rb +156 -76
  70. data/lib/review/idgxmlmaker.rb +22 -18
  71. data/lib/review/img_math.rb +245 -0
  72. data/lib/review/index_builder.rb +654 -0
  73. data/lib/review/init.rb +17 -18
  74. data/lib/review/latexbox.rb +58 -0
  75. data/lib/review/latexbuilder.rb +173 -43
  76. data/lib/review/latexutils.rb +9 -1
  77. data/lib/review/lineinput.rb +112 -2
  78. data/lib/review/logger.rb +42 -3
  79. data/lib/review/makerhelper.rb +12 -187
  80. data/lib/review/markdownbuilder.rb +51 -2
  81. data/lib/review/pdfmaker.rb +78 -73
  82. data/lib/review/plaintextbuilder.rb +98 -14
  83. data/lib/review/preprocessor.rb +18 -12
  84. data/lib/review/rstbuilder.rb +28 -9
  85. data/lib/review/sec_counter.rb +14 -0
  86. data/lib/review/template.rb +6 -0
  87. data/lib/review/textmaker.rb +21 -19
  88. data/lib/review/textutils.rb +3 -12
  89. data/lib/review/tocprinter.rb +242 -97
  90. data/lib/review/topbuilder.rb +91 -24
  91. data/lib/review/update.rb +12 -13
  92. data/lib/review/version.rb +1 -1
  93. data/lib/review/volumeprinter.rb +97 -0
  94. data/lib/review/webmaker.rb +34 -33
  95. data/lib/review/webtocprinter.rb +39 -35
  96. data/lib/review/yamlloader.rb +2 -1
  97. data/review.gemspec +5 -3
  98. data/samples/sample-book/src/.gitignore +1 -0
  99. data/samples/sample-book/src/config-ebook.yml +4 -0
  100. data/samples/sample-book/src/config-epub2.yml +1 -1
  101. data/samples/sample-book/src/config-jlreq-ebook.yml +4 -0
  102. data/samples/sample-book/src/config.yml +3 -3
  103. data/samples/sample-book/src/lib/tasks/review.rake +26 -6
  104. data/samples/syntax-book/Gemfile +1 -1
  105. data/samples/syntax-book/ch01.re +3 -1
  106. data/samples/syntax-book/ch02.re +28 -21
  107. data/samples/syntax-book/ch03.re +1 -1
  108. data/samples/syntax-book/config-jlreq-lualatex.yml +4 -0
  109. data/samples/syntax-book/config-print.yml +3 -0
  110. data/samples/syntax-book/config.yml +1 -1
  111. data/samples/syntax-book/images/img3-2.png +0 -0
  112. data/samples/syntax-book/lib/tasks/review.rake +23 -8
  113. data/templates/html/_colophon.html.erb +23 -0
  114. data/templates/html/_colophon_history.html.erb +9 -0
  115. data/templates/html/_cover.html.erb +10 -0
  116. data/templates/html/_part_body.html.erb +6 -0
  117. data/templates/html/_titlepage.html.erb +20 -0
  118. data/templates/html/layout-html5.html.erb +6 -0
  119. data/templates/html/layout-xhtml1.html.erb +6 -0
  120. data/templates/latex/config.erb +41 -29
  121. data/templates/latex/review-jlreq/README.md +3 -1
  122. data/templates/latex/review-jlreq/review-base.sty +47 -22
  123. data/templates/latex/review-jlreq/review-jlreq.cls +25 -24
  124. data/templates/latex/review-jlreq/review-style.sty +6 -1
  125. data/templates/latex/review-jlreq/review-tcbox.sty +348 -0
  126. data/templates/latex/review-jlreq/reviewmacro.sty +5 -0
  127. data/templates/latex/review-jsbook/README.md +7 -5
  128. data/templates/latex/review-jsbook/review-base.sty +47 -21
  129. data/templates/latex/review-jsbook/review-jsbook.cls +12 -2
  130. data/templates/latex/review-jsbook/review-style.sty +6 -1
  131. data/templates/latex/review-jsbook/review-tcbox.sty +348 -0
  132. data/templates/latex/review-jsbook/reviewmacro.sty +5 -0
  133. data/templates/opf/epubv2.opf.erb +7 -7
  134. data/templates/opf/epubv3.opf.erb +7 -7
  135. data/templates/opf/opf_manifest_epubv2.opf.erb +10 -0
  136. data/templates/opf/opf_manifest_epubv3.opf.erb +10 -0
  137. data/templates/opf/opf_metainfo_epubv2.opf.erb +17 -0
  138. data/templates/opf/opf_metainfo_epubv3.opf.erb +49 -0
  139. data/templates/opf/opf_tocx_epubv2.opf.erb +9 -0
  140. data/templates/opf/opf_tocx_epubv3.opf.erb +17 -0
  141. data/templates/web/html/layout-html5.html.erb +9 -8
  142. data/templates/web/html/layout-xhtml1.html.erb +6 -0
  143. data/test/assets/header_listener.html +35 -0
  144. data/test/assets/img_math/img1.png +0 -0
  145. data/test/assets/img_math/img2.png +0 -0
  146. data/test/assets/img_math/img3.png +0 -0
  147. data/test/assets/syntax_book_index_detail.txt +58 -0
  148. data/test/assets/test_template.tex +12 -9
  149. data/test/assets/test_template_backmatter.tex +12 -9
  150. data/test/book_test_helper.rb +11 -5
  151. data/test/run_test.rb +1 -1
  152. data/test/test_book.rb +62 -63
  153. data/test/test_book_chapter.rb +99 -56
  154. data/test/test_book_part.rb +3 -3
  155. data/test/test_builder.rb +24 -15
  156. data/test/test_catalog.rb +1 -0
  157. data/test/test_catalog_converter_cmd.rb +1 -1
  158. data/test/test_converter.rb +1 -0
  159. data/test/test_epub3maker.rb +170 -126
  160. data/test/test_epubmaker.rb +249 -129
  161. data/test/test_epubmaker_cmd.rb +14 -7
  162. data/test/test_helper.rb +23 -11
  163. data/test/test_htmlbuilder.rb +956 -76
  164. data/test/test_htmlutils.rb +0 -12
  165. data/test/test_i18n.rb +33 -33
  166. data/test/test_idgxmlbuilder.rb +568 -10
  167. data/test/test_idgxmlmaker_cmd.rb +50 -0
  168. data/test/test_image_finder.rb +52 -70
  169. data/test/test_img_math.rb +111 -0
  170. data/test/test_index.rb +62 -52
  171. data/test/test_indexbuilder.rb +52 -0
  172. data/test/test_latexbuilder.rb +1056 -30
  173. data/test/test_latexbuilder_v2.rb +52 -12
  174. data/test/test_lineinput.rb +20 -93
  175. data/test/test_logger.rb +7 -7
  176. data/test/test_makerhelper.rb +0 -12
  177. data/test/test_markdownbuilder.rb +32 -0
  178. data/test/test_pdfmaker.rb +100 -11
  179. data/test/test_pdfmaker_cmd.rb +101 -7
  180. data/test/test_plaintextbuilder.rb +531 -25
  181. data/test/test_review_ext.rb +2 -1
  182. data/test/test_reviewheaderlistener.rb +49 -0
  183. data/test/test_rstbuilder.rb +25 -1
  184. data/test/test_sec_counter.rb +156 -0
  185. data/test/test_template.rb +12 -2
  186. data/test/test_textmaker_cmd.rb +58 -0
  187. data/test/test_tocprinter.rb +46 -0
  188. data/test/test_topbuilder.rb +365 -10
  189. data/test/test_update.rb +44 -44
  190. data/test/test_webtocprinter.rb +75 -43
  191. data/test/test_zip_exporter.rb +5 -6
  192. data/vendor/gentombow/LICENSE +1 -1
  193. data/vendor/gentombow/Makefile +0 -1
  194. data/vendor/gentombow/bounddvi-en.pdf +0 -0
  195. data/vendor/gentombow/bounddvi-en.tex +1 -0
  196. data/vendor/gentombow/bounddvi.pdf +0 -0
  197. data/vendor/gentombow/bounddvi.sty +30 -7
  198. data/vendor/gentombow/bounddvi.tex +1 -0
  199. data/vendor/gentombow/create_archive.sh +1 -0
  200. data/vendor/gentombow/gentombow-ja.pdf +0 -0
  201. data/vendor/gentombow/gentombow-ja.tex +9 -0
  202. data/vendor/gentombow/gentombow.pdf +0 -0
  203. data/vendor/gentombow/gentombow.sty +32 -10
  204. data/vendor/gentombow/gentombow.tex +8 -0
  205. data/vendor/gentombow/tests/gentombow-01-pdfx.tex +8 -0
  206. data/vendor/gentombow/tests/gentombow-02-pdfx.tex +8 -0
  207. data/vendor/jsclasses/LICENSE +1 -1
  208. data/vendor/jsclasses/Makefile +3 -2
  209. data/vendor/jsclasses/create_archive.sh +5 -5
  210. data/vendor/jsclasses/jis/Makefile +3 -2
  211. data/vendor/jsclasses/jis/jsarticle.cls +74 -31
  212. data/vendor/jsclasses/jis/jsbook.cls +74 -31
  213. data/vendor/jsclasses/jis/jsclasses.dtx +176 -36
  214. data/vendor/jsclasses/jis/jsclasses.ins +15 -5
  215. data/vendor/jsclasses/jis/jslogo.dtx +4 -4
  216. data/vendor/jsclasses/jis/jslogo.ins +9 -0
  217. data/vendor/jsclasses/jis/jslogo.sty +4 -16
  218. data/vendor/jsclasses/jis/jspf.cls +73 -30
  219. data/vendor/jsclasses/jis/jsreport.cls +74 -31
  220. data/vendor/jsclasses/jis/jsverb.ins +9 -0
  221. data/vendor/jsclasses/jis/jsverb.sty +1 -13
  222. data/vendor/jsclasses/jis/kiyou.cls +74 -31
  223. data/vendor/jsclasses/jis/minijs.sty +65 -22
  224. data/vendor/jsclasses/jis/okumacro.dtx +4 -5
  225. data/vendor/jsclasses/jis/okumacro.ins +9 -0
  226. data/vendor/jsclasses/jis/okumacro.sty +4 -17
  227. data/vendor/jsclasses/jis/okuverb.ins +9 -0
  228. data/vendor/jsclasses/jis/okuverb.sty +1 -13
  229. data/vendor/jsclasses/jis/winjis.sty +23 -19
  230. data/vendor/jsclasses/jsarticle.cls +74 -31
  231. data/vendor/jsclasses/jsbook.cls +74 -31
  232. data/vendor/jsclasses/jsclasses.dtx +176 -36
  233. data/vendor/jsclasses/jsclasses.ins +15 -5
  234. data/vendor/jsclasses/jsclasses.pdf +0 -0
  235. data/vendor/jsclasses/jslogo.dtx +4 -4
  236. data/vendor/jsclasses/jslogo.ins +9 -0
  237. data/vendor/jsclasses/jslogo.pdf +0 -0
  238. data/vendor/jsclasses/jslogo.sty +4 -16
  239. data/vendor/jsclasses/jspf.cls +73 -30
  240. data/vendor/jsclasses/jsreport.cls +74 -31
  241. data/vendor/jsclasses/jsverb.ins +9 -0
  242. data/vendor/jsclasses/jsverb.pdf +0 -0
  243. data/vendor/jsclasses/jsverb.sty +1 -13
  244. data/vendor/jsclasses/kiyou.cls +74 -31
  245. data/vendor/jsclasses/minijs.sty +68 -22
  246. data/vendor/jsclasses/okumacro.dtx +4 -5
  247. data/vendor/jsclasses/okumacro.ins +9 -0
  248. data/vendor/jsclasses/okumacro.pdf +0 -0
  249. data/vendor/jsclasses/okumacro.sty +4 -17
  250. data/vendor/jsclasses/okuverb.ins +9 -0
  251. data/vendor/jsclasses/okuverb.pdf +0 -0
  252. data/vendor/jsclasses/okuverb.sty +1 -13
  253. data/vendor/jsclasses/tests/relfont.tex +10 -0
  254. data/vendor/jsclasses/winjis.sty +23 -19
  255. metadata +109 -20
  256. data/.rubocop_todo.yml +0 -7
  257. data/lib/epubmaker.rb +0 -23
  258. data/lib/epubmaker/content.rb +0 -110
  259. data/lib/epubmaker/epubcommon.rb +0 -441
  260. data/lib/epubmaker/epubv2.rb +0 -143
  261. data/lib/epubmaker/epubv3.rb +0 -233
  262. data/lib/epubmaker/producer.rb +0 -375
  263. data/lib/epubmaker/zip_exporter.rb +0 -81
  264. data/lib/lineinput.rb +0 -155
  265. data/lib/review/book/compilable.rb +0 -178
  266. data/lib/review/tocparser.rb +0 -271
  267. data/samples/syntax-book/review-ext.rb +0 -14
  268. data/test/test_tocparser.rb +0 -25
@@ -17,18 +17,6 @@ class HTMLUtilsTest < Test::Unit::TestCase
17
17
  assert_equal '&amp;', unescape('&amp;amp;')
18
18
  end
19
19
 
20
- def test_escape_html_ex
21
- keys = ESC.keys
22
- ESC['.'] = 'X'
23
- ESC.each_pair do |ch, ref|
24
- if keys.include?(ch)
25
- assert_equal ref, escape(ch)
26
- else
27
- assert_equal ch, escape(ch)
28
- end
29
- end
30
- end
31
-
32
20
  def test_strip_html
33
21
  assert_equal 'thisistest.', strip_html('<h3>this<b>is</b>test</h3>.')
34
22
  end
data/test/test_i18n.rb CHANGED
@@ -9,7 +9,7 @@ class I18nTest < Test::Unit::TestCase
9
9
  Dir.mktmpdir do |dir|
10
10
  Dir.chdir(dir) do
11
11
  file = File.join(dir, 'locale.yml')
12
- File.open(file, 'w') { |f| f.write %Q(locale: ja\nfoo: "bar"\n) }
12
+ File.write(file, %Q(locale: ja\nfoo: "bar"\n))
13
13
  I18n.setup
14
14
  assert_equal 'bar', I18n.t('foo')
15
15
  end
@@ -20,7 +20,7 @@ class I18nTest < Test::Unit::TestCase
20
20
  Dir.mktmpdir do |dir|
21
21
  Dir.chdir(dir) do
22
22
  file = File.join(dir, 'locale.yaml')
23
- File.open(file, 'w') { |f| f.write %Q(locale: ja\nfoo: "bar"\n) }
23
+ File.write(file, %Q(locale: ja\nfoo: "bar"\n))
24
24
  assert_raise ReVIEW::ConfigError do
25
25
  I18n.setup
26
26
  end
@@ -32,7 +32,7 @@ class I18nTest < Test::Unit::TestCase
32
32
  Dir.mktmpdir do |dir|
33
33
  Dir.chdir(dir) do
34
34
  file = File.join(dir, 'foo.yml')
35
- File.open(file, 'w') { |f| f.write %Q(locale: ja\nfoo: "bar"\n) }
35
+ File.write(file, %Q(locale: ja\nfoo: "bar"\n))
36
36
  I18n.setup('ja', 'foo.yml')
37
37
  assert_equal 'bar', I18n.t('foo')
38
38
  end
@@ -43,7 +43,7 @@ class I18nTest < Test::Unit::TestCase
43
43
  Dir.mktmpdir do |dir|
44
44
  Dir.chdir(dir) do
45
45
  file = File.join(dir, 'foo.yml')
46
- File.open(file, 'w') { |f| f.write %Q(locale: ja\nfoo: "bar"\n) }
46
+ File.write(file, %Q(locale: ja\nfoo: "bar"\n))
47
47
  i18n = ReVIEW::I18n.new('ja')
48
48
  i18n.update_localefile(File.join(Dir.pwd, 'foo.yml'))
49
49
  assert_equal 'bar', i18n.t('foo')
@@ -55,7 +55,7 @@ class I18nTest < Test::Unit::TestCase
55
55
  Dir.mktmpdir do |dir|
56
56
  Dir.chdir(dir) do
57
57
  file = File.join(dir, 'foo.yml')
58
- File.open(file, 'w') { |f| f.write %Q(locale: ja\nfoo: "bar"\n) }
58
+ File.write(file, %Q(locale: ja\nfoo: "bar"\n))
59
59
  I18n.setup('ja', 'foo.yml')
60
60
  assert_equal 'bar', I18n.t('foo')
61
61
  end
@@ -66,7 +66,7 @@ class I18nTest < Test::Unit::TestCase
66
66
  Dir.mktmpdir do |dir|
67
67
  Dir.chdir(dir) do
68
68
  file = File.join(dir, 'locale.yml')
69
- File.open(file, 'w') { |f| f.write %Q(ja:\n foo: "bar"\nen:\n foo: "buz"\n) }
69
+ File.write(file, %Q(ja:\n foo: "bar"\nen:\n foo: "buz"\n))
70
70
  I18n.setup
71
71
  assert_equal 'bar', I18n.t('foo')
72
72
  assert_equal '図', I18n.t('image')
@@ -81,7 +81,7 @@ class I18nTest < Test::Unit::TestCase
81
81
  Dir.mktmpdir do |dir|
82
82
  Dir.chdir(dir) do
83
83
  file = File.join(dir, 'locale.yml')
84
- File.open(file, 'w') { |f| f.write %Q(local: ja\nfoo: "bar"\n) }
84
+ File.write(file, %Q(local: ja\nfoo: "bar"\n))
85
85
  assert_raises(ReVIEW::KeyError) do
86
86
  I18n.setup
87
87
  end
@@ -93,59 +93,59 @@ class I18nTest < Test::Unit::TestCase
93
93
  Dir.mktmpdir do |dir|
94
94
  Dir.chdir(dir) do
95
95
  file = File.join(dir, 'locale.yml')
96
- File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pa章" }
96
+ File.write(file, "locale: ja\nchapter: 第%pa章")
97
97
  I18n.setup('ja')
98
98
  assert_equal '第a章', I18n.t('chapter', 1)
99
99
 
100
- File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pA章" }
100
+ File.write(file, "locale: ja\nchapter: 第%pA章")
101
101
  I18n.setup('ja')
102
102
  assert_equal '第B章', I18n.t('chapter', 2)
103
103
 
104
- File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pAW章" }
104
+ File.write(file, "locale: ja\nchapter: 第%pAW章")
105
105
  I18n.setup('ja')
106
106
  assert_equal '第B章', I18n.t('chapter', 2)
107
107
 
108
- File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%paW章" }
108
+ File.write(file, "locale: ja\nchapter: 第%paW章")
109
109
  I18n.setup('ja')
110
110
  assert_equal '第b章', I18n.t('chapter', 2)
111
111
 
112
- File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pR章" }
112
+ File.write(file, "locale: ja\nchapter: 第%pR章")
113
113
  I18n.setup('ja')
114
114
  assert_equal '第I章', I18n.t('chapter', 1)
115
115
 
116
- File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pr章" }
116
+ File.write(file, "locale: ja\nchapter: 第%pr章")
117
117
  I18n.setup('ja')
118
118
  assert_equal '第ii章', I18n.t('chapter', 2)
119
119
 
120
- File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pRW章" }
120
+ File.write(file, "locale: ja\nchapter: 第%pRW章")
121
121
  I18n.setup('ja')
122
122
  assert_equal '第Ⅻ章', I18n.t('chapter', 12)
123
123
 
124
- File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pJ章" }
124
+ File.write(file, "locale: ja\nchapter: 第%pJ章")
125
125
  I18n.setup('ja')
126
126
  assert_equal '第二十七章', I18n.t('chapter', 27)
127
127
 
128
- File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pdW章" }
128
+ File.write(file, "locale: ja\nchapter: 第%pdW章")
129
129
  I18n.setup('ja')
130
130
  assert_equal '第1章', I18n.t('chapter', 1)
131
131
 
132
- File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pdW章" }
132
+ File.write(file, "locale: ja\nchapter: 第%pdW章")
133
133
  I18n.setup('ja')
134
134
  assert_equal '第27章', I18n.t('chapter', 27)
135
135
 
136
- File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pDW章" }
136
+ File.write(file, "locale: ja\nchapter: 第%pDW章")
137
137
  I18n.setup('ja')
138
138
  assert_equal '第1章', I18n.t('chapter', 1)
139
139
 
140
- File.open(file, 'w') { |f| f.write "locale: ja\nchapter: 第%pDW章" }
140
+ File.write(file, "locale: ja\nchapter: 第%pDW章")
141
141
  I18n.setup('ja')
142
142
  assert_equal '第27章', I18n.t('chapter', 27)
143
143
 
144
- File.open(file, 'w') { |f| f.write "locale: ja\npart: Part %pRW" }
144
+ File.write(file, "locale: ja\npart: Part %pRW")
145
145
  I18n.setup('ja')
146
146
  assert_equal 'Part 0', I18n.t('part', 0)
147
147
 
148
- File.open(file, 'w') { |f| f.write "locale: ja\npart: 第%pJ部" }
148
+ File.write(file, "locale: ja\npart: 第%pJ部")
149
149
  I18n.setup('ja')
150
150
  assert_equal '第一部', I18n.t('part', 1)
151
151
  end
@@ -157,23 +157,23 @@ class I18nTest < Test::Unit::TestCase
157
157
  Dir.chdir(dir) do
158
158
  file = File.join(dir, 'locale.yml')
159
159
 
160
- File.open(file, 'w') { |f| f.write %Q(locale: ja\nformat_number_header: "%s-%pA:") }
160
+ File.write(file, %Q(locale: ja\nformat_number_header: "%s-%pA:"))
161
161
  I18n.setup('ja')
162
162
  assert_equal '1-B:', I18n.t('format_number_header', [1, 2])
163
163
 
164
- File.open(file, 'w') { |f| f.write %Q(locale: ja\nformat_number_header: "%s.%pa:") }
164
+ File.write(file, %Q(locale: ja\nformat_number_header: "%s.%pa:"))
165
165
  I18n.setup('ja')
166
166
  assert_equal '2.c:', I18n.t('format_number_header', [2, 3])
167
167
 
168
- File.open(file, 'w') { |f| f.write %Q(locale: ja\nformat_number_header: "%pA,%pAW:") }
168
+ File.write(file, %Q(locale: ja\nformat_number_header: "%pA,%pAW:"))
169
169
  I18n.setup('ja')
170
170
  assert_equal 'C,D:', I18n.t('format_number_header', [3, 4])
171
171
 
172
- File.open(file, 'w') { |f| f.write %Q(locale: ja\nformat_number_header: "%pJ・%pJ:") }
172
+ File.write(file, %Q(locale: ja\nformat_number_header: "%pJ・%pJ:"))
173
173
  I18n.setup('ja')
174
174
  assert_equal '十二・二十六:', I18n.t('format_number_header', [12, 26])
175
175
 
176
- File.open(file, 'w') { |f| f.write %Q(locale: ja\nformat_number_header: "%pdW―%pdW:") }
176
+ File.write(file, %Q(locale: ja\nformat_number_header: "%pdW―%pdW:"))
177
177
  I18n.setup('ja')
178
178
  assert_equal '3―12:', I18n.t('format_number_header', [3, 12])
179
179
  end
@@ -185,11 +185,11 @@ class I18nTest < Test::Unit::TestCase
185
185
  Dir.chdir(dir) do
186
186
  file = File.join(dir, 'locale.yml')
187
187
 
188
- File.open(file, 'w') { |f| f.write %Q(locale: ja\nformat_number_header: "%2$d") }
188
+ File.write(file, %Q(locale: ja\nformat_number_header: "%2$d"))
189
189
  I18n.setup('ja')
190
190
  assert_equal '10', I18n.t('format_number_header', [1, 10])
191
191
 
192
- File.open(file, 'w') { |f| f.write %Q(locale: ja\nformat_number_header: "%2$d-%1$d") }
192
+ File.write(file, %Q(locale: ja\nformat_number_header: "%2$d-%1$d"))
193
193
  I18n.setup('ja')
194
194
  # ERROR: returns raw format
195
195
  assert_equal '%2$d-%1$d', I18n.t('format_number_header', [1])
@@ -238,11 +238,11 @@ class I18nTest < Test::Unit::TestCase
238
238
  def _setup_htmlbuilder
239
239
  I18n.setup('en')
240
240
  @builder = HTMLBuilder.new
241
- @config = ReVIEW::Configure[
242
- 'secnolevel' => 2, # for IDGXMLBuilder, HTMLBuilder
243
- 'stylesheet' => nil, # for HTMLBuilder
244
- 'ext' => '.re'
245
- ]
241
+ @config = ReVIEW::Configure.values.merge(
242
+ { 'secnolevel' => 2, # for IDGXMLBuilder, HTMLBuilder
243
+ 'stylesheet' => nil, # for HTMLBuilder
244
+ 'ext' => '.re' }
245
+ )
246
246
  @book = Book::Base.new('.')
247
247
  @book.config = @config
248
248
  @compiler = ReVIEW::Compiler.new(@builder)
@@ -48,6 +48,19 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
48
48
  assert_equal %Q(<title id="test" aid:pstyle="h3">1.0.1 this is test.</title><?dtp level="3" section="1.0.1 this is test."?>), actual
49
49
  end
50
50
 
51
+ def test_headline_secttags
52
+ @config['structuredxml'] = true
53
+ actual = compile_block("= HEAD1\n== HEAD1-1\n\n=== HEAD1-1-1\n\n== HEAD1-2\n\n==== HEAD1-2-0-1\n\n===== HEAD1-2-0-1-1\n\n== HEAD1-3\n")
54
+ expected = '<chapter id="chap:1"><title aid:pstyle="h1">第1章 HEAD1</title><?dtp level="1" section="第1章 HEAD1"?>' +
55
+ '<sect id="sect:1.1"><title aid:pstyle="h2">1.1 HEAD1-1</title><?dtp level="2" section="1.1 HEAD1-1"?>' +
56
+ '<sect2 id="sect:1.1.1"><title aid:pstyle="h3">HEAD1-1-1</title><?dtp level="3" section="HEAD1-1-1"?></sect2></sect>' +
57
+ '<sect id="sect:1.2"><title aid:pstyle="h2">1.2 HEAD1-2</title><?dtp level="2" section="1.2 HEAD1-2"?>' +
58
+ '<sect3 id="sect:1.2.0.1"><title aid:pstyle="h4">HEAD1-2-0-1</title><?dtp level="4" section="HEAD1-2-0-1"?>' +
59
+ '<sect4 id="sect:1.2.0.1.1"><title aid:pstyle="h5">HEAD1-2-0-1-1</title><?dtp level="5" section="HEAD1-2-0-1-1"?></sect4></sect3></sect>' +
60
+ '<sect id="sect:1.3"><title aid:pstyle="h2">1.3 HEAD1-3</title><?dtp level="2" section="1.3 HEAD1-3"?></sect></chapter>'
61
+ assert_equal expected, actual
62
+ end
63
+
51
64
  def test_label
52
65
  actual = compile_block("//label[label_test]\n")
53
66
  assert_equal %Q(<label id='label_test' />), actual
@@ -100,6 +113,27 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
100
113
  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
101
114
  end
102
115
 
116
+ def test_table
117
+ actual = compile_block("//table{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
118
+ expected = <<-EOS.chomp
119
+ <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">aaa</td><td xyh="2,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">bbb</td><td xyh="1,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">ccc</td><td xyh="2,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">ddd&lt;&gt;&amp;</td></tbody></table>
120
+ EOS
121
+ assert_equal expected, actual
122
+
123
+ actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
124
+ expected = <<-EOS.chomp
125
+ <table><caption>表1.1 FOO</caption><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">aaa</td><td xyh="2,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">bbb</td><td xyh="1,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">ccc</td><td xyh="2,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">ddd&lt;&gt;&amp;</td></tbody></table>
126
+ EOS
127
+ assert_equal expected, actual
128
+
129
+ @config['caption_position']['table'] = 'bottom'
130
+ actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
131
+ expected = <<-EOS.chomp
132
+ <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">aaa</td><td xyh="2,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">bbb</td><td xyh="1,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">ccc</td><td xyh="2,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">ddd&lt;&gt;&amp;</td></tbody><caption>表1.1 FOO</caption></table>
133
+ EOS
134
+ assert_equal expected, actual
135
+ end
136
+
103
137
  def test_customize_cellwidth
104
138
  actual = compile_block("//tsize[2,3,5]\n//table{\nA\tB\tC\n//}\n")
105
139
  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
@@ -134,16 +168,50 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
134
168
  end
135
169
 
136
170
  def test_empty_table
137
- e = assert_raises(ReVIEW::ApplicationError) { compile_block "//table{\n//}\n" }
171
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n//}\n") }
138
172
  assert_equal ':2: error: no rows in the table', e.message
139
173
 
140
- e = assert_raises(ReVIEW::ApplicationError) { compile_block "//table{\n------------\n//}\n" }
174
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n------------\n//}\n") }
141
175
  assert_equal ':3: error: no rows in the table', e.message
142
176
  end
143
177
 
144
178
  def test_emtable
145
179
  actual = compile_block("//emtable[foo]{\nA\n//}\n//emtable{\nA\n//}")
146
180
  assert_equal %Q(<table><caption>foo</caption><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><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
181
+
182
+ @config['caption_position']['table'] = 'bottom'
183
+ actual = compile_block("//emtable[foo]{\nA\n//}\n//emtable{\nA\n//}")
184
+ 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><caption>foo</caption></table><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
185
+ end
186
+
187
+ def test_table_row_separator
188
+ src = "//table{\n1\t2\t\t3 4| 5\n------------\na b\tc d |e\n//}\n"
189
+ expected = <<-EOS.chomp
190
+ <table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="2" aid:tcols="3"><td xyh="1,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="9.448">1</td><td xyh="2,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="9.448">2</td><td xyh="3,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="9.448">3 4| 5</td><td xyh="1,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="9.448">a b</td><td xyh="2,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="9.448">c d |e</td></tbody></table>
191
+ EOS
192
+ actual = compile_block(src)
193
+ assert_equal expected, actual
194
+
195
+ @config['table_row_separator'] = 'singletab'
196
+ actual = compile_block(src)
197
+ expected = <<-EOS.chomp
198
+ <table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="2" aid:tcols="4"><td xyh="1,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="7.086">1</td><td xyh="2,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="7.086">2</td><td xyh="3,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="7.086"></td><td xyh="4,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="7.086">3 4| 5</td><td xyh="1,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="7.086">a b</td><td xyh="2,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="7.086">c d |e</td></tbody></table>
199
+ EOS
200
+ assert_equal expected, actual
201
+
202
+ @config['table_row_separator'] = 'spaces'
203
+ actual = compile_block(src)
204
+ expected = <<-EOS.chomp
205
+ <table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="2" aid:tcols="5"><td xyh="1,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="5.669">1</td><td xyh="2,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="5.669">2</td><td xyh="3,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="5.669">3</td><td xyh="4,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="5.669">4|</td><td xyh="5,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="5.669">5</td><td xyh="1,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="5.669">a</td><td xyh="2,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="5.669">b</td><td xyh="3,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="5.669">c</td><td xyh="4,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="5.669">d</td><td xyh="5,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="5.669">|e</td></tbody></table>
206
+ EOS
207
+ assert_equal expected, actual
208
+
209
+ @config['table_row_separator'] = 'verticalbar'
210
+ actual = compile_block(src)
211
+ expected = <<-EOS.chomp
212
+ <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">1 2 3 4</td><td xyh="2,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">5</td><td xyh="1,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">a b c d</td><td xyh="2,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">e</td></tbody></table>
213
+ EOS
214
+ assert_equal expected, actual
147
215
  end
148
216
 
149
217
  def test_inline_br
@@ -196,6 +264,15 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
196
264
  assert_equal %Q(<dl><dt>foo</dt><dd>foo.</dd></dl><p>para</p><dl><dt>foo</dt><dd>foo.</dd></dl><ol><li aid:pstyle="ol-item" olnum="1" num="1">bar</li></ol><dl><dt>foo</dt><dd>foo.</dd></dl><ul><li aid:pstyle="ul-item">bar</li></ul>), actual
197
265
  end
198
266
 
267
+ def test_dt_inline
268
+ actual = compile_block("//footnote[bar][bar]\n\n : foo@<fn>{bar}[]<>&@<m>$\\alpha[]$\n")
269
+
270
+ expected = <<-EOS.chomp
271
+ <dl><dt>foo<footnote>bar</footnote>[]&lt;&gt;&amp;<replace idref="texinline-1"><pre>\\alpha[]</pre></replace></dt><dd></dd></dl>
272
+ EOS
273
+ assert_equal expected, actual
274
+ end
275
+
199
276
  def test_paragraph
200
277
  actual = compile_block("foo\nbar\n")
201
278
  assert_equal '<p>foobar</p>', actual
@@ -258,6 +335,145 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
258
335
  assert_equal expected, actual
259
336
  end
260
337
 
338
+ def test_minicolumn_blocks
339
+ %w[note memo tip info warning important caution notice].each do |type|
340
+ src = <<-EOS
341
+ //#{type}[#{type}1]{
342
+
343
+ //}
344
+
345
+ //#{type}[#{type}2]{
346
+ //}
347
+ EOS
348
+
349
+ if type == 'notice' # exception pattern
350
+ expected = <<-EOS.chomp
351
+ <#{type}-t><title aid:pstyle='#{type}-title'>#{type}1</title></#{type}-t><#{type}-t><title aid:pstyle='#{type}-title'>#{type}2</title></#{type}-t>
352
+ EOS
353
+ else
354
+ expected = <<-EOS.chomp
355
+ <#{type}><title aid:pstyle='#{type}-title'>#{type}1</title></#{type}><#{type}><title aid:pstyle='#{type}-title'>#{type}2</title></#{type}>
356
+ EOS
357
+ end
358
+ assert_equal expected, compile_block(src)
359
+
360
+ src = <<-EOS
361
+ //#{type}[#{type}2]{
362
+
363
+ //}
364
+
365
+ //#{type}[#{type}3]{
366
+
367
+ //}
368
+
369
+ //#{type}[#{type}4]{
370
+
371
+ //}
372
+
373
+ //#{type}[#{type}5]{
374
+
375
+ //}
376
+
377
+ //#{type}[#{type}6]{
378
+
379
+ //}
380
+ EOS
381
+
382
+ if type == 'notice' # exception pattern
383
+ expected = <<-EOS.chomp
384
+ <#{type}-t><title aid:pstyle='#{type}-title'>#{type}2</title></#{type}-t><#{type}-t><title aid:pstyle='#{type}-title'>#{type}3</title></#{type}-t><#{type}-t><title aid:pstyle='#{type}-title'>#{type}4</title></#{type}-t><#{type}-t><title aid:pstyle='#{type}-title'>#{type}5</title></#{type}-t><#{type}-t><title aid:pstyle='#{type}-title'>#{type}6</title></#{type}-t>
385
+ EOS
386
+ else
387
+ expected = <<-EOS.chomp
388
+ <#{type}><title aid:pstyle='#{type}-title'>#{type}2</title></#{type}><#{type}><title aid:pstyle='#{type}-title'>#{type}3</title></#{type}><#{type}><title aid:pstyle='#{type}-title'>#{type}4</title></#{type}><#{type}><title aid:pstyle='#{type}-title'>#{type}5</title></#{type}><#{type}><title aid:pstyle='#{type}-title'>#{type}6</title></#{type}>
389
+ EOS
390
+ end
391
+ assert_equal expected, compile_block(src)
392
+
393
+ src = <<-EOS
394
+ //#{type}{
395
+
396
+ * A
397
+
398
+ 1. B
399
+
400
+ //}
401
+
402
+ //#{type}[OMITEND1]{
403
+
404
+ //emlist{
405
+ LIST
406
+ //}
407
+
408
+ //}
409
+ //#{type}[OMITEND2]{
410
+ //}
411
+ EOS
412
+
413
+ if type == 'notice' # exception pattern
414
+ expected = <<-EOS.chomp
415
+ <#{type}><ul><li aid:pstyle="ul-item">A</li></ul><ol><li aid:pstyle="ol-item" olnum="1" num="1">B</li></ol></#{type}><#{type}-t><title aid:pstyle='#{type}-title'>OMITEND1</title><list type='emlist'><pre>LIST
416
+ </pre></list></#{type}-t><#{type}-t><title aid:pstyle='#{type}-title'>OMITEND2</title></#{type}-t>
417
+ EOS
418
+ else
419
+ expected = <<-EOS.chomp
420
+ <#{type}><ul><li aid:pstyle="ul-item">A</li></ul><ol><li aid:pstyle="ol-item" olnum="1" num="1">B</li></ol></#{type}><#{type}><title aid:pstyle='#{type}-title'>OMITEND1</title><list type='emlist'><pre>LIST
421
+ </pre></list></#{type}><#{type}><title aid:pstyle='#{type}-title'>OMITEND2</title></#{type}>
422
+ EOS
423
+ end
424
+ assert_equal expected, compile_block(src)
425
+ end
426
+ end
427
+
428
+ def test_minicolumn_blocks_nest_error1
429
+ %w[note memo tip info warning important caution notice].each do |type|
430
+ @builder.doc_status.clear
431
+ src = <<-EOS
432
+ //#{type}{
433
+
434
+ //#{type}{
435
+ //}
436
+
437
+ //}
438
+ EOS
439
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
440
+ assert_match(/minicolumn cannot be nested:/, e.message)
441
+ end
442
+ end
443
+
444
+ def test_minicolumn_blocks_nest_error2
445
+ %w[note memo tip info warning important caution notice].each do |type|
446
+ @builder.doc_status.clear
447
+ src = <<-EOS
448
+ //#{type}{
449
+
450
+ //#{type}{
451
+
452
+ //}
453
+
454
+ //}
455
+ EOS
456
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
457
+ assert_match(/minicolumn cannot be nested:/, e.message)
458
+ end
459
+ end
460
+
461
+ def test_minicolumn_blocks_nest_error3
462
+ %w[memo tip info warning important caution notice].each do |type|
463
+ @builder.doc_status.clear
464
+ src = <<-EOS
465
+ //#{type}{
466
+
467
+ //note{
468
+ //}
469
+
470
+ //}
471
+ EOS
472
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
473
+ assert_match(/minicolumn cannot be nested:/, e.message)
474
+ end
475
+ end
476
+
261
477
  def test_term
262
478
  actual = compile_block("//term{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
263
479
  assert_equal '<term><p>test1test1.5</p><p>test<i>2</i></p></term>', actual
@@ -288,11 +504,19 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
288
504
  def test_emlist
289
505
  actual = compile_block("//emlist[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
290
506
  assert_equal %Q(<list type='emlist'><caption aid:pstyle='emlist-title'>this is <b>test</b>&lt;&amp;&gt;_</caption><pre>test1\ntest1.5\n\ntest<i>2</i>\n</pre></list>), actual
507
+
508
+ @config['caption_position']['list'] = 'bottom'
509
+ actual = compile_block("//emlist[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
510
+ assert_equal %Q(<list type='emlist'><pre>test1\ntest1.5\n\ntest<i>2</i>\n</pre><caption aid:pstyle='emlist-title'>this is <b>test</b>&lt;&amp;&gt;_</caption></list>), actual
291
511
  end
292
512
 
293
513
  def test_emlistnum
294
514
  actual = compile_block("//emlistnum[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
295
515
  assert_equal %Q(<list type='emlistnum'><caption aid:pstyle='emlistnum-title'>this is <b>test</b>&lt;&amp;&gt;_</caption><pre><span type='lineno'> 1: </span>test1\n<span type='lineno'> 2: </span>test1.5\n<span type='lineno'> 3: </span>\n<span type='lineno'> 4: </span>test<i>2</i>\n</pre></list>), actual
516
+
517
+ @config['caption_position']['list'] = 'bottom'
518
+ actual = compile_block("//emlistnum[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
519
+ assert_equal %Q(<list type='emlistnum'><pre><span type='lineno'> 1: </span>test1\n<span type='lineno'> 2: </span>test1.5\n<span type='lineno'> 3: </span>\n<span type='lineno'> 4: </span>test<i>2</i>\n</pre><caption aid:pstyle='emlistnum-title'>this is <b>test</b>&lt;&amp;&gt;_</caption></list>), actual
296
520
  end
297
521
 
298
522
  def test_emlist_listinfo
@@ -344,6 +568,17 @@ test1.5
344
568
 
345
569
  test<i>2</i>
346
570
  </pre></codelist>
571
+ EOS
572
+ assert_equal expected, actual
573
+
574
+ @config['caption_position']['list'] = 'bottom'
575
+ actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
576
+ expected = <<-EOS.chomp
577
+ <codelist><pre>test1
578
+ test1.5
579
+
580
+ test<i>2</i>
581
+ </pre><caption>リスト1.1 this is <b>test</b>&lt;&amp;&gt;_</caption></codelist>
347
582
  EOS
348
583
  assert_equal expected, actual
349
584
  end
@@ -359,6 +594,17 @@ EOS
359
594
  <span type='lineno'> 3: </span>
360
595
  <span type='lineno'> 4: </span>test<i>2</i>
361
596
  </pre></codelist>
597
+ EOS
598
+ assert_equal expected, actual
599
+
600
+ @config['caption_position']['list'] = 'bottom'
601
+ actual = compile_block("//listnum[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
602
+ expected = <<-EOS.chomp
603
+ <codelist><pre><span type='lineno'> 1: </span>test1
604
+ <span type='lineno'> 2: </span>test1.5
605
+ <span type='lineno'> 3: </span>
606
+ <span type='lineno'> 4: </span>test<i>2</i>
607
+ </pre><caption>リスト1.1 this is <b>test</b>&lt;&amp;&gt;_</caption></codelist>
362
608
  EOS
363
609
  assert_equal expected, actual
364
610
  end
@@ -374,6 +620,17 @@ EOS
374
620
  <span type='lineno'>102: </span>
375
621
  <span type='lineno'>103: </span>test<i>2</i>
376
622
  </pre></codelist>
623
+ EOS
624
+ assert_equal expected, actual
625
+
626
+ @config['caption_position']['list'] = 'bottom'
627
+ actual = compile_block("//firstlinenum[100]\n//listnum[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
628
+ expected = <<-EOS.chomp
629
+ <codelist><pre><span type='lineno'>100: </span>test1
630
+ <span type='lineno'>101: </span>test1.5
631
+ <span type='lineno'>102: </span>
632
+ <span type='lineno'>103: </span>test<i>2</i>
633
+ </pre><caption>リスト1.1 this is <b>test</b>&lt;&amp;&gt;_</caption></codelist>
377
634
  EOS
378
635
  assert_equal expected, actual
379
636
  end
@@ -390,6 +647,17 @@ EOS
390
647
  </listinfo><listinfo line="3">
391
648
  </listinfo><listinfo line="4" end="4">test<i>2</i>
392
649
  </listinfo></pre></codelist>
650
+ EOS
651
+ assert_equal expected, actual
652
+
653
+ @config['caption_position']['list'] = 'bottom'
654
+ actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
655
+ expected = <<-EOS.chomp
656
+ <codelist><pre><listinfo line="1" begin="1">test1
657
+ </listinfo><listinfo line="2">test1.5
658
+ </listinfo><listinfo line="3">
659
+ </listinfo><listinfo line="4" end="4">test<i>2</i>
660
+ </listinfo></pre><caption>リスト1.1 this is <b>test</b>&lt;&amp;&gt;_</caption></codelist>
393
661
  EOS
394
662
  assert_equal expected, actual
395
663
  end
@@ -408,6 +676,15 @@ EOS
408
676
  <list type='cmd'><caption aid:pstyle='cmd-title'>cap1</caption><pre>lineA
409
677
  lineB
410
678
  </pre></list>
679
+ EOS
680
+ assert_equal expected, actual
681
+
682
+ @config['caption_position']['list'] = 'bottom'
683
+ actual = compile_block("//cmd[cap1]{\nlineA\nlineB\n//}\n")
684
+ expected = <<-EOS.chomp
685
+ <list type='cmd'><pre>lineA
686
+ lineB
687
+ </pre><caption aid:pstyle='cmd-title'>cap1</caption></list>
411
688
  EOS
412
689
  assert_equal expected, actual
413
690
  end
@@ -420,6 +697,17 @@ bar
420
697
 
421
698
  buz
422
699
  </pre></source>
700
+ EOS
701
+ assert_equal expected, actual
702
+
703
+ @config['caption_position']['list'] = 'bottom'
704
+ actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
705
+ expected = <<-EOS.chomp
706
+ <source><pre>foo
707
+ bar
708
+
709
+ buz
710
+ </pre><caption>foo/bar/test.rb</caption></source>
423
711
  EOS
424
712
  assert_equal expected, actual
425
713
  end
@@ -430,6 +718,18 @@ EOS
430
718
  <source><pre>foo
431
719
  bar
432
720
 
721
+ buz
722
+ </pre></source>
723
+ EOS
724
+ assert_equal expected, actual
725
+ end
726
+
727
+ def test_source_nil_caption
728
+ actual = compile_block("//source{\nfoo\nbar\n\nbuz\n//}\n")
729
+ expected = <<-EOS.chomp
730
+ <source><pre>foo
731
+ bar
732
+
433
733
  buz
434
734
  </pre></source>
435
735
  EOS
@@ -445,6 +745,17 @@ EOS
445
745
  </listinfo><listinfo line="3">
446
746
  </listinfo><listinfo line="4" end="4">test<i>2</i>
447
747
  </listinfo></insn>
748
+ EOS
749
+ assert_equal expected, actual
750
+
751
+ @config['caption_position']['list'] = 'bottom'
752
+ actual = compile_block("//insn[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
753
+ expected = <<-EOS.chomp
754
+ <insn><listinfo line="1" begin="1">test1
755
+ </listinfo><listinfo line="2">test1.5
756
+ </listinfo><listinfo line="3">
757
+ </listinfo><listinfo line="4" end="4">test<i>2</i>
758
+ </listinfo><floattitle type="insn">this is <b>test</b>&lt;&amp;&gt;_</floattitle></insn>
448
759
  EOS
449
760
  assert_equal expected, actual
450
761
  end
@@ -458,6 +769,17 @@ EOS
458
769
  </listinfo><listinfo line="3">
459
770
  </listinfo><listinfo line="4" end="4">test<i>2</i>
460
771
  </listinfo></box>
772
+ EOS
773
+ assert_equal expected, actual
774
+
775
+ @config['caption_position']['list'] = 'bottom'
776
+ actual = compile_block("//box[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
777
+ expected = <<-EOS.chomp
778
+ <box><listinfo line="1" begin="1">test1
779
+ </listinfo><listinfo line="2">test1.5
780
+ </listinfo><listinfo line="3">
781
+ </listinfo><listinfo line="4" end="4">test<i>2</i>
782
+ </listinfo><caption aid:pstyle="box-title">this is <b>test</b>&lt;&amp;&gt;_</caption></box>
461
783
  EOS
462
784
  assert_equal expected, actual
463
785
  end
@@ -471,6 +793,17 @@ test1.5
471
793
 
472
794
  test<i>2</i>
473
795
  </box>
796
+ EOS
797
+ assert_equal expected, actual
798
+
799
+ @config['caption_position']['list'] = 'bottom'
800
+ actual = compile_block("//box[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
801
+ expected = <<-EOS.chomp
802
+ <box>test1
803
+ test1.5
804
+
805
+ test<i>2</i>
806
+ <caption aid:pstyle="box-title">this is <b>test</b>&lt;&amp;&gt;_</caption></box>
474
807
  EOS
475
808
  assert_equal expected, actual
476
809
  end
@@ -516,6 +849,10 @@ EOS
516
849
 
517
850
  actual = compile_block("//image[sampleimg][sample photo]{\n//}\n")
518
851
  assert_equal %Q(<img><Image href="file://images/chap1-sampleimg.png" /><caption>図1.1 sample photo</caption></img>), actual
852
+
853
+ @config['caption_position']['image'] = 'top'
854
+ actual = compile_block("//image[sampleimg][sample photo]{\n//}\n")
855
+ assert_equal %Q(<img><caption>図1.1 sample photo</caption><Image href="file://images/chap1-sampleimg.png" /></img>), actual
519
856
  end
520
857
 
521
858
  def test_image_with_metric
@@ -549,6 +886,10 @@ EOS
549
886
 
550
887
  actual = compile_block("//indepimage[sampleimg][sample photo]\n")
551
888
  assert_equal %Q(<img><Image href="file://images/chap1-sampleimg.png" /><caption>sample photo</caption></img>), actual
889
+
890
+ @config['caption_position']['image'] = 'top'
891
+ actual = compile_block("//indepimage[sampleimg][sample photo]\n")
892
+ assert_equal %Q(<img><caption>sample photo</caption><Image href="file://images/chap1-sampleimg.png" /></img>), actual
552
893
  end
553
894
 
554
895
  def test_indepimage_without_caption
@@ -656,18 +997,31 @@ inside column
656
997
  this is @<column>{foo}.
657
998
  EOS
658
999
  expected = <<-EOS.chomp
659
- <column id="column-1"><title aid:pstyle="column-title">test</title><?dtp level="9" section="test"?><p>inside column</p></column><title aid:pstyle="h3">next level</title><?dtp level="3" section="next level"?><p>this is コラム「test」.</p>
1000
+ <column id="column-1"><title aid:pstyle="column-title">test</title><?dtp level="9" section="test"?><p>inside column</p></column><title aid:pstyle="h3">next level</title><?dtp level="3" section="next level"?><p>this is <link href="column-1">コラム「test」</link>.</p>
660
1001
  EOS
661
1002
 
662
1003
  assert_equal expected, column_helper(review)
1004
+
1005
+ @config['chapterlink'] = nil
1006
+ expected = <<-EOS.chomp
1007
+ <column id="column-1"><title aid:pstyle="column-title">test</title><?dtp level="9" section="test"?><p>inside column</p></column><title aid:pstyle="h3">next level</title><?dtp level="3" section="next level"?><p>this is コラム「test」.</p>
1008
+ EOS
1009
+ assert_equal expected, column_helper(review)
663
1010
  end
664
1011
 
665
1012
  def test_column_in_aother_chapter_ref
666
1013
  def @chapter.column_index
667
- items = [Book::Index::Item.new('chap1|column', 1, 'column_cap')]
668
- Book::ColumnIndex.new(items)
1014
+ item = Book::Index::Item.new('chap1|column', 1, 'column_cap')
1015
+ idx = Book::ColumnIndex.new
1016
+ idx.add_item(item)
1017
+ idx
669
1018
  end
670
1019
 
1020
+ actual = compile_inline('test @<column>{chap1|column} test2')
1021
+ expected = 'test <link href="column-1">コラム「column_cap」</link> test2'
1022
+ assert_equal expected, actual
1023
+
1024
+ @config['chapterlink'] = nil
671
1025
  actual = compile_inline('test @<column>{chap1|column} test2')
672
1026
  expected = 'test コラム「column_cap」 test2'
673
1027
  assert_equal expected, actual
@@ -777,18 +1131,18 @@ EOS
777
1131
  end
778
1132
 
779
1133
  def test_inline_unknown
780
- e = assert_raises(ReVIEW::ApplicationError) { compile_block "@<img>{n}\n" }
1134
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<img>{n}\n") }
781
1135
  assert_equal ':1: error: unknown image: n', e.message
782
- e = assert_raises(ReVIEW::ApplicationError) { compile_block "@<fn>{n}\n" }
1136
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<fn>{n}\n") }
783
1137
  assert_equal ':1: error: unknown footnote: n', e.message
784
- e = assert_raises(ReVIEW::ApplicationError) { compile_block "@<hd>{n}\n" }
1138
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<hd>{n}\n") }
785
1139
  assert_equal ':1: error: unknown headline: n', e.message
786
1140
  %w[list table column].each do |name|
787
- e = assert_raises(ReVIEW::ApplicationError) { compile_block "@<#{name}>{n}\n" }
1141
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
788
1142
  assert_equal ":1: error: unknown #{name}: n", e.message
789
1143
  end
790
1144
  %w[chap chapref title].each do |name|
791
- e = assert_raises(ReVIEW::ApplicationError) { compile_block "@<#{name}>{n}\n" }
1145
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
792
1146
  assert_equal ':1: error: key not found: "n"', e.message
793
1147
  end
794
1148
  end
@@ -917,5 +1271,209 @@ EOS
917
1271
  expected = %Q(<p><span type='eq'>式1.1</span></p><equationblock><caption>式1.1 The Equivalence of Mass <i>and</i> Energy</caption><replace idref="texblock-1"><pre>e=mc^2</pre></replace></equationblock>)
918
1272
  actual = compile_block(src)
919
1273
  assert_equal expected, actual
1274
+
1275
+ @config['caption_position']['equation'] = 'bottom'
1276
+ expected = %Q(<p><span type='eq'>式1.1</span></p><equationblock><replace idref="texblock-1"><pre>e=mc^2</pre></replace><caption>式1.1 The Equivalence of Mass <i>and</i> Energy</caption></equationblock>)
1277
+ actual = compile_block(src)
1278
+ assert_equal expected, actual
1279
+ end
1280
+
1281
+ def test_nest_error_close1
1282
+ src = <<-EOS
1283
+ //beginchild
1284
+ EOS
1285
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
1286
+ assert_equal ":1: error: //beginchild is shown, but previous element isn't ul, ol, or dl", e.message
1287
+ end
1288
+
1289
+ def test_nest_error_close2
1290
+ src = <<-EOS
1291
+ * foo
1292
+
1293
+ //beginchild
1294
+
1295
+ 1. foo
1296
+
1297
+ //beginchild
1298
+
1299
+ : foo
1300
+
1301
+ //beginchild
1302
+ EOS
1303
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
1304
+ assert_equal ':12: error: //beginchild of dl,ol,ul misses //endchild', e.message
1305
+ end
1306
+
1307
+ def test_nest_error_close3
1308
+ src = <<-EOS
1309
+ * foo
1310
+
1311
+ //beginchild
1312
+
1313
+ 1. foo
1314
+
1315
+ //beginchild
1316
+
1317
+ : foo
1318
+
1319
+ //beginchild
1320
+
1321
+ //endchild
1322
+ EOS
1323
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
1324
+ assert_equal ':14: error: //beginchild of ol,ul misses //endchild', e.message
1325
+ end
1326
+
1327
+ def test_nest_ul
1328
+ src = <<-EOS
1329
+ * UL1
1330
+
1331
+ //beginchild
1332
+
1333
+ 1. UL1-OL1
1334
+ 2. UL1-OL2
1335
+
1336
+ * UL1-UL1
1337
+ * UL1-UL2
1338
+
1339
+ : UL1-DL1
1340
+ UL1-DD1
1341
+ : UL1-DL2
1342
+ UL1-DD2
1343
+
1344
+ //endchild
1345
+
1346
+ * UL2
1347
+
1348
+ //beginchild
1349
+
1350
+ UL2-PARA
1351
+
1352
+ //endchild
1353
+ EOS
1354
+
1355
+ expected = <<-EOS.chomp
1356
+ <ul><li aid:pstyle="ul-item">UL1<ol><li aid:pstyle="ol-item" olnum="1" num="1">UL1-OL1</li><li aid:pstyle="ol-item" olnum="2" num="2">UL1-OL2</li></ol><ul><li aid:pstyle="ul-item">UL1-UL1</li><li aid:pstyle="ul-item">UL1-UL2</li></ul><dl><dt>UL1-DL1</dt><dd>UL1-DD1</dd><dt>UL1-DL2</dt><dd>UL1-DD2</dd></dl></li><li aid:pstyle="ul-item">UL2<p>UL2-PARA</p></li></ul>
1357
+ EOS
1358
+
1359
+ actual = compile_block(src)
1360
+ assert_equal expected, actual
1361
+ end
1362
+
1363
+ def test_nest_ol
1364
+ src = <<-EOS
1365
+ 1. OL1
1366
+
1367
+ //beginchild
1368
+
1369
+ 1. OL1-OL1
1370
+ 2. OL1-OL2
1371
+
1372
+ * OL1-UL1
1373
+ * OL1-UL2
1374
+
1375
+ : OL1-DL1
1376
+ OL1-DD1
1377
+ : OL1-DL2
1378
+ OL1-DD2
1379
+
1380
+ //endchild
1381
+
1382
+ 2. OL2
1383
+
1384
+ //beginchild
1385
+
1386
+ OL2-PARA
1387
+
1388
+ //endchild
1389
+ EOS
1390
+
1391
+ expected = <<-EOS.chomp
1392
+ <ol><li aid:pstyle="ol-item" olnum="1" num="1">OL1<ol><li aid:pstyle="ol-item" olnum="1" num="1">OL1-OL1</li><li aid:pstyle="ol-item" olnum="2" num="2">OL1-OL2</li></ol><ul><li aid:pstyle="ul-item">OL1-UL1</li><li aid:pstyle="ul-item">OL1-UL2</li></ul><dl><dt>OL1-DL1</dt><dd>OL1-DD1</dd><dt>OL1-DL2</dt><dd>OL1-DD2</dd></dl></li><li aid:pstyle="ol-item" olnum="1" num="2">OL2<p>OL2-PARA</p></li></ol>
1393
+ EOS
1394
+
1395
+ actual = compile_block(src)
1396
+ assert_equal expected, actual
1397
+ end
1398
+
1399
+ def test_nest_dl
1400
+ src = <<-EOS
1401
+ : DL1
1402
+
1403
+ //beginchild
1404
+
1405
+ 1. DL1-OL1
1406
+ 2. DL1-OL2
1407
+
1408
+ * DL1-UL1
1409
+ * DL1-UL2
1410
+
1411
+ : DL1-DL1
1412
+ DL1-DD1
1413
+ : DL1-DL2
1414
+ DL1-DD2
1415
+
1416
+ //endchild
1417
+
1418
+ : DL2
1419
+ DD2
1420
+
1421
+ //beginchild
1422
+
1423
+ * DD2-UL1
1424
+ * DD2-UL2
1425
+
1426
+ DD2-PARA
1427
+
1428
+ //endchild
1429
+ EOS
1430
+
1431
+ expected = <<-EOS.chomp
1432
+ <dl><dt>DL1</dt><dd><ol><li aid:pstyle="ol-item" olnum="1" num="1">DL1-OL1</li><li aid:pstyle="ol-item" olnum="2" num="2">DL1-OL2</li></ol><ul><li aid:pstyle="ul-item">DL1-UL1</li><li aid:pstyle="ul-item">DL1-UL2</li></ul><dl><dt>DL1-DL1</dt><dd>DL1-DD1</dd><dt>DL1-DL2</dt><dd>DL1-DD2</dd></dl></dd><dt>DL2</dt><dd>DD2<ul><li aid:pstyle="ul-item">DD2-UL1</li><li aid:pstyle="ul-item">DD2-UL2</li></ul><p>DD2-PARA</p></dd></dl>
1433
+ EOS
1434
+
1435
+ actual = compile_block(src)
1436
+ assert_equal expected, actual
1437
+ end
1438
+
1439
+ def test_nest_multi
1440
+ src = <<-EOS
1441
+ 1. OL1
1442
+
1443
+ //beginchild
1444
+
1445
+ 1. OL1-OL1
1446
+
1447
+ //beginchild
1448
+
1449
+ * OL1-OL1-UL1
1450
+
1451
+ OL1-OL1-PARA
1452
+
1453
+ //endchild
1454
+
1455
+ 2. OL1-OL2
1456
+
1457
+ * OL1-UL1
1458
+
1459
+ //beginchild
1460
+
1461
+ : OL1-UL1-DL1
1462
+ OL1-UL1-DD1
1463
+
1464
+ OL1-UL1-PARA
1465
+
1466
+ //endchild
1467
+
1468
+ * OL1-UL2
1469
+
1470
+ //endchild
1471
+ EOS
1472
+ expected = <<-EOS.chomp
1473
+ <ol><li aid:pstyle="ol-item" olnum="1" num="1">OL1<ol><li aid:pstyle="ol-item" olnum="1" num="1">OL1-OL1<ul><li aid:pstyle="ul-item">OL1-OL1-UL1</li></ul><p>OL1-OL1-PARA</p></li><li aid:pstyle="ol-item" olnum="1" num="2">OL1-OL2</li></ol><ul><li aid:pstyle="ul-item">OL1-UL1<dl><dt>OL1-UL1-DL1</dt><dd>OL1-UL1-DD1</dd></dl><p>OL1-UL1-PARA</p></li><li aid:pstyle="ul-item">OL1-UL2</li></ul></li></ol>
1474
+ EOS
1475
+
1476
+ actual = compile_block(src)
1477
+ assert_equal expected, actual
920
1478
  end
921
1479
  end