review 4.2.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby-win.yml +11 -5
- data/.rubocop.yml +113 -24
- data/NEWS.ja.md +94 -0
- data/NEWS.md +94 -0
- data/bin/review-catalog-converter +1 -1
- data/bin/review-check +2 -4
- data/bin/review-checkdep +1 -1
- data/bin/review-compile +8 -14
- data/bin/review-validate +1 -1
- data/doc/config.yml.sample +4 -1
- data/doc/config.yml.sample-simple +1 -1
- data/doc/format.ja.md +83 -4
- data/doc/format.md +84 -7
- data/doc/makeindex.ja.md +2 -2
- data/doc/quickstart.ja.md +3 -3
- data/doc/quickstart.md +2 -2
- data/lib/epubmaker/content.rb +3 -2
- data/lib/epubmaker/epubcommon.rb +33 -25
- data/lib/epubmaker/epubv2.rb +5 -6
- data/lib/epubmaker/epubv3.rb +20 -18
- data/lib/review/book.rb +2 -2
- data/lib/review/book/base.rb +61 -25
- data/lib/review/book/bib.rb +21 -0
- data/lib/review/book/book_unit.rb +155 -0
- data/lib/review/book/chapter.rb +30 -26
- data/lib/review/book/index.rb +23 -185
- data/lib/review/book/index/item.rb +7 -1
- data/lib/review/book/part.rb +21 -9
- data/lib/review/book/volume.rb +1 -1
- data/lib/review/builder.rb +68 -13
- data/lib/review/catalog.rb +2 -2
- data/lib/review/compiler.rb +159 -73
- data/lib/review/configure.rb +22 -1
- data/lib/review/converter.rb +1 -1
- data/lib/review/epub2html.rb +6 -1
- data/lib/review/epubmaker.rb +12 -23
- data/lib/review/htmlbuilder.rb +36 -7
- data/lib/review/htmlutils.rb +7 -10
- data/lib/review/i18n.rb +1 -1
- data/lib/review/idgxmlbuilder.rb +51 -6
- data/lib/review/idgxmlmaker.rb +9 -14
- data/lib/review/index_builder.rb +653 -0
- data/lib/review/init.rb +5 -13
- data/lib/review/latexbuilder.rb +65 -4
- data/lib/review/logger.rb +2 -2
- data/lib/review/makerhelper.rb +11 -0
- data/lib/review/markdownbuilder.rb +19 -1
- data/lib/review/pdfmaker.rb +17 -36
- data/lib/review/plaintextbuilder.rb +48 -2
- data/lib/review/preprocessor.rb +5 -5
- data/lib/review/rstbuilder.rb +25 -6
- data/lib/review/sec_counter.rb +13 -0
- data/lib/review/textmaker.rb +4 -12
- data/lib/review/tocprinter.rb +2 -3
- data/lib/review/topbuilder.rb +26 -0
- data/lib/review/update.rb +7 -7
- data/lib/review/version.rb +1 -1
- data/lib/review/volumeprinter.rb +2 -3
- data/lib/review/webmaker.rb +9 -20
- data/review.gemspec +2 -2
- data/samples/sample-book/src/config.yml +1 -1
- data/samples/syntax-book/Gemfile +1 -1
- data/samples/syntax-book/config.yml +1 -1
- data/templates/latex/config.erb +27 -23
- data/templates/latex/review-jlreq/README.md +3 -1
- data/templates/latex/review-jlreq/review-base.sty +31 -15
- data/templates/latex/review-jlreq/review-jlreq.cls +8 -24
- data/templates/latex/review-jsbook/README.md +7 -5
- data/templates/latex/review-jsbook/review-base.sty +34 -16
- data/templates/latex/review-jsbook/review-jsbook.cls +4 -2
- data/templates/web/html/layout-html5.html.erb +1 -1
- data/test/assets/test_template.tex +3 -3
- data/test/assets/test_template_backmatter.tex +3 -3
- data/test/book_test_helper.rb +11 -5
- data/test/test_book.rb +54 -63
- data/test/test_book_chapter.rb +93 -52
- data/test/test_builder.rb +24 -15
- data/test/test_converter.rb +1 -0
- data/test/test_epub3maker.rb +2 -2
- data/test/test_epubmaker.rb +8 -0
- data/test/test_helper.rb +4 -1
- data/test/test_htmlbuilder.rb +627 -56
- data/test/test_htmlutils.rb +0 -12
- data/test/test_i18n.rb +33 -33
- data/test/test_idgxmlbuilder.rb +358 -11
- data/test/test_idgxmlmaker_cmd.rb +1 -1
- data/test/test_index.rb +62 -52
- data/test/test_indexbuilder.rb +52 -0
- data/test/test_latexbuilder.rb +547 -10
- data/test/test_latexbuilder_v2.rb +43 -5
- data/test/test_logger.rb +7 -7
- data/test/test_makerhelper.rb +0 -12
- data/test/test_markdownbuilder.rb +3 -0
- data/test/test_pdfmaker.rb +13 -12
- data/test/test_pdfmaker_cmd.rb +1 -1
- data/test/test_plaintextbuilder.rb +422 -7
- data/test/test_review_ext.rb +2 -1
- data/test/test_rstbuilder.rb +25 -1
- data/test/test_sec_counter.rb +156 -0
- data/test/test_textmaker_cmd.rb +1 -1
- data/test/test_topbuilder.rb +187 -10
- data/test/test_update.rb +10 -10
- data/test/test_webtocprinter.rb +12 -12
- data/vendor/gentombow/LICENSE +1 -1
- data/vendor/gentombow/Makefile +0 -1
- data/vendor/gentombow/bounddvi-en.pdf +0 -0
- data/vendor/gentombow/bounddvi-en.tex +1 -0
- data/vendor/gentombow/bounddvi.pdf +0 -0
- data/vendor/gentombow/bounddvi.sty +30 -7
- data/vendor/gentombow/bounddvi.tex +1 -0
- data/vendor/gentombow/create_archive.sh +1 -0
- data/vendor/gentombow/gentombow-ja.pdf +0 -0
- data/vendor/gentombow/gentombow-ja.tex +9 -0
- data/vendor/gentombow/gentombow.pdf +0 -0
- data/vendor/gentombow/gentombow.sty +32 -10
- data/vendor/gentombow/gentombow.tex +8 -0
- data/vendor/gentombow/tests/gentombow-01-pdfx.tex +8 -0
- data/vendor/gentombow/tests/gentombow-02-pdfx.tex +8 -0
- data/vendor/jsclasses/Makefile +3 -2
- data/vendor/jsclasses/create_archive.sh +5 -5
- data/vendor/jsclasses/jis/Makefile +3 -2
- data/vendor/jsclasses/jis/jsarticle.cls +22 -18
- data/vendor/jsclasses/jis/jsbook.cls +22 -18
- data/vendor/jsclasses/jis/jsclasses.dtx +94 -13
- data/vendor/jsclasses/jis/jsclasses.ins +15 -5
- data/vendor/jsclasses/jis/jslogo.ins +9 -0
- data/vendor/jsclasses/jis/jslogo.sty +1 -13
- data/vendor/jsclasses/jis/jspf.cls +22 -18
- data/vendor/jsclasses/jis/jsreport.cls +22 -18
- data/vendor/jsclasses/jis/jsverb.ins +9 -0
- data/vendor/jsclasses/jis/jsverb.sty +1 -13
- data/vendor/jsclasses/jis/kiyou.cls +22 -18
- data/vendor/jsclasses/jis/minijs.sty +65 -22
- data/vendor/jsclasses/jis/okumacro.ins +9 -0
- data/vendor/jsclasses/jis/okumacro.sty +1 -13
- data/vendor/jsclasses/jis/okuverb.ins +9 -0
- data/vendor/jsclasses/jis/okuverb.sty +1 -13
- data/vendor/jsclasses/jis/winjis.sty +23 -19
- data/vendor/jsclasses/jsarticle.cls +22 -18
- data/vendor/jsclasses/jsbook.cls +22 -18
- data/vendor/jsclasses/jsclasses.dtx +94 -13
- data/vendor/jsclasses/jsclasses.ins +15 -5
- data/vendor/jsclasses/jsclasses.pdf +0 -0
- data/vendor/jsclasses/jslogo.ins +9 -0
- data/vendor/jsclasses/jslogo.pdf +0 -0
- data/vendor/jsclasses/jslogo.sty +1 -13
- data/vendor/jsclasses/jspf.cls +22 -18
- data/vendor/jsclasses/jsreport.cls +22 -18
- data/vendor/jsclasses/jsverb.ins +9 -0
- data/vendor/jsclasses/jsverb.pdf +0 -0
- data/vendor/jsclasses/jsverb.sty +1 -13
- data/vendor/jsclasses/kiyou.cls +22 -18
- data/vendor/jsclasses/minijs.sty +68 -22
- data/vendor/jsclasses/okumacro.ins +9 -0
- data/vendor/jsclasses/okumacro.pdf +0 -0
- data/vendor/jsclasses/okumacro.sty +1 -13
- data/vendor/jsclasses/okuverb.ins +9 -0
- data/vendor/jsclasses/okuverb.pdf +0 -0
- data/vendor/jsclasses/okuverb.sty +1 -13
- data/vendor/jsclasses/tests/relfont.tex +10 -0
- data/vendor/jsclasses/winjis.sty +23 -19
- metadata +14 -6
- data/.rubocop_todo.yml +0 -7
- data/lib/review/book/compilable.rb +0 -174
data/test/test_htmlutils.rb
CHANGED
|
@@ -17,18 +17,6 @@ class HTMLUtilsTest < Test::Unit::TestCase
|
|
|
17
17
|
assert_equal '&', unescape('&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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
244
|
-
|
|
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)
|
data/test/test_idgxmlbuilder.rb
CHANGED
|
@@ -155,10 +155,10 @@ EOS
|
|
|
155
155
|
end
|
|
156
156
|
|
|
157
157
|
def test_empty_table
|
|
158
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
|
158
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n//}\n") }
|
|
159
159
|
assert_equal ':2: error: no rows in the table', e.message
|
|
160
160
|
|
|
161
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
|
161
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n------------\n//}\n") }
|
|
162
162
|
assert_equal ':3: error: no rows in the table', e.message
|
|
163
163
|
end
|
|
164
164
|
|
|
@@ -252,9 +252,7 @@ EOS
|
|
|
252
252
|
end
|
|
253
253
|
|
|
254
254
|
def test_dt_inline
|
|
255
|
-
|
|
256
|
-
@chapter.instance_eval { @footnote_index = fn }
|
|
257
|
-
actual = compile_block(" : foo@<fn>{bar}[]<>&@<m>$\\alpha[]$\n")
|
|
255
|
+
actual = compile_block("//footnote[bar][bar]\n\n : foo@<fn>{bar}[]<>&@<m>$\\alpha[]$\n")
|
|
258
256
|
|
|
259
257
|
expected = <<-EOS.chomp
|
|
260
258
|
<dl><dt>foo<footnote>bar</footnote>[]<>&<replace idref="texinline-1"><pre>\\alpha[]</pre></replace></dt><dd></dd></dl>
|
|
@@ -324,6 +322,145 @@ EOS
|
|
|
324
322
|
assert_equal expected, actual
|
|
325
323
|
end
|
|
326
324
|
|
|
325
|
+
def test_minicolumn_blocks
|
|
326
|
+
%w[note memo tip info warning important caution notice].each do |type|
|
|
327
|
+
src = <<-EOS
|
|
328
|
+
//#{type}[#{type}1]{
|
|
329
|
+
|
|
330
|
+
//}
|
|
331
|
+
|
|
332
|
+
//#{type}[#{type}2]{
|
|
333
|
+
//}
|
|
334
|
+
EOS
|
|
335
|
+
|
|
336
|
+
if type == 'notice' # exception pattern
|
|
337
|
+
expected = <<-EOS.chomp
|
|
338
|
+
<#{type}-t><title aid:pstyle='#{type}-title'>#{type}1</title></#{type}-t><#{type}-t><title aid:pstyle='#{type}-title'>#{type}2</title></#{type}-t>
|
|
339
|
+
EOS
|
|
340
|
+
else
|
|
341
|
+
expected = <<-EOS.chomp
|
|
342
|
+
<#{type}><title aid:pstyle='#{type}-title'>#{type}1</title></#{type}><#{type}><title aid:pstyle='#{type}-title'>#{type}2</title></#{type}>
|
|
343
|
+
EOS
|
|
344
|
+
end
|
|
345
|
+
assert_equal expected, compile_block(src)
|
|
346
|
+
|
|
347
|
+
src = <<-EOS
|
|
348
|
+
//#{type}[#{type}2]{
|
|
349
|
+
|
|
350
|
+
//}
|
|
351
|
+
|
|
352
|
+
//#{type}[#{type}3]{
|
|
353
|
+
|
|
354
|
+
//}
|
|
355
|
+
|
|
356
|
+
//#{type}[#{type}4]{
|
|
357
|
+
|
|
358
|
+
//}
|
|
359
|
+
|
|
360
|
+
//#{type}[#{type}5]{
|
|
361
|
+
|
|
362
|
+
//}
|
|
363
|
+
|
|
364
|
+
//#{type}[#{type}6]{
|
|
365
|
+
|
|
366
|
+
//}
|
|
367
|
+
EOS
|
|
368
|
+
|
|
369
|
+
if type == 'notice' # exception pattern
|
|
370
|
+
expected = <<-EOS.chomp
|
|
371
|
+
<#{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>
|
|
372
|
+
EOS
|
|
373
|
+
else
|
|
374
|
+
expected = <<-EOS.chomp
|
|
375
|
+
<#{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}>
|
|
376
|
+
EOS
|
|
377
|
+
end
|
|
378
|
+
assert_equal expected, compile_block(src)
|
|
379
|
+
|
|
380
|
+
src = <<-EOS
|
|
381
|
+
//#{type}{
|
|
382
|
+
|
|
383
|
+
* A
|
|
384
|
+
|
|
385
|
+
1. B
|
|
386
|
+
|
|
387
|
+
//}
|
|
388
|
+
|
|
389
|
+
//#{type}[OMITEND1]{
|
|
390
|
+
|
|
391
|
+
//emlist{
|
|
392
|
+
LIST
|
|
393
|
+
//}
|
|
394
|
+
|
|
395
|
+
//}
|
|
396
|
+
//#{type}[OMITEND2]{
|
|
397
|
+
//}
|
|
398
|
+
EOS
|
|
399
|
+
|
|
400
|
+
if type == 'notice' # exception pattern
|
|
401
|
+
expected = <<-EOS.chomp
|
|
402
|
+
<#{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
|
|
403
|
+
</pre></list></#{type}-t><#{type}-t><title aid:pstyle='#{type}-title'>OMITEND2</title></#{type}-t>
|
|
404
|
+
EOS
|
|
405
|
+
else
|
|
406
|
+
expected = <<-EOS.chomp
|
|
407
|
+
<#{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
|
|
408
|
+
</pre></list></#{type}><#{type}><title aid:pstyle='#{type}-title'>OMITEND2</title></#{type}>
|
|
409
|
+
EOS
|
|
410
|
+
end
|
|
411
|
+
assert_equal expected, compile_block(src)
|
|
412
|
+
end
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
def test_minicolumn_blocks_nest_error1
|
|
416
|
+
%w[note memo tip info warning important caution notice].each do |type|
|
|
417
|
+
@builder.doc_status.clear
|
|
418
|
+
src = <<-EOS
|
|
419
|
+
//#{type}{
|
|
420
|
+
|
|
421
|
+
//#{type}{
|
|
422
|
+
//}
|
|
423
|
+
|
|
424
|
+
//}
|
|
425
|
+
EOS
|
|
426
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
|
427
|
+
assert_match(/minicolumn cannot be nested:/, e.message)
|
|
428
|
+
end
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
def test_minicolumn_blocks_nest_error2
|
|
432
|
+
%w[note memo tip info warning important caution notice].each do |type|
|
|
433
|
+
@builder.doc_status.clear
|
|
434
|
+
src = <<-EOS
|
|
435
|
+
//#{type}{
|
|
436
|
+
|
|
437
|
+
//#{type}{
|
|
438
|
+
|
|
439
|
+
//}
|
|
440
|
+
|
|
441
|
+
//}
|
|
442
|
+
EOS
|
|
443
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
|
444
|
+
assert_match(/minicolumn cannot be nested:/, e.message)
|
|
445
|
+
end
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
def test_minicolumn_blocks_nest_error3
|
|
449
|
+
%w[memo tip info warning important caution notice].each do |type|
|
|
450
|
+
@builder.doc_status.clear
|
|
451
|
+
src = <<-EOS
|
|
452
|
+
//#{type}{
|
|
453
|
+
|
|
454
|
+
//note{
|
|
455
|
+
//}
|
|
456
|
+
|
|
457
|
+
//}
|
|
458
|
+
EOS
|
|
459
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
|
460
|
+
assert_match(/minicolumn cannot be nested:/, e.message)
|
|
461
|
+
end
|
|
462
|
+
end
|
|
463
|
+
|
|
327
464
|
def test_term
|
|
328
465
|
actual = compile_block("//term{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
|
329
466
|
assert_equal '<term><p>test1test1.5</p><p>test<i>2</i></p></term>', actual
|
|
@@ -847,10 +984,16 @@ inside column
|
|
|
847
984
|
this is @<column>{foo}.
|
|
848
985
|
EOS
|
|
849
986
|
expected = <<-EOS.chomp
|
|
850
|
-
<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
|
|
987
|
+
<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>
|
|
851
988
|
EOS
|
|
852
989
|
|
|
853
990
|
assert_equal expected, column_helper(review)
|
|
991
|
+
|
|
992
|
+
@config['chapterlink'] = nil
|
|
993
|
+
expected = <<-EOS.chomp
|
|
994
|
+
<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>
|
|
995
|
+
EOS
|
|
996
|
+
assert_equal expected, column_helper(review)
|
|
854
997
|
end
|
|
855
998
|
|
|
856
999
|
def test_column_in_aother_chapter_ref
|
|
@@ -861,6 +1004,11 @@ EOS
|
|
|
861
1004
|
idx
|
|
862
1005
|
end
|
|
863
1006
|
|
|
1007
|
+
actual = compile_inline('test @<column>{chap1|column} test2')
|
|
1008
|
+
expected = 'test <link href="column-1">コラム「column_cap」</link> test2'
|
|
1009
|
+
assert_equal expected, actual
|
|
1010
|
+
|
|
1011
|
+
@config['chapterlink'] = nil
|
|
864
1012
|
actual = compile_inline('test @<column>{chap1|column} test2')
|
|
865
1013
|
expected = 'test コラム「column_cap」 test2'
|
|
866
1014
|
assert_equal expected, actual
|
|
@@ -970,18 +1118,18 @@ EOS
|
|
|
970
1118
|
end
|
|
971
1119
|
|
|
972
1120
|
def test_inline_unknown
|
|
973
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
|
1121
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<img>{n}\n") }
|
|
974
1122
|
assert_equal ':1: error: unknown image: n', e.message
|
|
975
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
|
1123
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<fn>{n}\n") }
|
|
976
1124
|
assert_equal ':1: error: unknown footnote: n', e.message
|
|
977
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
|
1125
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<hd>{n}\n") }
|
|
978
1126
|
assert_equal ':1: error: unknown headline: n', e.message
|
|
979
1127
|
%w[list table column].each do |name|
|
|
980
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
|
1128
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
|
|
981
1129
|
assert_equal ":1: error: unknown #{name}: n", e.message
|
|
982
1130
|
end
|
|
983
1131
|
%w[chap chapref title].each do |name|
|
|
984
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
|
1132
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
|
|
985
1133
|
assert_equal ':1: error: key not found: "n"', e.message
|
|
986
1134
|
end
|
|
987
1135
|
end
|
|
@@ -1116,4 +1264,203 @@ EOS
|
|
|
1116
1264
|
actual = compile_block(src)
|
|
1117
1265
|
assert_equal expected, actual
|
|
1118
1266
|
end
|
|
1267
|
+
|
|
1268
|
+
def test_nest_error_close1
|
|
1269
|
+
src = <<-EOS
|
|
1270
|
+
//beginchild
|
|
1271
|
+
EOS
|
|
1272
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
|
1273
|
+
assert_equal ":1: error: //beginchild is shown, but previous element isn't ul, ol, or dl", e.message
|
|
1274
|
+
end
|
|
1275
|
+
|
|
1276
|
+
def test_nest_error_close2
|
|
1277
|
+
src = <<-EOS
|
|
1278
|
+
* foo
|
|
1279
|
+
|
|
1280
|
+
//beginchild
|
|
1281
|
+
|
|
1282
|
+
1. foo
|
|
1283
|
+
|
|
1284
|
+
//beginchild
|
|
1285
|
+
|
|
1286
|
+
: foo
|
|
1287
|
+
|
|
1288
|
+
//beginchild
|
|
1289
|
+
EOS
|
|
1290
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
|
1291
|
+
assert_equal ':12: error: //beginchild of dl,ol,ul misses //endchild', e.message
|
|
1292
|
+
end
|
|
1293
|
+
|
|
1294
|
+
def test_nest_error_close3
|
|
1295
|
+
src = <<-EOS
|
|
1296
|
+
* foo
|
|
1297
|
+
|
|
1298
|
+
//beginchild
|
|
1299
|
+
|
|
1300
|
+
1. foo
|
|
1301
|
+
|
|
1302
|
+
//beginchild
|
|
1303
|
+
|
|
1304
|
+
: foo
|
|
1305
|
+
|
|
1306
|
+
//beginchild
|
|
1307
|
+
|
|
1308
|
+
//endchild
|
|
1309
|
+
EOS
|
|
1310
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
|
1311
|
+
assert_equal ':14: error: //beginchild of ol,ul misses //endchild', e.message
|
|
1312
|
+
end
|
|
1313
|
+
|
|
1314
|
+
def test_nest_ul
|
|
1315
|
+
src = <<-EOS
|
|
1316
|
+
* UL1
|
|
1317
|
+
|
|
1318
|
+
//beginchild
|
|
1319
|
+
|
|
1320
|
+
1. UL1-OL1
|
|
1321
|
+
2. UL1-OL2
|
|
1322
|
+
|
|
1323
|
+
* UL1-UL1
|
|
1324
|
+
* UL1-UL2
|
|
1325
|
+
|
|
1326
|
+
: UL1-DL1
|
|
1327
|
+
UL1-DD1
|
|
1328
|
+
: UL1-DL2
|
|
1329
|
+
UL1-DD2
|
|
1330
|
+
|
|
1331
|
+
//endchild
|
|
1332
|
+
|
|
1333
|
+
* UL2
|
|
1334
|
+
|
|
1335
|
+
//beginchild
|
|
1336
|
+
|
|
1337
|
+
UL2-PARA
|
|
1338
|
+
|
|
1339
|
+
//endchild
|
|
1340
|
+
EOS
|
|
1341
|
+
|
|
1342
|
+
expected = <<-EOS.chomp
|
|
1343
|
+
<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>
|
|
1344
|
+
EOS
|
|
1345
|
+
|
|
1346
|
+
actual = compile_block(src)
|
|
1347
|
+
assert_equal expected, actual
|
|
1348
|
+
end
|
|
1349
|
+
|
|
1350
|
+
def test_nest_ol
|
|
1351
|
+
src = <<-EOS
|
|
1352
|
+
1. OL1
|
|
1353
|
+
|
|
1354
|
+
//beginchild
|
|
1355
|
+
|
|
1356
|
+
1. OL1-OL1
|
|
1357
|
+
2. OL1-OL2
|
|
1358
|
+
|
|
1359
|
+
* OL1-UL1
|
|
1360
|
+
* OL1-UL2
|
|
1361
|
+
|
|
1362
|
+
: OL1-DL1
|
|
1363
|
+
OL1-DD1
|
|
1364
|
+
: OL1-DL2
|
|
1365
|
+
OL1-DD2
|
|
1366
|
+
|
|
1367
|
+
//endchild
|
|
1368
|
+
|
|
1369
|
+
2. OL2
|
|
1370
|
+
|
|
1371
|
+
//beginchild
|
|
1372
|
+
|
|
1373
|
+
OL2-PARA
|
|
1374
|
+
|
|
1375
|
+
//endchild
|
|
1376
|
+
EOS
|
|
1377
|
+
|
|
1378
|
+
expected = <<-EOS.chomp
|
|
1379
|
+
<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>
|
|
1380
|
+
EOS
|
|
1381
|
+
|
|
1382
|
+
actual = compile_block(src)
|
|
1383
|
+
assert_equal expected, actual
|
|
1384
|
+
end
|
|
1385
|
+
|
|
1386
|
+
def test_nest_dl
|
|
1387
|
+
src = <<-EOS
|
|
1388
|
+
: DL1
|
|
1389
|
+
|
|
1390
|
+
//beginchild
|
|
1391
|
+
|
|
1392
|
+
1. DL1-OL1
|
|
1393
|
+
2. DL1-OL2
|
|
1394
|
+
|
|
1395
|
+
* DL1-UL1
|
|
1396
|
+
* DL1-UL2
|
|
1397
|
+
|
|
1398
|
+
: DL1-DL1
|
|
1399
|
+
DL1-DD1
|
|
1400
|
+
: DL1-DL2
|
|
1401
|
+
DL1-DD2
|
|
1402
|
+
|
|
1403
|
+
//endchild
|
|
1404
|
+
|
|
1405
|
+
: DL2
|
|
1406
|
+
DD2
|
|
1407
|
+
|
|
1408
|
+
//beginchild
|
|
1409
|
+
|
|
1410
|
+
* DD2-UL1
|
|
1411
|
+
* DD2-UL2
|
|
1412
|
+
|
|
1413
|
+
DD2-PARA
|
|
1414
|
+
|
|
1415
|
+
//endchild
|
|
1416
|
+
EOS
|
|
1417
|
+
|
|
1418
|
+
expected = <<-EOS.chomp
|
|
1419
|
+
<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>
|
|
1420
|
+
EOS
|
|
1421
|
+
|
|
1422
|
+
actual = compile_block(src)
|
|
1423
|
+
assert_equal expected, actual
|
|
1424
|
+
end
|
|
1425
|
+
|
|
1426
|
+
def test_nest_multi
|
|
1427
|
+
src = <<-EOS
|
|
1428
|
+
1. OL1
|
|
1429
|
+
|
|
1430
|
+
//beginchild
|
|
1431
|
+
|
|
1432
|
+
1. OL1-OL1
|
|
1433
|
+
|
|
1434
|
+
//beginchild
|
|
1435
|
+
|
|
1436
|
+
* OL1-OL1-UL1
|
|
1437
|
+
|
|
1438
|
+
OL1-OL1-PARA
|
|
1439
|
+
|
|
1440
|
+
//endchild
|
|
1441
|
+
|
|
1442
|
+
2. OL1-OL2
|
|
1443
|
+
|
|
1444
|
+
* OL1-UL1
|
|
1445
|
+
|
|
1446
|
+
//beginchild
|
|
1447
|
+
|
|
1448
|
+
: OL1-UL1-DL1
|
|
1449
|
+
OL1-UL1-DD1
|
|
1450
|
+
|
|
1451
|
+
OL1-UL1-PARA
|
|
1452
|
+
|
|
1453
|
+
//endchild
|
|
1454
|
+
|
|
1455
|
+
* OL1-UL2
|
|
1456
|
+
|
|
1457
|
+
//endchild
|
|
1458
|
+
EOS
|
|
1459
|
+
expected = <<-EOS.chomp
|
|
1460
|
+
<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>
|
|
1461
|
+
EOS
|
|
1462
|
+
|
|
1463
|
+
actual = compile_block(src)
|
|
1464
|
+
assert_equal expected, actual
|
|
1465
|
+
end
|
|
1119
1466
|
end
|