review 3.1.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby-win.yml +45 -0
- data/.github/workflows/ruby.yml +27 -0
- data/.rubocop.yml +161 -34
- data/.travis.yml +16 -15
- data/Dockerfile +21 -5
- data/NEWS.ja.md +394 -0
- data/NEWS.md +395 -1
- data/README.md +10 -7
- data/appveyor.yml +1 -3
- data/bin/review-catalog-converter +5 -5
- data/bin/review-check +10 -12
- data/bin/review-checkdep +2 -2
- data/bin/review-compile +17 -23
- data/bin/review-epubmaker +3 -35
- data/bin/review-idgxmlmaker +16 -0
- data/bin/review-index +2 -89
- data/bin/review-preproc +13 -13
- data/bin/review-validate +4 -4
- data/bin/review-vol +4 -78
- data/doc/config.yml.sample +47 -12
- data/doc/config.yml.sample-simple +3 -2
- data/doc/format.ja.md +120 -17
- data/doc/format.md +119 -27
- data/doc/makeindex.ja.md +2 -2
- data/doc/pdfmaker.ja.md +43 -1
- data/doc/pdfmaker.md +42 -1
- data/doc/quickstart.ja.md +45 -25
- data/doc/quickstart.md +37 -16
- data/lib/epubmaker/content.rb +3 -2
- data/lib/epubmaker/epubcommon.rb +34 -27
- data/lib/epubmaker/epubv2.rb +5 -6
- data/lib/epubmaker/epubv3.rb +21 -18
- data/lib/epubmaker/producer.rb +2 -1
- data/lib/review/book.rb +2 -2
- data/lib/review/book/base.rb +91 -96
- data/lib/review/book/bib.rb +21 -0
- data/lib/review/book/book_unit.rb +155 -0
- data/lib/review/book/chapter.rb +48 -29
- data/lib/review/book/index.rb +46 -240
- data/lib/review/book/index/item.rb +46 -0
- data/lib/review/book/page_metric.rb +7 -7
- data/lib/review/book/part.rb +45 -10
- data/lib/review/book/volume.rb +4 -5
- data/lib/review/builder.rb +172 -56
- data/lib/review/catalog.rb +14 -17
- data/lib/review/compiler.rb +219 -121
- data/lib/review/configure.rb +39 -7
- data/lib/review/converter.rb +1 -1
- data/lib/review/epub2html.rb +43 -5
- data/lib/review/epubmaker.rb +69 -27
- data/lib/review/extentions/string.rb +0 -4
- data/lib/review/htmlbuilder.rb +112 -101
- data/lib/review/htmlutils.rb +9 -13
- data/lib/review/i18n.rb +3 -3
- data/lib/review/idgxmlbuilder.rb +202 -78
- data/lib/review/idgxmlmaker.rb +186 -0
- data/lib/review/index_builder.rb +653 -0
- data/lib/review/init-web/finish.html +10 -0
- data/lib/review/init-web/index.html +190 -0
- data/lib/review/init-web/review-layout-design.js +691 -0
- data/lib/review/init.rb +129 -46
- data/lib/review/latexbuilder.rb +255 -92
- data/lib/review/lineinput.rb +1 -1
- data/lib/review/location.rb +32 -0
- data/lib/review/logger.rb +4 -8
- data/lib/review/makerhelper.rb +35 -5
- data/lib/review/markdownbuilder.rb +50 -38
- data/lib/review/md2inaobuilder.rb +3 -5
- data/lib/review/pdfmaker.rb +60 -57
- data/lib/review/plaintextbuilder.rb +154 -87
- data/lib/review/preprocessor.rb +20 -42
- data/lib/review/rstbuilder.rb +57 -38
- data/lib/review/sec_counter.rb +13 -0
- data/lib/review/textmaker.rb +23 -15
- data/lib/review/textutils.rb +76 -2
- data/lib/review/tocprinter.rb +230 -102
- data/lib/review/topbuilder.rb +139 -60
- data/lib/review/update.rb +24 -24
- data/lib/review/version.rb +1 -1
- data/lib/review/volumeprinter.rb +98 -0
- data/lib/review/webmaker.rb +20 -24
- data/lib/review/webtocprinter.rb +38 -35
- data/lib/review/yamlloader.rb +26 -16
- data/review.gemspec +6 -4
- data/samples/sample-book/README.md +7 -2
- data/samples/sample-book/src/.gitignore +154 -0
- data/samples/sample-book/src/config-ebook.yml +4 -0
- data/samples/sample-book/src/config-jlreq-ebook.yml +4 -0
- data/samples/sample-book/src/config-jlreq.yml +6 -0
- data/samples/sample-book/src/config.yml +2 -2
- data/samples/sample-book/src/lib/tasks/review.rake +29 -14
- data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +14 -8
- data/samples/syntax-book/Gemfile +1 -1
- data/samples/syntax-book/ch01.re +4 -2
- data/samples/syntax-book/ch02.re +8 -16
- data/samples/syntax-book/ch03.re +3 -6
- data/samples/syntax-book/config-jlreq-lualatex.yml +4 -0
- data/samples/syntax-book/config-jlreq.yml +5 -0
- data/samples/syntax-book/config-print.yml +3 -0
- data/samples/syntax-book/config.yml +1 -1
- data/samples/syntax-book/lib/tasks/review.rake +30 -15
- data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +14 -8
- data/templates/latex/config.erb +39 -25
- data/templates/latex/layout.tex.erb +1 -0
- data/templates/latex/review-jlreq/README.md +3 -1
- data/templates/latex/review-jlreq/review-base.sty +161 -50
- data/templates/latex/review-jlreq/review-jlreq.cls +21 -22
- data/templates/latex/review-jlreq/review-style.sty +4 -1
- data/templates/latex/review-jsbook/README.md +46 -5
- data/templates/latex/review-jsbook/review-base.sty +123 -35
- data/templates/latex/review-jsbook/review-jsbook.cls +10 -4
- data/templates/latex/review-jsbook/review-style.sty +5 -2
- data/templates/opf/epubv3.opf.erb +1 -0
- data/templates/web/html/layout-html5.html.erb +3 -3
- data/test/assets/test_template.tex +19 -7
- data/test/assets/test_template_backmatter.tex +19 -7
- data/test/book_test_helper.rb +11 -5
- data/test/test_book.rb +124 -79
- data/test/test_book_chapter.rb +97 -54
- data/test/test_book_part.rb +3 -3
- data/test/test_builder.rb +38 -13
- data/test/test_catalog.rb +24 -42
- data/test/test_catalog_converter_cmd.rb +1 -1
- data/test/test_converter.rb +1 -0
- data/test/test_epub3maker.rb +2 -2
- data/test/test_epubmaker.rb +8 -0
- data/test/test_epubmaker_cmd.rb +14 -7
- data/test/test_helper.rb +18 -7
- data/test/test_htmlbuilder.rb +1491 -205
- data/test/test_htmlutils.rb +0 -12
- data/test/test_i18n.rb +37 -37
- data/test/test_idgxmlbuilder.rb +744 -42
- data/test/test_idgxmlmaker_cmd.rb +46 -0
- data/test/test_image_finder.rb +52 -70
- data/test/test_index.rb +94 -44
- data/test/test_indexbuilder.rb +52 -0
- data/test/test_latexbuilder.rb +1784 -161
- data/test/test_latexbuilder_v2.rb +671 -102
- data/test/test_logger.rb +17 -4
- data/test/test_makerhelper.rb +2 -14
- data/test/test_markdownbuilder.rb +137 -16
- data/test/test_md2inaobuilder.rb +32 -9
- data/test/test_pdfmaker.rb +30 -12
- data/test/test_pdfmaker_cmd.rb +100 -6
- data/test/test_plaintextbuilder.rb +791 -30
- data/test/test_preprocessor.rb +2 -16
- data/test/test_review_ext.rb +2 -1
- data/test/test_rstbuilder.rb +274 -27
- data/test/test_sec_counter.rb +156 -0
- data/test/test_textmaker_cmd.rb +54 -0
- data/test/test_textutils.rb +109 -2
- data/test/test_topbuilder.rb +724 -34
- data/test/test_update.rb +20 -11
- data/test/test_webtocprinter.rb +75 -43
- data/test/test_yamlloader.rb +13 -0
- 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/LICENSE +1 -1
- 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 +74 -31
- data/vendor/jsclasses/jis/jsbook.cls +74 -31
- data/vendor/jsclasses/jis/jsclasses.dtx +176 -36
- data/vendor/jsclasses/jis/jsclasses.ins +15 -5
- data/vendor/jsclasses/jis/jslogo.dtx +4 -4
- data/vendor/jsclasses/jis/jslogo.ins +9 -0
- data/vendor/jsclasses/jis/jslogo.sty +4 -16
- data/vendor/jsclasses/jis/jspf.cls +73 -30
- data/vendor/jsclasses/jis/jsreport.cls +74 -31
- data/vendor/jsclasses/jis/jsverb.ins +9 -0
- data/vendor/jsclasses/jis/jsverb.sty +1 -13
- data/vendor/jsclasses/jis/kiyou.cls +74 -31
- data/vendor/jsclasses/jis/minijs.sty +65 -22
- data/vendor/jsclasses/jis/okumacro.dtx +4 -5
- data/vendor/jsclasses/jis/okumacro.ins +9 -0
- data/vendor/jsclasses/jis/okumacro.sty +4 -17
- 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 +74 -31
- data/vendor/jsclasses/jsbook.cls +74 -31
- data/vendor/jsclasses/jsclasses.dtx +176 -36
- data/vendor/jsclasses/jsclasses.ins +15 -5
- data/vendor/jsclasses/jsclasses.pdf +0 -0
- data/vendor/jsclasses/jslogo.dtx +4 -4
- data/vendor/jsclasses/jslogo.ins +9 -0
- data/vendor/jsclasses/jslogo.pdf +0 -0
- data/vendor/jsclasses/jslogo.sty +4 -16
- data/vendor/jsclasses/jspf.cls +73 -30
- data/vendor/jsclasses/jsreport.cls +74 -31
- 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 +74 -31
- data/vendor/jsclasses/minijs.sty +68 -22
- data/vendor/jsclasses/okumacro.dtx +4 -5
- data/vendor/jsclasses/okumacro.ins +9 -0
- data/vendor/jsclasses/okumacro.pdf +0 -0
- data/vendor/jsclasses/okumacro.sty +4 -17
- 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 +65 -12
- data/.rubocop_todo.yml +0 -7
- data/lib/review/book/compilable.rb +0 -173
- data/lib/review/tocparser.rb +0 -271
- data/samples/syntax-book/review-ext.rb +0 -14
- data/test/test_tocparser.rb +0 -25
@@ -0,0 +1,156 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'book_test_helper'
|
3
|
+
require 'review/sec_counter'
|
4
|
+
|
5
|
+
class SecCounterTest < Test::Unit::TestCase
|
6
|
+
include ReVIEW
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@book = Book::Base.new
|
10
|
+
@io = StringIO.new("= sample\n\n")
|
11
|
+
@chapter = Book::Chapter.new(@book, 1, 'foo', '-', @io)
|
12
|
+
@part = Book::Part.new(@book, 1, [], 'name')
|
13
|
+
I18n.setup
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_initialize
|
17
|
+
@sec_counter = SecCounter.new(5, @chapter)
|
18
|
+
assert_equal('1', @sec_counter.anchor(0))
|
19
|
+
assert_equal('1', @sec_counter.anchor(1))
|
20
|
+
assert_equal('1-0', @sec_counter.anchor(2))
|
21
|
+
assert_equal('1-0-0', @sec_counter.anchor(3))
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_anchor1
|
25
|
+
@sec_counter = SecCounter.new(5, @chapter)
|
26
|
+
@sec_counter.inc(3)
|
27
|
+
assert_equal('1', @sec_counter.anchor(0))
|
28
|
+
assert_equal('1', @sec_counter.anchor(1))
|
29
|
+
assert_equal('1-0', @sec_counter.anchor(2))
|
30
|
+
assert_equal('1-0-1', @sec_counter.anchor(3))
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_anchor2
|
34
|
+
@sec_counter = SecCounter.new(5, @chapter)
|
35
|
+
@sec_counter.inc(2)
|
36
|
+
@sec_counter.inc(3)
|
37
|
+
@sec_counter.inc(3)
|
38
|
+
@sec_counter.inc(4)
|
39
|
+
assert_equal('1', @sec_counter.anchor(0))
|
40
|
+
assert_equal('1', @sec_counter.anchor(1))
|
41
|
+
assert_equal('1-1', @sec_counter.anchor(2))
|
42
|
+
assert_equal('1-1-2', @sec_counter.anchor(3))
|
43
|
+
assert_equal('1-1-2-1', @sec_counter.anchor(4))
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_anchor3
|
47
|
+
@sec_counter = SecCounter.new(5, @chapter)
|
48
|
+
@sec_counter.inc(2)
|
49
|
+
@sec_counter.inc(3)
|
50
|
+
@sec_counter.inc(3)
|
51
|
+
@sec_counter.inc(4)
|
52
|
+
@sec_counter.inc(3)
|
53
|
+
assert_equal('1', @sec_counter.anchor(0))
|
54
|
+
assert_equal('1', @sec_counter.anchor(1))
|
55
|
+
assert_equal('1-1', @sec_counter.anchor(2))
|
56
|
+
assert_equal('1-1-3', @sec_counter.anchor(3))
|
57
|
+
assert_equal('1-1-3-0', @sec_counter.anchor(4))
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_anchor4
|
61
|
+
@sec_counter = SecCounter.new(5, @chapter)
|
62
|
+
@sec_counter.inc(2)
|
63
|
+
@sec_counter.inc(2)
|
64
|
+
@sec_counter.inc(2)
|
65
|
+
@sec_counter.inc(3)
|
66
|
+
@sec_counter.inc(3)
|
67
|
+
assert_equal('1', @sec_counter.anchor(0))
|
68
|
+
assert_equal('1', @sec_counter.anchor(1))
|
69
|
+
assert_equal('1-3', @sec_counter.anchor(2))
|
70
|
+
assert_equal('1-3-2', @sec_counter.anchor(3))
|
71
|
+
assert_equal('1-3-2-0', @sec_counter.anchor(4))
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_anchor_part1
|
75
|
+
@sec_counter = SecCounter.new(5, @part)
|
76
|
+
@sec_counter.inc(3)
|
77
|
+
assert_equal('1', @sec_counter.anchor(0))
|
78
|
+
assert_equal('1', @sec_counter.anchor(1))
|
79
|
+
assert_equal('1-0', @sec_counter.anchor(2))
|
80
|
+
assert_equal('1-0-1', @sec_counter.anchor(3))
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_anchor_part3
|
84
|
+
@sec_counter = SecCounter.new(5, @part)
|
85
|
+
@sec_counter.inc(2)
|
86
|
+
@sec_counter.inc(3)
|
87
|
+
@sec_counter.inc(3)
|
88
|
+
@sec_counter.inc(4)
|
89
|
+
@sec_counter.inc(3)
|
90
|
+
assert_equal('1', @sec_counter.anchor(0))
|
91
|
+
assert_equal('1', @sec_counter.anchor(1))
|
92
|
+
assert_equal('1-1', @sec_counter.anchor(2))
|
93
|
+
assert_equal('1-1-3', @sec_counter.anchor(3))
|
94
|
+
assert_equal('1-1-3-0', @sec_counter.anchor(4))
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_prefix1
|
98
|
+
@sec_counter = SecCounter.new(5, @chapter)
|
99
|
+
@sec_counter.inc(2)
|
100
|
+
assert_equal('1.1 ', @sec_counter.prefix(2, 3))
|
101
|
+
assert_equal('1.1.0 ', @sec_counter.prefix(3, 3))
|
102
|
+
assert_equal('1.1.0 ', @sec_counter.prefix(3, 5))
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_prefix2
|
106
|
+
@sec_counter = SecCounter.new(5, @chapter)
|
107
|
+
@sec_counter.inc(2)
|
108
|
+
@sec_counter.inc(3)
|
109
|
+
@sec_counter.inc(3)
|
110
|
+
@sec_counter.inc(4)
|
111
|
+
assert_equal('1.1 ', @sec_counter.prefix(2, 5))
|
112
|
+
assert_equal('1.1 ', @sec_counter.prefix(2, 5))
|
113
|
+
assert_equal(nil, @sec_counter.prefix(2, 1))
|
114
|
+
assert_equal('1.1.2 ', @sec_counter.prefix(3, 5))
|
115
|
+
assert_equal('1.1.2 ', @sec_counter.prefix(3, 3))
|
116
|
+
assert_equal(nil, @sec_counter.prefix(3, 2))
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_prefix3
|
120
|
+
@sec_counter = SecCounter.new(5, @chapter)
|
121
|
+
@sec_counter.inc(2)
|
122
|
+
@sec_counter.inc(3)
|
123
|
+
@sec_counter.inc(3)
|
124
|
+
@sec_counter.inc(4)
|
125
|
+
@sec_counter.inc(3)
|
126
|
+
assert_equal('1.1 ', @sec_counter.prefix(2, 5))
|
127
|
+
assert_equal('1.1 ', @sec_counter.prefix(2, 5))
|
128
|
+
assert_equal(nil, @sec_counter.prefix(2, 1))
|
129
|
+
assert_equal('1.1.3 ', @sec_counter.prefix(3, 5))
|
130
|
+
assert_equal('1.1.3 ', @sec_counter.prefix(3, 3))
|
131
|
+
assert_equal(nil, @sec_counter.prefix(3, 2))
|
132
|
+
assert_equal('1.1.3.0 ', @sec_counter.prefix(4, 5))
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_prefix_part1
|
136
|
+
@sec_counter = SecCounter.new(5, @part)
|
137
|
+
@sec_counter.inc(2)
|
138
|
+
assert_equal('I.1 ', @sec_counter.prefix(2, 3))
|
139
|
+
assert_equal('I.1.0 ', @sec_counter.prefix(3, 3))
|
140
|
+
assert_equal('I.1.0 ', @sec_counter.prefix(3, 5))
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_prefix_part2
|
144
|
+
@sec_counter = SecCounter.new(5, @part)
|
145
|
+
@sec_counter.inc(2)
|
146
|
+
@sec_counter.inc(3)
|
147
|
+
@sec_counter.inc(3)
|
148
|
+
@sec_counter.inc(4)
|
149
|
+
assert_equal('I.1 ', @sec_counter.prefix(2, 5))
|
150
|
+
assert_equal('I.1 ', @sec_counter.prefix(2, 5))
|
151
|
+
assert_equal(nil, @sec_counter.prefix(2, 1))
|
152
|
+
assert_equal('I.1.2 ', @sec_counter.prefix(3, 5))
|
153
|
+
assert_equal('I.1.2 ', @sec_counter.prefix(3, 3))
|
154
|
+
assert_equal(nil, @sec_counter.prefix(3, 2))
|
155
|
+
end
|
156
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'tmpdir'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'yaml'
|
5
|
+
require 'rbconfig'
|
6
|
+
require 'open3'
|
7
|
+
|
8
|
+
REVIEW_TEXTMAKER = File.expand_path('../bin/review-textmaker', File.dirname(__FILE__))
|
9
|
+
|
10
|
+
class TEXTMakerCmdTest < Test::Unit::TestCase
|
11
|
+
def setup
|
12
|
+
@tmpdir1 = Dir.mktmpdir
|
13
|
+
|
14
|
+
@old_rubylib = ENV['RUBYLIB']
|
15
|
+
ENV['RUBYLIB'] = File.expand_path('../lib', File.dirname(__FILE__))
|
16
|
+
end
|
17
|
+
|
18
|
+
def teardown
|
19
|
+
FileUtils.rm_rf(@tmpdir1)
|
20
|
+
ENV['RUBYLIB'] = @old_rubylib
|
21
|
+
end
|
22
|
+
|
23
|
+
def common_buildtext(bookdir, configfile, targetfile, option)
|
24
|
+
if /mswin|mingw|cygwin/ !~ RUBY_PLATFORM
|
25
|
+
config = prepare_samplebook(@tmpdir1, bookdir, nil, configfile)
|
26
|
+
builddir = File.join(@tmpdir1, config['bookname'] + '-text')
|
27
|
+
assert !File.exist?(builddir)
|
28
|
+
|
29
|
+
ruby_cmd = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']) + RbConfig::CONFIG['EXEEXT']
|
30
|
+
Dir.chdir(@tmpdir1) do
|
31
|
+
_o, e, s = Open3.capture3("#{ruby_cmd} -S #{REVIEW_TEXTMAKER} #{option} #{configfile}")
|
32
|
+
assert_equal '', e
|
33
|
+
assert s.success?
|
34
|
+
end
|
35
|
+
assert File.exist?(File.join(@tmpdir1, targetfile))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_textmaker_cmd_samplebook
|
40
|
+
common_buildtext('sample-book/src', 'config.yml', 'book-text/ch01.txt', nil)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_textmaker_cmd_samplebook_plain
|
44
|
+
common_buildtext('sample-book/src', 'config.yml', 'book-text/ch01.txt', '-n')
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_textmaker_cmd_syntaxbook
|
48
|
+
common_buildtext('syntax-book', 'config.yml', 'syntax-book-text/ch01.txt', nil)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_textmaker_cmd_syntaxbook_plain
|
52
|
+
common_buildtext('syntax-book', 'config.yml', 'syntax-book-text/ch01.txt', '-n')
|
53
|
+
end
|
54
|
+
end
|
data/test/test_textutils.rb
CHANGED
@@ -6,7 +6,12 @@ class TextUtilsTest < Test::Unit::TestCase
|
|
6
6
|
|
7
7
|
def setup
|
8
8
|
@tu_nil = Object.new
|
9
|
-
@tu_nil.extend
|
9
|
+
@tu_nil.extend(ReVIEW::TextUtils)
|
10
|
+
@tu_nil.instance_eval { @book = Book::Base.new('.') }
|
11
|
+
def @tu_nil.config
|
12
|
+
@book.config
|
13
|
+
end
|
14
|
+
|
10
15
|
def @tu_nil.pre_paragraph
|
11
16
|
nil
|
12
17
|
end
|
@@ -16,7 +21,12 @@ class TextUtilsTest < Test::Unit::TestCase
|
|
16
21
|
end
|
17
22
|
|
18
23
|
@tu_p = Object.new
|
19
|
-
@tu_p.extend
|
24
|
+
@tu_p.extend(ReVIEW::TextUtils)
|
25
|
+
@tu_p.instance_eval { @book = Book::Base.new('.') }
|
26
|
+
def @tu_p.config
|
27
|
+
@book.config
|
28
|
+
end
|
29
|
+
|
20
30
|
def @tu_p.pre_paragraph
|
21
31
|
'<p>'
|
22
32
|
end
|
@@ -63,6 +73,20 @@ class TextUtilsTest < Test::Unit::TestCase
|
|
63
73
|
assert_equal ['<p>abc</p>', '<p>defghi</p>'], ret
|
64
74
|
ret = @tu_p.split_paragraph(['abc', '', '', 'def', 'ghi', '', ''])
|
65
75
|
assert_equal ['<p>abc</p>', '<p>defghi</p>'], ret
|
76
|
+
|
77
|
+
@tu_p.config['join_lines_by_lang'] = true
|
78
|
+
ret = @tu_p.split_paragraph(['abc'])
|
79
|
+
assert_equal ['<p>abc</p>'], ret
|
80
|
+
ret = @tu_p.split_paragraph(['abc', 'def'])
|
81
|
+
assert_equal ['<p>abc def</p>'], ret
|
82
|
+
ret = @tu_p.split_paragraph(['abc', '', 'def'])
|
83
|
+
assert_equal ['<p>abc</p>', '<p>def</p>'], ret
|
84
|
+
ret = @tu_p.split_paragraph(['abc', '', '', 'def'])
|
85
|
+
assert_equal ['<p>abc</p>', '<p>def</p>'], ret
|
86
|
+
ret = @tu_p.split_paragraph(['abc', '', '', 'def', 'ghi'])
|
87
|
+
assert_equal ['<p>abc</p>', '<p>def ghi</p>'], ret
|
88
|
+
ret = @tu_p.split_paragraph(['abc', '', '', 'def', 'ghi', '', ''])
|
89
|
+
assert_equal ['<p>abc</p>', '<p>def ghi</p>'], ret
|
66
90
|
end
|
67
91
|
|
68
92
|
def test_split_paragraph_nil
|
@@ -76,5 +100,88 @@ class TextUtilsTest < Test::Unit::TestCase
|
|
76
100
|
assert_equal ['abc', 'def'], ret
|
77
101
|
ret = @tu_nil.split_paragraph(['abc', '', '', 'def', 'ghi'])
|
78
102
|
assert_equal ['abc', 'defghi'], ret
|
103
|
+
|
104
|
+
@tu_nil.config['join_lines_by_lang'] = true
|
105
|
+
ret = @tu_nil.split_paragraph(['abc'])
|
106
|
+
assert_equal ['abc'], ret
|
107
|
+
ret = @tu_nil.split_paragraph(['abc', 'def'])
|
108
|
+
assert_equal ['abc def'], ret
|
109
|
+
ret = @tu_nil.split_paragraph(['abc', '', 'def'])
|
110
|
+
assert_equal ['abc', 'def'], ret
|
111
|
+
ret = @tu_nil.split_paragraph(['abc', '', '', 'def'])
|
112
|
+
assert_equal ['abc', 'def'], ret
|
113
|
+
ret = @tu_nil.split_paragraph(['abc', '', '', 'def', 'ghi'])
|
114
|
+
assert_equal ['abc', 'def ghi'], ret
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_split_paragraph_p_lang
|
118
|
+
ret = @tu_p.split_paragraph(['I', 'have.'])
|
119
|
+
assert_equal ['<p>Ihave.</p>'], ret
|
120
|
+
ret = @tu_p.split_paragraph(['I', 'have', '.'])
|
121
|
+
assert_equal ['<p>Ihave.</p>'], ret
|
122
|
+
ret = @tu_p.split_paragraph(['01', '23', 'a', '4'])
|
123
|
+
assert_equal ['<p>0123a4</p>'], ret
|
124
|
+
ret = @tu_p.split_paragraph(['こんにちは', '漢字', 'α', 'アルファ?', '!'])
|
125
|
+
assert_equal ['<p>こんにちは漢字αアルファ?!</p>'], ret
|
126
|
+
ret = @tu_p.split_paragraph(['こんにちは', '0814', '日'])
|
127
|
+
assert_equal ['<p>こんにちは0814日</p>'], ret
|
128
|
+
ret = @tu_p.split_paragraph(['あ', 'a', 'い', '?', 'a'])
|
129
|
+
assert_equal ['<p>あaい?a</p>'], ret
|
130
|
+
ret = @tu_p.split_paragraph(['안녕하세요', 'こんにちは'])
|
131
|
+
assert_equal ['<p>안녕하세요こんにちは</p>'], ret
|
132
|
+
ret = @tu_p.split_paragraph(['Hello', '안녕하세요', '처음뵙겠습니다'])
|
133
|
+
assert_equal ['<p>Hello안녕하세요처음뵙겠습니다</p>'], ret
|
134
|
+
ret = @tu_p.split_paragraph([''])
|
135
|
+
assert_equal ['<p></p>'], ret
|
136
|
+
# LaTeX
|
137
|
+
ret = @tu_p.split_paragraph(['\tag{a}', 'A', '\tag{b}', 'B'])
|
138
|
+
assert_equal ['<p>\tag{a}A\tag{b}B</p>'], ret
|
139
|
+
ret = @tu_p.split_paragraph(['\tag{あ}', 'い', '\tag{う}', 'A', '\tag{え}', '\tag{b}', '\tag{お}', '\tag{か}'])
|
140
|
+
assert_equal ['<p>\tag{あ}い\tag{う}A\tag{え}\tag{b}\tag{お}\tag{か}</p>'], ret
|
141
|
+
# HTML/IDGXML
|
142
|
+
ret = @tu_p.split_paragraph(['<b>a</b>', 'A', '<b>b</b>', 'B'])
|
143
|
+
assert_equal ['<p><b>a</b>A<b>b</b>B</p>'], ret
|
144
|
+
ret = @tu_p.split_paragraph(['<b>あ</b>', 'い', '<b>う</b>', 'A', '<b>え</b>', '<b>b</b>', '<b>お</b>', '<b>か</b>'])
|
145
|
+
assert_equal ['<p><b>あ</b>い<b>う</b>A<b>え</b><b>b</b><b>お</b><b>か</b></p>'], ret
|
146
|
+
# Text
|
147
|
+
ret = @tu_p.split_paragraph(['★a☆', 'A', '★b☆', 'B'])
|
148
|
+
assert_equal ['<p>★a☆A★b☆B</p>'], ret
|
149
|
+
ret = @tu_p.split_paragraph(['★あ☆', 'い', '★う☆', 'A', '★え☆', '★b☆', '★お☆', '★か☆'])
|
150
|
+
assert_equal ['<p>★あ☆い★う☆A★え☆★b☆★お☆★か☆</p>'], ret
|
151
|
+
|
152
|
+
@tu_p.config['join_lines_by_lang'] = true
|
153
|
+
ret = @tu_p.split_paragraph(['I', 'have.'])
|
154
|
+
assert_equal ['<p>I have.</p>'], ret
|
155
|
+
ret = @tu_p.split_paragraph(['I', 'have', '.'])
|
156
|
+
assert_equal ['<p>I have .</p>'], ret # ...OK? (I have. ?)
|
157
|
+
ret = @tu_p.split_paragraph(['01', '23', 'a', '4'])
|
158
|
+
assert_equal ['<p>01 23 a 4</p>'], ret
|
159
|
+
ret = @tu_p.split_paragraph(['こんにちは', '漢字', 'α', 'アルファ?', '!'])
|
160
|
+
assert_equal ['<p>こんにちは漢字αアルファ?!</p>'], ret
|
161
|
+
ret = @tu_p.split_paragraph(['こんにちは', '0814', '日'])
|
162
|
+
assert_equal ['<p>こんにちは0814日</p>'], ret
|
163
|
+
ret = @tu_p.split_paragraph(['あ', 'a', 'い', '?', 'a'])
|
164
|
+
assert_equal ['<p>あaい? a</p>'], ret
|
165
|
+
ret = @tu_p.split_paragraph(['안녕하세요', 'こんにちは'])
|
166
|
+
assert_equal ['<p>안녕하세요こんにちは</p>'], ret
|
167
|
+
ret = @tu_p.split_paragraph(['Hello', '안녕하세요', '처음뵙겠습니다'])
|
168
|
+
assert_equal ['<p>Hello 안녕하세요 처음뵙겠습니다</p>'], ret
|
169
|
+
ret = @tu_p.split_paragraph([''])
|
170
|
+
assert_equal ['<p></p>'], ret
|
171
|
+
# LaTeX
|
172
|
+
ret = @tu_p.split_paragraph(['\tag{a}', 'A', '\tag{b}', 'B'])
|
173
|
+
assert_equal ['<p>\tag{a} A \tag{b} B</p>'], ret
|
174
|
+
ret = @tu_p.split_paragraph(['\tag{あ}', 'い', '\tag{う}', 'A', '\tag{え}', '\tag{b}', '\tag{お}', '\tag{か}'])
|
175
|
+
assert_equal ['<p>\tag{あ}い\tag{う} A \tag{え} \tag{b} \tag{お} \tag{か}</p>'], ret # ...OK? (\tag{お}\tag{か}?)
|
176
|
+
# HTML/IDGXML
|
177
|
+
ret = @tu_p.split_paragraph(['<b>a</b>', 'A', '<b>b</b>', 'B'])
|
178
|
+
assert_equal ['<p><b>a</b> A <b>b</b> B</p>'], ret
|
179
|
+
ret = @tu_p.split_paragraph(['<b>あ</b>', 'い', '<b>う</b>', 'A', '<b>え</b>', '<b>b</b>', '<b>お</b>', '<b>か</b>'])
|
180
|
+
assert_equal ['<p><b>あ</b>い<b>う</b> A <b>え</b> <b>b</b> <b>お</b> <b>か</b></p>'], ret # ...OK? (<b>お</b><b>か</b>?)
|
181
|
+
# Text
|
182
|
+
ret = @tu_p.split_paragraph(['★a☆', 'A', '★b☆', 'B'])
|
183
|
+
assert_equal ['<p>★a☆ A ★b☆ B</p>'], ret
|
184
|
+
ret = @tu_p.split_paragraph(['★あ☆', 'い', '★う☆', 'A', '★え☆', '★b☆', '★お☆', '★か☆'])
|
185
|
+
assert_equal ['<p>★あ☆い★う☆ A ★え☆ ★b☆ ★お☆ ★か☆</p>'], ret # ...OK? (★お☆★か☆?)
|
79
186
|
end
|
80
187
|
end
|
data/test/test_topbuilder.rb
CHANGED
@@ -142,27 +142,90 @@ class TOPBuidlerTest < Test::Unit::TestCase
|
|
142
142
|
|
143
143
|
def test_inline_in_table
|
144
144
|
actual = compile_block("//table{\n★1☆\t▲2☆\n------------\n★3☆\t▲4☆<>&\n//}\n")
|
145
|
-
|
145
|
+
expected = <<-EOS
|
146
|
+
◆→開始:表←◆
|
147
|
+
★★1☆☆\t★▲2☆☆
|
148
|
+
★3☆\t▲4☆<>&
|
149
|
+
◆→終了:表←◆
|
150
|
+
|
151
|
+
EOS
|
152
|
+
assert_equal expected, actual
|
146
153
|
end
|
147
154
|
|
148
155
|
def test_dlist_beforeulol
|
149
156
|
actual = compile_block(" : foo\n foo.\n\npara\n\n : foo\n foo.\n\n 1. bar\n\n : foo\n foo.\n\n * bar\n")
|
150
|
-
|
157
|
+
expected = <<-EOS
|
158
|
+
★foo☆
|
159
|
+
\tfoo.
|
160
|
+
|
161
|
+
para
|
162
|
+
|
163
|
+
★foo☆
|
164
|
+
\tfoo.
|
165
|
+
|
166
|
+
1\tbar
|
167
|
+
|
168
|
+
★foo☆
|
169
|
+
\tfoo.
|
170
|
+
|
171
|
+
●\tbar
|
172
|
+
|
173
|
+
EOS
|
174
|
+
assert_equal expected, actual
|
175
|
+
end
|
176
|
+
|
177
|
+
def test_dt_inline
|
178
|
+
actual = compile_block("//footnote[bar][bar]\n\n : foo@<fn>{bar}[]<>&@<m>$\\alpha[]$\n")
|
179
|
+
|
180
|
+
expected = <<-EOS
|
181
|
+
【注1】bar
|
182
|
+
|
183
|
+
★foo【注1】[]<>&◆→TeX式ここから←◆\\alpha[]◆→TeX式ここまで←◆☆
|
184
|
+
|
185
|
+
|
186
|
+
EOS
|
187
|
+
assert_equal expected, actual
|
151
188
|
end
|
152
189
|
|
153
190
|
def test_paragraph
|
154
191
|
actual = compile_block("foo\nbar\n")
|
155
192
|
assert_equal %Q(foobar\n), actual
|
193
|
+
|
194
|
+
@book.config['join_lines_by_lang'] = true
|
195
|
+
actual = compile_block("foo\nbar\n")
|
196
|
+
assert_equal %Q(foo bar\n), actual
|
156
197
|
end
|
157
198
|
|
158
199
|
def test_tabbed_paragraph
|
159
200
|
actual = compile_block("\tfoo\nbar\n")
|
160
201
|
assert_equal %Q(\tfoobar\n), actual
|
202
|
+
|
203
|
+
@book.config['join_lines_by_lang'] = true
|
204
|
+
actual = compile_block("\tfoo\nbar\n")
|
205
|
+
assert_equal %Q(\tfoo bar\n), actual
|
161
206
|
end
|
162
207
|
|
163
208
|
def test_flushright
|
164
209
|
actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
|
165
|
-
|
210
|
+
expected = <<-EOS
|
211
|
+
◆→開始:右寄せ←◆
|
212
|
+
foobar
|
213
|
+
buz
|
214
|
+
◆→終了:右寄せ←◆
|
215
|
+
|
216
|
+
EOS
|
217
|
+
assert_equal expected, actual
|
218
|
+
|
219
|
+
@book.config['join_lines_by_lang'] = true
|
220
|
+
actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
|
221
|
+
expected = <<-EOS
|
222
|
+
◆→開始:右寄せ←◆
|
223
|
+
foo bar
|
224
|
+
buz
|
225
|
+
◆→終了:右寄せ←◆
|
226
|
+
|
227
|
+
EOS
|
228
|
+
assert_equal expected, actual
|
166
229
|
end
|
167
230
|
|
168
231
|
def test_blankline
|
@@ -172,7 +235,21 @@ class TOPBuidlerTest < Test::Unit::TestCase
|
|
172
235
|
|
173
236
|
def test_noindent
|
174
237
|
actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
|
175
|
-
|
238
|
+
expected = <<-EOS
|
239
|
+
◆→DTP連絡:次の1行インデントなし←◆
|
240
|
+
foobar
|
241
|
+
foo2bar2
|
242
|
+
EOS
|
243
|
+
assert_equal expected, actual
|
244
|
+
|
245
|
+
@book.config['join_lines_by_lang'] = true
|
246
|
+
actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
|
247
|
+
expected = <<-EOS
|
248
|
+
◆→DTP連絡:次の1行インデントなし←◆
|
249
|
+
foo bar
|
250
|
+
foo2 bar2
|
251
|
+
EOS
|
252
|
+
assert_equal expected, actual
|
176
253
|
end
|
177
254
|
|
178
255
|
def test_comment
|
@@ -190,28 +267,229 @@ class TOPBuidlerTest < Test::Unit::TestCase
|
|
190
267
|
|
191
268
|
def test_list
|
192
269
|
def @chapter.list(_id)
|
193
|
-
Book::
|
270
|
+
Book::Index::Item.new('test', 1)
|
194
271
|
end
|
195
272
|
actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
196
|
-
|
273
|
+
expected = <<-EOS
|
274
|
+
◆→開始:リスト←◆
|
275
|
+
リスト1.1 this is ★test☆<&>_
|
276
|
+
|
277
|
+
foo
|
278
|
+
bar
|
279
|
+
◆→終了:リスト←◆
|
280
|
+
|
281
|
+
EOS
|
282
|
+
assert_equal expected, actual
|
197
283
|
end
|
198
284
|
|
199
285
|
def test_listnum
|
200
286
|
def @chapter.list(_id)
|
201
|
-
Book::
|
287
|
+
Book::Index::Item.new('test', 1)
|
202
288
|
end
|
203
289
|
actual = compile_block("//listnum[test][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
204
|
-
|
290
|
+
expected = <<-EOS
|
291
|
+
◆→開始:リスト←◆
|
292
|
+
リスト1.1 this is ★test☆<&>_
|
293
|
+
|
294
|
+
1: foo
|
295
|
+
2: bar
|
296
|
+
◆→終了:リスト←◆
|
297
|
+
|
298
|
+
EOS
|
299
|
+
assert_equal expected, actual
|
300
|
+
|
301
|
+
@config['caption_position']['list'] = 'bottom'
|
302
|
+
actual = compile_block("//listnum[test][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
303
|
+
expected = <<-EOS
|
304
|
+
◆→開始:リスト←◆
|
305
|
+
1: foo
|
306
|
+
2: bar
|
307
|
+
|
308
|
+
リスト1.1 this is ★test☆<&>_
|
309
|
+
◆→終了:リスト←◆
|
310
|
+
|
311
|
+
EOS
|
312
|
+
assert_equal expected, actual
|
313
|
+
end
|
314
|
+
|
315
|
+
def test_source
|
316
|
+
actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
|
317
|
+
expected = <<-EOS
|
318
|
+
◆→開始:ソースコードリスト←◆
|
319
|
+
■foo/bar/test.rb
|
320
|
+
foo
|
321
|
+
bar
|
322
|
+
|
323
|
+
buz
|
324
|
+
◆→終了:ソースコードリスト←◆
|
325
|
+
|
326
|
+
EOS
|
327
|
+
assert_equal expected, actual
|
328
|
+
|
329
|
+
@config['caption_position']['list'] = 'bottom'
|
330
|
+
actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
|
331
|
+
expected = <<-EOS
|
332
|
+
◆→開始:ソースコードリスト←◆
|
333
|
+
foo
|
334
|
+
bar
|
335
|
+
|
336
|
+
buz
|
337
|
+
■foo/bar/test.rb
|
338
|
+
◆→終了:ソースコードリスト←◆
|
339
|
+
|
340
|
+
EOS
|
341
|
+
assert_equal expected, actual
|
342
|
+
end
|
343
|
+
|
344
|
+
def test_source_empty_caption
|
345
|
+
actual = compile_block("//source[]{\nfoo\nbar\n\nbuz\n//}\n")
|
346
|
+
expected = <<-EOS
|
347
|
+
◆→開始:ソースコードリスト←◆
|
348
|
+
foo
|
349
|
+
bar
|
350
|
+
|
351
|
+
buz
|
352
|
+
◆→終了:ソースコードリスト←◆
|
353
|
+
|
354
|
+
EOS
|
355
|
+
assert_equal expected, actual
|
356
|
+
end
|
357
|
+
|
358
|
+
def test_box
|
359
|
+
actual = compile_block("//box{\nfoo\nbar\n//}\n")
|
360
|
+
expected = <<-EOS
|
361
|
+
◆→開始:書式←◆
|
362
|
+
foo
|
363
|
+
bar
|
364
|
+
◆→終了:書式←◆
|
365
|
+
|
366
|
+
EOS
|
367
|
+
assert_equal expected, actual
|
368
|
+
|
369
|
+
actual = compile_block("//box[FOO]{\nfoo\nbar\n//}\n")
|
370
|
+
expected = <<-EOS
|
371
|
+
◆→開始:書式←◆
|
372
|
+
■FOO
|
373
|
+
foo
|
374
|
+
bar
|
375
|
+
◆→終了:書式←◆
|
376
|
+
|
377
|
+
EOS
|
378
|
+
assert_equal expected, actual
|
379
|
+
|
380
|
+
@config['caption_position']['list'] = 'bottom'
|
381
|
+
actual = compile_block("//box[FOO]{\nfoo\nbar\n//}\n")
|
382
|
+
expected = <<-EOS
|
383
|
+
◆→開始:書式←◆
|
384
|
+
foo
|
385
|
+
bar
|
386
|
+
■FOO
|
387
|
+
◆→終了:書式←◆
|
388
|
+
|
389
|
+
EOS
|
390
|
+
assert_equal expected, actual
|
391
|
+
end
|
392
|
+
|
393
|
+
def test_cmd
|
394
|
+
actual = compile_block("//cmd{\nlineA\nlineB\n//}\n")
|
395
|
+
expected = <<-EOS
|
396
|
+
◆→開始:コマンド←◆
|
397
|
+
lineA
|
398
|
+
lineB
|
399
|
+
◆→終了:コマンド←◆
|
400
|
+
|
401
|
+
EOS
|
402
|
+
assert_equal expected, actual
|
403
|
+
|
404
|
+
actual = compile_block("//cmd[cap1]{\nlineA\nlineB\n//}\n")
|
405
|
+
expected = <<-EOS
|
406
|
+
◆→開始:コマンド←◆
|
407
|
+
■cap1
|
408
|
+
lineA
|
409
|
+
lineB
|
410
|
+
◆→終了:コマンド←◆
|
411
|
+
|
412
|
+
EOS
|
413
|
+
assert_equal expected, actual
|
414
|
+
|
415
|
+
@config['caption_position']['list'] = 'bottom'
|
416
|
+
actual = compile_block("//cmd[cap1]{\nlineA\nlineB\n//}\n")
|
417
|
+
expected = <<-EOS
|
418
|
+
◆→開始:コマンド←◆
|
419
|
+
lineA
|
420
|
+
lineB
|
421
|
+
■cap1
|
422
|
+
◆→終了:コマンド←◆
|
423
|
+
|
424
|
+
EOS
|
425
|
+
assert_equal expected, actual
|
426
|
+
end
|
427
|
+
|
428
|
+
def test_emlist
|
429
|
+
actual = compile_block("//emlist{\nlineA\nlineB\n//}\n")
|
430
|
+
expected = <<-EOS
|
431
|
+
◆→開始:インラインリスト←◆
|
432
|
+
lineA
|
433
|
+
lineB
|
434
|
+
◆→終了:インラインリスト←◆
|
435
|
+
|
436
|
+
EOS
|
437
|
+
assert_equal expected, actual
|
438
|
+
end
|
439
|
+
|
440
|
+
def test_emlist_caption
|
441
|
+
actual = compile_block("//emlist[cap1]{\nlineA\nlineB\n//}\n")
|
442
|
+
expected = <<-EOS
|
443
|
+
◆→開始:インラインリスト←◆
|
444
|
+
■cap1
|
445
|
+
lineA
|
446
|
+
lineB
|
447
|
+
◆→終了:インラインリスト←◆
|
448
|
+
|
449
|
+
EOS
|
450
|
+
assert_equal expected, actual
|
451
|
+
|
452
|
+
@config['caption_position']['list'] = 'bottom'
|
453
|
+
actual = compile_block("//emlist[cap1]{\nlineA\nlineB\n//}\n")
|
454
|
+
expected = <<-EOS
|
455
|
+
◆→開始:インラインリスト←◆
|
456
|
+
lineA
|
457
|
+
lineB
|
458
|
+
■cap1
|
459
|
+
◆→終了:インラインリスト←◆
|
460
|
+
|
461
|
+
EOS
|
462
|
+
assert_equal expected, actual
|
205
463
|
end
|
206
464
|
|
207
465
|
def test_emlistnum
|
208
466
|
actual = compile_block("//emlistnum[this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
209
|
-
|
467
|
+
expected = <<-EOS
|
468
|
+
◆→開始:インラインリスト←◆
|
469
|
+
■this is ★test☆<&>_
|
470
|
+
1: foo
|
471
|
+
2: bar
|
472
|
+
◆→終了:インラインリスト←◆
|
473
|
+
|
474
|
+
EOS
|
475
|
+
assert_equal expected, actual
|
476
|
+
|
477
|
+
@config['caption_position']['list'] = 'bottom'
|
478
|
+
actual = compile_block("//emlistnum[this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
479
|
+
expected = <<-EOS
|
480
|
+
◆→開始:インラインリスト←◆
|
481
|
+
1: foo
|
482
|
+
2: bar
|
483
|
+
■this is ★test☆<&>_
|
484
|
+
◆→終了:インラインリスト←◆
|
485
|
+
|
486
|
+
EOS
|
487
|
+
assert_equal expected, actual
|
210
488
|
end
|
211
489
|
|
212
490
|
def test_bib
|
213
491
|
def @chapter.bibpaper(_id)
|
214
|
-
Book::
|
492
|
+
Book::Index::Item.new('samplebib', 1, 'sample bib')
|
215
493
|
end
|
216
494
|
|
217
495
|
assert_equal '[1]', compile_inline('@<bib>{samplebib}')
|
@@ -219,13 +497,52 @@ class TOPBuidlerTest < Test::Unit::TestCase
|
|
219
497
|
|
220
498
|
def test_table
|
221
499
|
actual = compile_block("//table{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
222
|
-
|
223
|
-
|
500
|
+
expected = <<-EOS
|
501
|
+
◆→開始:表←◆
|
502
|
+
★aaa☆\t★bbb☆
|
503
|
+
ccc\tddd<>&
|
504
|
+
◆→終了:表←◆
|
505
|
+
|
506
|
+
EOS
|
507
|
+
assert_equal expected, actual
|
508
|
+
|
509
|
+
actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
510
|
+
expected = <<-EOS
|
511
|
+
◆→開始:表←◆
|
512
|
+
表1.1 FOO
|
513
|
+
|
514
|
+
★aaa☆\t★bbb☆
|
515
|
+
ccc\tddd<>&
|
516
|
+
◆→終了:表←◆
|
517
|
+
|
518
|
+
EOS
|
519
|
+
assert_equal expected, actual
|
520
|
+
|
521
|
+
@config['caption_position']['table'] = 'bottom'
|
522
|
+
actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
523
|
+
expected = <<-EOS
|
524
|
+
◆→開始:表←◆
|
525
|
+
★aaa☆\t★bbb☆
|
526
|
+
ccc\tddd<>&
|
527
|
+
|
528
|
+
表1.1 FOO
|
529
|
+
◆→終了:表←◆
|
530
|
+
|
531
|
+
EOS
|
532
|
+
assert_equal expected, actual
|
533
|
+
end
|
534
|
+
|
535
|
+
def test_empty_table
|
536
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n//}\n") }
|
537
|
+
assert_equal ':2: error: no rows in the table', e.message
|
538
|
+
|
539
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n------------\n//}\n") }
|
540
|
+
assert_equal ':3: error: no rows in the table', e.message
|
224
541
|
end
|
225
542
|
|
226
543
|
def test_inline_table
|
227
544
|
def @chapter.table(_id)
|
228
|
-
Book::
|
545
|
+
Book::Index::Item.new('sampletable', 1)
|
229
546
|
end
|
230
547
|
actual = compile_block("@<table>{sampletest}\n")
|
231
548
|
assert_equal "表1.1\n", actual
|
@@ -233,69 +550,428 @@ class TOPBuidlerTest < Test::Unit::TestCase
|
|
233
550
|
|
234
551
|
def test_emtable
|
235
552
|
actual = compile_block("//emtable[foo]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n//emtable{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
236
|
-
|
237
|
-
|
553
|
+
expected = <<-EOS
|
554
|
+
◆→開始:表←◆
|
555
|
+
foo
|
556
|
+
|
557
|
+
★aaa☆\t★bbb☆
|
558
|
+
ccc\tddd<>&
|
559
|
+
◆→終了:表←◆
|
560
|
+
|
561
|
+
◆→開始:表←◆
|
562
|
+
★aaa☆\t★bbb☆
|
563
|
+
ccc\tddd<>&
|
564
|
+
◆→終了:表←◆
|
565
|
+
|
566
|
+
EOS
|
567
|
+
assert_equal expected, actual
|
568
|
+
end
|
569
|
+
|
570
|
+
def test_table_row_separator
|
571
|
+
src = "//table{\n1\t2\t\t3 4| 5\n------------\na b\tc d |e\n//}\n"
|
572
|
+
expected = <<-EOS
|
573
|
+
◆→開始:表←◆
|
574
|
+
★1☆ ★2☆ ★3 4| 5☆
|
575
|
+
a b c d |e
|
576
|
+
◆→終了:表←◆
|
577
|
+
|
578
|
+
EOS
|
579
|
+
actual = compile_block(src)
|
580
|
+
assert_equal expected, actual
|
581
|
+
|
582
|
+
@config['table_row_separator'] = 'singletab'
|
583
|
+
actual = compile_block(src)
|
584
|
+
expected = <<-EOS
|
585
|
+
◆→開始:表←◆
|
586
|
+
★1☆ ★2☆ ★☆ ★3 4| 5☆
|
587
|
+
a b c d |e
|
588
|
+
◆→終了:表←◆
|
589
|
+
|
590
|
+
EOS
|
591
|
+
assert_equal expected, actual
|
592
|
+
|
593
|
+
@config['table_row_separator'] = 'spaces'
|
594
|
+
actual = compile_block(src)
|
595
|
+
expected = <<-EOS
|
596
|
+
◆→開始:表←◆
|
597
|
+
★1☆ ★2☆ ★3☆ ★4|☆ ★5☆
|
598
|
+
a b c d |e
|
599
|
+
◆→終了:表←◆
|
600
|
+
|
601
|
+
EOS
|
602
|
+
assert_equal expected, actual
|
603
|
+
|
604
|
+
@config['table_row_separator'] = 'verticalbar'
|
605
|
+
actual = compile_block(src)
|
606
|
+
expected = <<-EOS
|
607
|
+
◆→開始:表←◆
|
608
|
+
★1 2 3 4☆ ★5☆
|
609
|
+
a b c d e
|
610
|
+
◆→終了:表←◆
|
611
|
+
|
612
|
+
EOS
|
613
|
+
assert_equal expected, actual
|
238
614
|
end
|
239
615
|
|
240
616
|
def test_major_blocks
|
241
617
|
actual = compile_block("//note{\nA\n\nB\n//}\n//note[caption]{\nA\n//}")
|
242
|
-
expected =
|
618
|
+
expected = <<-EOS
|
619
|
+
◆→開始:ノート←◆
|
620
|
+
A
|
621
|
+
B
|
622
|
+
◆→終了:ノート←◆
|
623
|
+
|
624
|
+
◆→開始:ノート←◆
|
625
|
+
■caption
|
626
|
+
A
|
627
|
+
◆→終了:ノート←◆
|
628
|
+
|
629
|
+
EOS
|
243
630
|
assert_equal expected, actual
|
244
631
|
|
245
632
|
actual = compile_block("//memo{\nA\n\nB\n//}\n//memo[caption]{\nA\n//}")
|
246
|
-
expected =
|
633
|
+
expected = <<-EOS
|
634
|
+
◆→開始:メモ←◆
|
635
|
+
A
|
636
|
+
B
|
637
|
+
◆→終了:メモ←◆
|
638
|
+
|
639
|
+
◆→開始:メモ←◆
|
640
|
+
■caption
|
641
|
+
A
|
642
|
+
◆→終了:メモ←◆
|
643
|
+
|
644
|
+
EOS
|
247
645
|
assert_equal expected, actual
|
248
646
|
|
249
647
|
actual = compile_block("//info{\nA\n\nB\n//}\n//info[caption]{\nA\n//}")
|
250
|
-
expected =
|
648
|
+
expected = <<-EOS
|
649
|
+
◆→開始:情報←◆
|
650
|
+
A
|
651
|
+
B
|
652
|
+
◆→終了:情報←◆
|
653
|
+
|
654
|
+
◆→開始:情報←◆
|
655
|
+
■caption
|
656
|
+
A
|
657
|
+
◆→終了:情報←◆
|
658
|
+
|
659
|
+
EOS
|
251
660
|
assert_equal expected, actual
|
252
661
|
|
253
662
|
actual = compile_block("//important{\nA\n\nB\n//}\n//important[caption]{\nA\n//}")
|
254
|
-
expected =
|
663
|
+
expected = <<-EOS
|
664
|
+
◆→開始:重要←◆
|
665
|
+
A
|
666
|
+
B
|
667
|
+
◆→終了:重要←◆
|
668
|
+
|
669
|
+
◆→開始:重要←◆
|
670
|
+
■caption
|
671
|
+
A
|
672
|
+
◆→終了:重要←◆
|
673
|
+
|
674
|
+
EOS
|
255
675
|
assert_equal expected, actual
|
256
676
|
|
257
677
|
actual = compile_block("//caution{\nA\n\nB\n//}\n//caution[caption]{\nA\n//}")
|
258
|
-
expected =
|
678
|
+
expected = <<-EOS
|
679
|
+
◆→開始:警告←◆
|
680
|
+
A
|
681
|
+
B
|
682
|
+
◆→終了:警告←◆
|
683
|
+
|
684
|
+
◆→開始:警告←◆
|
685
|
+
■caption
|
686
|
+
A
|
687
|
+
◆→終了:警告←◆
|
688
|
+
|
689
|
+
EOS
|
259
690
|
assert_equal expected, actual
|
260
691
|
|
261
692
|
actual = compile_block("//notice{\nA\n\nB\n//}\n//notice[caption]{\nA\n//}")
|
262
|
-
expected =
|
693
|
+
expected = <<-EOS
|
694
|
+
◆→開始:注意←◆
|
695
|
+
A
|
696
|
+
B
|
697
|
+
◆→終了:注意←◆
|
698
|
+
|
699
|
+
◆→開始:注意←◆
|
700
|
+
■caption
|
701
|
+
A
|
702
|
+
◆→終了:注意←◆
|
703
|
+
|
704
|
+
EOS
|
263
705
|
assert_equal expected, actual
|
264
706
|
|
265
707
|
actual = compile_block("//warning{\nA\n\nB\n//}\n//warning[caption]{\nA\n//}")
|
266
|
-
expected =
|
708
|
+
expected = <<-EOS
|
709
|
+
◆→開始:危険←◆
|
710
|
+
A
|
711
|
+
B
|
712
|
+
◆→終了:危険←◆
|
713
|
+
|
714
|
+
◆→開始:危険←◆
|
715
|
+
■caption
|
716
|
+
A
|
717
|
+
◆→終了:危険←◆
|
718
|
+
|
719
|
+
EOS
|
267
720
|
assert_equal expected, actual
|
268
721
|
|
269
722
|
actual = compile_block("//tip{\nA\n\nB\n//}\n//tip[caption]{\nA\n//}")
|
270
|
-
expected =
|
723
|
+
expected = <<-EOS
|
724
|
+
◆→開始:TIP←◆
|
725
|
+
A
|
726
|
+
B
|
727
|
+
◆→終了:TIP←◆
|
728
|
+
|
729
|
+
◆→開始:TIP←◆
|
730
|
+
■caption
|
731
|
+
A
|
732
|
+
◆→終了:TIP←◆
|
733
|
+
|
734
|
+
EOS
|
271
735
|
assert_equal expected, actual
|
272
736
|
end
|
273
737
|
|
738
|
+
def test_minicolumn_blocks
|
739
|
+
titles = {
|
740
|
+
'note' => 'ノート',
|
741
|
+
'memo' => 'メモ',
|
742
|
+
'important' => '重要',
|
743
|
+
'info' => '情報',
|
744
|
+
'notice' => '注意',
|
745
|
+
'caution' => '警告',
|
746
|
+
'warning' => '危険',
|
747
|
+
'tip' => 'TIP'
|
748
|
+
}
|
749
|
+
|
750
|
+
%w[note memo tip info warning important caution notice].each do |type|
|
751
|
+
@builder.doc_status.clear
|
752
|
+
src = <<-EOS
|
753
|
+
//#{type}[#{type}1]{
|
754
|
+
|
755
|
+
//}
|
756
|
+
|
757
|
+
//#{type}[#{type}2]{
|
758
|
+
//}
|
759
|
+
EOS
|
760
|
+
|
761
|
+
expected = <<-EOS
|
762
|
+
◆→開始:#{titles[type]}←◆
|
763
|
+
■#{type}1
|
764
|
+
◆→終了:#{titles[type]}←◆
|
765
|
+
|
766
|
+
◆→開始:#{titles[type]}←◆
|
767
|
+
■#{type}2
|
768
|
+
◆→終了:#{titles[type]}←◆
|
769
|
+
|
770
|
+
EOS
|
771
|
+
assert_equal expected, compile_block(src)
|
772
|
+
|
773
|
+
src = <<-EOS
|
774
|
+
//#{type}[#{type}2]{
|
775
|
+
|
776
|
+
//}
|
777
|
+
|
778
|
+
//#{type}[#{type}3]{
|
779
|
+
|
780
|
+
//}
|
781
|
+
|
782
|
+
//#{type}[#{type}4]{
|
783
|
+
|
784
|
+
//}
|
785
|
+
|
786
|
+
//#{type}[#{type}5]{
|
787
|
+
|
788
|
+
//}
|
789
|
+
|
790
|
+
//#{type}[#{type}6]{
|
791
|
+
|
792
|
+
//}
|
793
|
+
EOS
|
794
|
+
|
795
|
+
expected = <<-EOS
|
796
|
+
◆→開始:#{titles[type]}←◆
|
797
|
+
■#{type}2
|
798
|
+
◆→終了:#{titles[type]}←◆
|
799
|
+
|
800
|
+
◆→開始:#{titles[type]}←◆
|
801
|
+
■#{type}3
|
802
|
+
◆→終了:#{titles[type]}←◆
|
803
|
+
|
804
|
+
◆→開始:#{titles[type]}←◆
|
805
|
+
■#{type}4
|
806
|
+
◆→終了:#{titles[type]}←◆
|
807
|
+
|
808
|
+
◆→開始:#{titles[type]}←◆
|
809
|
+
■#{type}5
|
810
|
+
◆→終了:#{titles[type]}←◆
|
811
|
+
|
812
|
+
◆→開始:#{titles[type]}←◆
|
813
|
+
■#{type}6
|
814
|
+
◆→終了:#{titles[type]}←◆
|
815
|
+
|
816
|
+
EOS
|
817
|
+
assert_equal expected, compile_block(src)
|
818
|
+
|
819
|
+
src = <<-EOS
|
820
|
+
//#{type}{
|
821
|
+
|
822
|
+
* A
|
823
|
+
|
824
|
+
1. B
|
825
|
+
|
826
|
+
//}
|
827
|
+
|
828
|
+
//#{type}[OMITEND1]{
|
829
|
+
|
830
|
+
//emlist{
|
831
|
+
LIST
|
832
|
+
//}
|
833
|
+
|
834
|
+
//}
|
835
|
+
//#{type}[OMITEND2]{
|
836
|
+
//}
|
837
|
+
EOS
|
838
|
+
|
839
|
+
expected = <<-EOS
|
840
|
+
◆→開始:#{titles[type]}←◆
|
841
|
+
|
842
|
+
● A
|
843
|
+
|
844
|
+
1 B
|
845
|
+
|
846
|
+
◆→終了:#{titles[type]}←◆
|
847
|
+
|
848
|
+
◆→開始:#{titles[type]}←◆
|
849
|
+
■OMITEND1
|
850
|
+
|
851
|
+
◆→開始:インラインリスト←◆
|
852
|
+
LIST
|
853
|
+
◆→終了:インラインリスト←◆
|
854
|
+
|
855
|
+
◆→終了:#{titles[type]}←◆
|
856
|
+
|
857
|
+
◆→開始:#{titles[type]}←◆
|
858
|
+
■OMITEND2
|
859
|
+
◆→終了:#{titles[type]}←◆
|
860
|
+
|
861
|
+
EOS
|
862
|
+
assert_equal expected, compile_block(src)
|
863
|
+
end
|
864
|
+
end
|
865
|
+
|
866
|
+
def test_minicolumn_blocks_nest_error1
|
867
|
+
%w[note memo tip info warning important caution notice].each do |type|
|
868
|
+
@builder.doc_status.clear
|
869
|
+
src = <<-EOS
|
870
|
+
//#{type}{
|
871
|
+
|
872
|
+
//#{type}{
|
873
|
+
//}
|
874
|
+
|
875
|
+
//}
|
876
|
+
EOS
|
877
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
878
|
+
assert_match(/minicolumn cannot be nested:/, e.message)
|
879
|
+
end
|
880
|
+
end
|
881
|
+
|
882
|
+
def test_minicolumn_blocks_nest_error2
|
883
|
+
%w[note memo tip info warning important caution notice].each do |type|
|
884
|
+
@builder.doc_status.clear
|
885
|
+
src = <<-EOS
|
886
|
+
//#{type}{
|
887
|
+
|
888
|
+
//#{type}{
|
889
|
+
|
890
|
+
//}
|
891
|
+
|
892
|
+
//}
|
893
|
+
EOS
|
894
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
895
|
+
assert_match(/minicolumn cannot be nested:/, e.message)
|
896
|
+
end
|
897
|
+
end
|
898
|
+
|
899
|
+
def test_minicolumn_blocks_nest_error3
|
900
|
+
%w[memo tip info warning important caution notice].each do |type|
|
901
|
+
@builder.doc_status.clear
|
902
|
+
src = <<-EOS
|
903
|
+
//#{type}{
|
904
|
+
|
905
|
+
//note{
|
906
|
+
//}
|
907
|
+
|
908
|
+
//}
|
909
|
+
EOS
|
910
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
911
|
+
assert_match(/minicolumn cannot be nested:/, e.message)
|
912
|
+
end
|
913
|
+
end
|
914
|
+
|
274
915
|
def test_image
|
275
916
|
def @chapter.image(_id)
|
276
|
-
item = Book::
|
917
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
277
918
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
278
919
|
item
|
279
920
|
end
|
280
921
|
|
281
922
|
actual = compile_block("//image[sampleimg][sample photo]{\nfoo\n//}\n")
|
282
|
-
|
923
|
+
expected = <<-EOS
|
924
|
+
◆→開始:図←◆
|
925
|
+
◆→./images/chap1-sampleimg.png←◆
|
926
|
+
|
927
|
+
図1.1 sample photo
|
928
|
+
◆→終了:図←◆
|
929
|
+
|
930
|
+
EOS
|
931
|
+
assert_equal expected, actual
|
932
|
+
|
933
|
+
@config['caption_position']['image'] = 'top'
|
934
|
+
actual = compile_block("//image[sampleimg][sample photo]{\nfoo\n//}\n")
|
935
|
+
expected = <<-EOS
|
936
|
+
◆→開始:図←◆
|
937
|
+
図1.1 sample photo
|
938
|
+
|
939
|
+
◆→./images/chap1-sampleimg.png←◆
|
940
|
+
◆→終了:図←◆
|
941
|
+
|
942
|
+
EOS
|
943
|
+
assert_equal expected, actual
|
283
944
|
end
|
284
945
|
|
285
946
|
def test_image_with_metric
|
286
947
|
def @chapter.image(_id)
|
287
|
-
item = Book::
|
948
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
288
949
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
289
950
|
item
|
290
951
|
end
|
291
952
|
|
292
953
|
actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\nfoo\n//}\n")
|
293
|
-
|
954
|
+
expected = <<-EOS
|
955
|
+
◆→開始:図←◆
|
956
|
+
◆→./images/chap1-sampleimg.png scale=1.2←◆
|
957
|
+
|
958
|
+
図1.1 sample photo
|
959
|
+
◆→終了:図←◆
|
960
|
+
|
961
|
+
EOS
|
962
|
+
assert_equal expected, actual
|
294
963
|
end
|
295
964
|
|
296
965
|
def test_texequation
|
297
966
|
actual = compile_block("//texequation{\n\\sin\n1^{2}\n//}\n")
|
298
|
-
|
967
|
+
expected = <<-EOS
|
968
|
+
◆→開始:TeX式←◆
|
969
|
+
\\sin
|
970
|
+
1^{2}
|
971
|
+
◆→終了:TeX式←◆
|
972
|
+
|
973
|
+
EOS
|
974
|
+
assert_equal expected, actual
|
299
975
|
end
|
300
976
|
|
301
977
|
def test_inline_w
|
@@ -312,23 +988,23 @@ EOB
|
|
312
988
|
@builder.instance_eval{ @logger = ReVIEW::Logger.new(io) }
|
313
989
|
actual = compile_block('@<w>{F} @<w>{B} @<wb>{B} @<w>{N}')
|
314
990
|
assert_equal %Q(foo bar"\\<>_@<b>{BAZ} ★bar"\\<>_@<b>{BAZ}☆ [missing word: N]\n), actual
|
315
|
-
assert_match(/WARN
|
991
|
+
assert_match(/WARN --: :1: word not bound: N/, io.string)
|
316
992
|
end
|
317
993
|
end
|
318
994
|
|
319
995
|
def test_inline_unknown
|
320
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
996
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<img>{n}\n") }
|
321
997
|
assert_equal ':1: error: unknown image: n', e.message
|
322
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
998
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<fn>{n}\n") }
|
323
999
|
assert_equal ':1: error: unknown footnote: n', e.message
|
324
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
1000
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<hd>{n}\n") }
|
325
1001
|
assert_equal ':1: error: unknown headline: n', e.message
|
326
1002
|
%w[list table column].each do |name|
|
327
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
1003
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
|
328
1004
|
assert_equal ":1: error: unknown #{name}: n", e.message
|
329
1005
|
end
|
330
1006
|
%w[chap chapref title].each do |name|
|
331
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
1007
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
|
332
1008
|
assert_equal ':1: error: key not found: "n"', e.message
|
333
1009
|
end
|
334
1010
|
end
|
@@ -430,6 +1106,20 @@ EOS
|
|
430
1106
|
e=mc^2
|
431
1107
|
◆→終了:TeX式←◆
|
432
1108
|
|
1109
|
+
EOS
|
1110
|
+
actual = compile_block(src)
|
1111
|
+
assert_equal expected, actual
|
1112
|
+
|
1113
|
+
@config['caption_position']['equation'] = 'bottom'
|
1114
|
+
|
1115
|
+
expected = <<-EOS
|
1116
|
+
式1.1
|
1117
|
+
|
1118
|
+
◆→開始:TeX式←◆
|
1119
|
+
e=mc^2
|
1120
|
+
式1.1 The Equivalence of Mass ▲and☆ Energy
|
1121
|
+
◆→終了:TeX式←◆
|
1122
|
+
|
433
1123
|
EOS
|
434
1124
|
actual = compile_block(src)
|
435
1125
|
assert_equal expected, actual
|