review 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +90 -66
- data/.travis.yml +1 -1
- data/Gemfile +0 -1
- data/NEWS.ja.md +82 -0
- data/NEWS.md +83 -0
- data/README.md +5 -3
- data/Rakefile +8 -8
- data/bin/review +1 -5
- data/bin/review-catalog-converter +22 -27
- data/bin/review-check +36 -43
- data/bin/review-checkdep +10 -15
- data/bin/review-compile +37 -55
- data/bin/review-epubmaker +4 -5
- data/bin/review-index +21 -29
- data/bin/review-init +26 -37
- data/bin/review-pdfmaker +0 -2
- data/bin/review-preproc +25 -45
- data/bin/review-validate +19 -18
- data/bin/review-vol +15 -27
- data/doc/config.yml.sample +5 -2
- data/doc/format.ja.md +20 -1
- data/doc/format.md +21 -5
- data/doc/images/review-generate.png +0 -0
- data/lib/epubmaker.rb +1 -3
- data/lib/epubmaker/content.rb +24 -27
- data/lib/epubmaker/epubcommon.rb +135 -148
- data/lib/epubmaker/epubv2.rb +39 -46
- data/lib/epubmaker/epubv3.rb +93 -103
- data/lib/epubmaker/producer.rb +138 -151
- data/lib/epubmaker/zip_exporter.rb +21 -26
- data/lib/review/book.rb +3 -6
- data/lib/review/book/base.rb +78 -103
- data/lib/review/book/chapter.rb +36 -40
- data/lib/review/book/compilable.rb +28 -31
- data/lib/review/book/image_finder.rb +6 -13
- data/lib/review/book/index.rb +100 -121
- data/lib/review/book/page_metric.rb +2 -7
- data/lib/review/book/part.rb +18 -20
- data/lib/review/book/volume.rb +9 -13
- data/lib/review/builder.rb +81 -116
- data/lib/review/catalog.rb +15 -19
- data/lib/review/compiler.rb +64 -83
- data/lib/review/configure.rb +87 -97
- data/lib/review/converter.rb +2 -7
- data/lib/review/epubbuilder.rb +1 -3
- data/lib/review/epubmaker.rb +213 -205
- data/lib/review/exception.rb +2 -4
- data/lib/review/extentions.rb +0 -1
- data/lib/review/extentions/hash.rb +2 -2
- data/lib/review/extentions/string.rb +5 -30
- data/lib/review/htmlbuilder.rb +320 -375
- data/lib/review/htmltoc.rb +4 -7
- data/lib/review/htmlutils.rb +29 -32
- data/lib/review/i18n.rb +33 -44
- data/lib/review/i18n.yml +3 -3
- data/lib/review/idgxmlbuilder.rb +309 -345
- data/lib/review/latexbuilder.rb +175 -212
- data/lib/review/latexindex.rb +2 -8
- data/lib/review/latexutils.rb +33 -43
- data/lib/review/lineinput.rb +1 -1
- data/lib/review/logger.rb +21 -0
- data/lib/review/makerhelper.rb +1 -4
- data/lib/review/markdownbuilder.rb +44 -53
- data/lib/review/md2inaobuilder.rb +6 -12
- data/lib/review/pdfmaker.rb +143 -173
- data/lib/review/preprocessor.rb +64 -101
- data/lib/review/rstbuilder.rb +126 -158
- data/lib/review/sec_counter.rb +18 -34
- data/lib/review/template.rb +4 -5
- data/lib/review/textbuilder.rb +2 -3
- data/lib/review/textutils.rb +7 -13
- data/lib/review/tocparser.rb +31 -56
- data/lib/review/tocprinter.rb +26 -52
- data/lib/review/topbuilder.rb +219 -247
- data/lib/review/unfold.rb +15 -24
- data/lib/review/version.rb +1 -1
- data/lib/review/webmaker.rb +75 -99
- data/lib/review/webtocprinter.rb +15 -20
- data/lib/review/yamlloader.rb +13 -15
- data/review.gemspec +20 -22
- data/templates/latex/layout.tex.erb +2 -2
- data/templates/opf/epubv2.opf.erb +7 -7
- data/templates/opf/epubv3.opf.erb +7 -7
- data/templates/web/html/layout-html5.html.erb +2 -2
- data/test/assets/black.eps +280 -0
- data/test/assets/fit.png +0 -0
- data/test/assets/large.gif +0 -0
- data/test/assets/large.jpg +0 -0
- data/test/assets/large.png +0 -0
- data/test/assets/large.svg +65 -0
- data/test/assets/test_template.tex +1 -1
- data/test/book_test_helper.rb +2 -2
- data/test/run_test.rb +4 -4
- data/test/sample-book/src/Rakefile +21 -22
- data/test/syntax-book/Gemfile +4 -0
- data/test/syntax-book/Rakefile +72 -0
- data/test/syntax-book/appA.re +22 -0
- data/test/syntax-book/bib.re +6 -0
- data/test/syntax-book/catalog.yml +15 -0
- data/test/syntax-book/ch01.re +136 -0
- data/test/syntax-book/ch02.re +351 -0
- data/test/syntax-book/ch03.re +82 -0
- data/test/syntax-book/config.yml +35 -0
- data/test/syntax-book/images/ball.png +0 -0
- data/test/syntax-book/images/cover.jpg +0 -0
- data/test/syntax-book/images/fractal.png +0 -0
- data/test/syntax-book/images/img3-1.png +0 -0
- data/test/syntax-book/images/inlineicon.jpg +0 -0
- data/test/syntax-book/images/logic.png +0 -0
- data/test/syntax-book/images/logic2.png +0 -0
- data/test/syntax-book/images/puzzle.jpg +0 -0
- data/test/syntax-book/images/table.jpg +0 -0
- data/test/syntax-book/part2.re +6 -0
- data/test/syntax-book/pre01.re +26 -0
- data/test/syntax-book/review-ext.rb +14 -0
- data/test/syntax-book/sty/jumoline.sty +310 -0
- data/test/syntax-book/sty/reviewmacro.sty +39 -0
- data/test/syntax-book/style.css +494 -0
- data/test/syntax-book/syntax.dic +2 -0
- data/test/test_book.rb +106 -111
- data/test/test_book_chapter.rb +21 -22
- data/test/test_book_part.rb +3 -5
- data/test/test_builder.rb +11 -22
- data/test/test_catalog.rb +17 -18
- data/test/test_catalog_converter_cmd.rb +5 -5
- data/test/test_compiler.rb +18 -16
- data/test/test_configure.rb +35 -38
- data/test/test_converter.rb +3 -4
- data/test/test_epub3maker.rb +136 -117
- data/test/test_epubmaker.rb +107 -114
- data/test/test_epubmaker_cmd.rb +2 -4
- data/test/test_extentions_hash.rb +32 -33
- data/test/test_helper.rb +9 -11
- data/test/test_htmlbuilder.rb +454 -420
- data/test/test_htmltoc.rb +8 -12
- data/test/test_htmlutils.rb +0 -2
- data/test/test_i18n.rb +159 -150
- data/test/test_idgxmlbuilder.rb +190 -197
- data/test/test_image_finder.rb +21 -22
- data/test/test_index.rb +24 -29
- data/test/test_latexbuilder.rb +274 -264
- data/test/test_lineinput.rb +7 -10
- data/test/test_location.rb +7 -7
- data/test/test_makerhelper.rb +13 -25
- data/test/test_markdownbuilder.rb +23 -26
- data/test/test_md2inaobuilder.rb +8 -11
- data/test/test_pdfmaker.rb +114 -123
- data/test/test_pdfmaker_cmd.rb +1 -3
- data/test/test_review_ext.rb +3 -5
- data/test/test_rstbuilder.rb +92 -97
- data/test/test_template.rb +3 -7
- data/test/test_textutils.rb +27 -27
- data/test/test_tocparser.rb +2 -2
- data/test/test_topbuilder.rb +98 -103
- data/test/test_webtocprinter.rb +5 -6
- data/test/test_yamlloader.rb +42 -42
- data/test/test_zip_exporter.rb +12 -18
- metadata +86 -9
- data/lib/review/ewbbuilder.rb +0 -382
data/test/test_pdfmaker_cmd.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'test_helper'
|
4
2
|
require 'tmpdir'
|
5
3
|
require 'fileutils'
|
@@ -24,7 +22,7 @@ class PDFMakerCmdTest < Test::Unit::TestCase
|
|
24
22
|
def test_pdfmaker_cmd
|
25
23
|
if /mswin|mingw|cygwin/ !~ RUBY_PLATFORM
|
26
24
|
config = prepare_samplebook(@tmpdir1)
|
27
|
-
builddir = @tmpdir1 +
|
25
|
+
builddir = @tmpdir1 + '/' + config['bookname'] + '-pdf'
|
28
26
|
assert !File.exist?(builddir)
|
29
27
|
|
30
28
|
ruby_cmd = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
|
data/test/test_review_ext.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'test_helper'
|
4
2
|
require 'book_test_helper'
|
5
3
|
require 'review/compiler'
|
@@ -22,11 +20,11 @@ end
|
|
22
20
|
|
23
21
|
ReVIEW::Book::Base.clear_rubyenv ## to load review-ext.rb
|
24
22
|
mktmpbookdir('CHAPS' => "ch01.re\n",
|
25
|
-
|
26
|
-
|
23
|
+
'ch01.re' => "= test\n\ntest.\n",
|
24
|
+
'review-ext.rb' => review_ext) do |_dir, _book, _files|
|
27
25
|
builder = ReVIEW::HTMLBuilder.new(false)
|
28
26
|
ReVIEW::Compiler.new(builder)
|
29
|
-
assert_equal
|
27
|
+
assert_equal 'test', builder.builder_init_test
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
data/test/test_rstbuilder.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'test_helper'
|
4
2
|
require 'review/compiler'
|
5
3
|
require 'review/book'
|
@@ -10,12 +8,10 @@ class RSTBuidlerTest < Test::Unit::TestCase
|
|
10
8
|
include ReVIEW
|
11
9
|
|
12
10
|
def setup
|
13
|
-
@builder = RSTBuilder.new
|
11
|
+
@builder = RSTBuilder.new
|
14
12
|
@config = ReVIEW::Configure.values
|
15
|
-
@config
|
16
|
-
|
17
|
-
"language" => "ja",
|
18
|
-
})
|
13
|
+
@config['secnolevel'] = 2
|
14
|
+
@config['language'] = 'ja'
|
19
15
|
@book = Book::Base.new(nil)
|
20
16
|
@book.config = @config
|
21
17
|
@compiler = ReVIEW::Compiler.new(@builder)
|
@@ -29,182 +25,182 @@ class RSTBuidlerTest < Test::Unit::TestCase
|
|
29
25
|
puts msg
|
30
26
|
end
|
31
27
|
end
|
32
|
-
I18n.setup(@config[
|
28
|
+
I18n.setup(@config['language'])
|
33
29
|
end
|
34
30
|
|
35
31
|
def test_headline_level1
|
36
32
|
actual = compile_block("={test} this is test.\n")
|
37
|
-
assert_equal %Q
|
33
|
+
assert_equal %Q(.. _test:\n\n==========================\nthis is test.\n==========================\n\n), actual
|
38
34
|
end
|
39
35
|
|
40
36
|
def test_headline_level1_without_secno
|
41
|
-
@config[
|
37
|
+
@config['secnolevel'] = 0
|
42
38
|
actual = compile_block("={test} this is test.\n")
|
43
|
-
assert_equal %Q
|
39
|
+
assert_equal %Q(.. _test:\n\n==========================\nthis is test.\n==========================\n\n), actual
|
44
40
|
end
|
45
41
|
|
46
42
|
def test_headline_level2
|
47
43
|
actual = compile_block("=={test} this is test.\n")
|
48
|
-
assert_equal %Q
|
44
|
+
assert_equal %Q(.. _test:\n\nthis is test.\n==========================\n\n), actual
|
49
45
|
end
|
50
46
|
|
51
47
|
def test_headline_level3
|
52
48
|
actual = compile_block("==={test} this is test.\n")
|
53
|
-
assert_equal %Q
|
49
|
+
assert_equal %Q(.. _test:\n\nthis is test.\n--------------------------\n\n), actual
|
54
50
|
end
|
55
51
|
|
56
52
|
def test_headline_level3_with_secno
|
57
|
-
@config[
|
53
|
+
@config['secnolevel'] = 3
|
58
54
|
actual = compile_block("==={test} this is test.\n")
|
59
|
-
assert_equal %Q
|
55
|
+
assert_equal %Q(.. _test:\n\nthis is test.\n--------------------------\n\n), actual
|
60
56
|
end
|
61
57
|
|
62
58
|
def test_href
|
63
|
-
actual = compile_inline(
|
64
|
-
assert_equal %Q
|
59
|
+
actual = compile_inline('@<href>{http://github.com, GitHub}')
|
60
|
+
assert_equal %Q( `GitHub <http://github.com>`_ ), actual
|
65
61
|
end
|
66
62
|
|
67
63
|
def test_href_without_label
|
68
|
-
actual = compile_inline(
|
69
|
-
assert_equal
|
64
|
+
actual = compile_inline('@<href>{http://github.com}')
|
65
|
+
assert_equal ' `http://github.com <http://github.com>`_ ', actual
|
70
66
|
end
|
71
67
|
|
72
68
|
def test_inline_raw
|
73
|
-
actual = compile_inline(
|
74
|
-
assert_equal
|
69
|
+
actual = compile_inline('@<raw>{@<tt>{inline\}}')
|
70
|
+
assert_equal '@<tt>{inline}', actual
|
75
71
|
end
|
76
72
|
|
77
73
|
def test_inline_ruby
|
78
|
-
actual = compile_inline(
|
79
|
-
assert_equal
|
74
|
+
actual = compile_inline('@<ruby>{coffin,bed}')
|
75
|
+
assert_equal ' :ruby:`coffin`<bed>`_ ', actual
|
80
76
|
end
|
81
77
|
|
82
78
|
def test_inline_kw
|
83
|
-
actual = compile_inline(
|
84
|
-
assert_equal
|
79
|
+
actual = compile_inline('@<kw>{ISO, International Organization for Standardization } @<kw>{Ruby<>}')
|
80
|
+
assert_equal ' **ISO(International Organization for Standardization)** **Ruby<>** ', actual
|
85
81
|
end
|
86
82
|
|
87
83
|
def test_inline_maru
|
88
|
-
actual = compile_inline(
|
89
|
-
assert_equal
|
84
|
+
actual = compile_inline('@<maru>{1}@<maru>{20}@<maru>{A}@<maru>{z}')
|
85
|
+
assert_equal ' :maru:`1` :maru:`20` :maru:`A` :maru:`z` ', actual
|
90
86
|
end
|
91
87
|
|
92
88
|
def test_inline_br
|
93
|
-
actual = compile_inline(
|
94
|
-
assert_equal
|
89
|
+
actual = compile_inline('@<br>{}')
|
90
|
+
assert_equal "\n", actual
|
95
91
|
end
|
96
92
|
|
97
93
|
def test_inline_i
|
98
|
-
actual = compile_inline(
|
99
|
-
assert_equal
|
94
|
+
actual = compile_inline('test @<i>{inline test} test2')
|
95
|
+
assert_equal 'test *inline test* test2', actual
|
100
96
|
end
|
101
97
|
|
102
98
|
def test_inline_i_and_escape
|
103
|
-
actual = compile_inline(
|
104
|
-
assert_equal
|
99
|
+
actual = compile_inline('test @<i>{inline<&;\\ test} test2')
|
100
|
+
assert_equal 'test *inline<&;\\ test* test2', actual
|
105
101
|
end
|
106
102
|
|
107
103
|
def test_inline_b
|
108
|
-
actual = compile_inline(
|
109
|
-
assert_equal
|
104
|
+
actual = compile_inline('test @<b>{inline test} test2')
|
105
|
+
assert_equal 'test **inline test** test2', actual
|
110
106
|
end
|
111
107
|
|
112
108
|
def test_inline_b_and_escape
|
113
|
-
actual = compile_inline(
|
114
|
-
assert_equal
|
109
|
+
actual = compile_inline('test @<b>{inline<&;\\ test} test2')
|
110
|
+
assert_equal 'test **inline<&;\\ test** test2', actual
|
115
111
|
end
|
116
112
|
|
117
113
|
def test_inline_tt
|
118
|
-
actual = compile_inline(
|
119
|
-
assert_equal
|
114
|
+
actual = compile_inline('test @<tt>{inline test} test2@<tt>{\\}}')
|
115
|
+
assert_equal 'test ``inline test`` test2 ``}`` ', actual
|
120
116
|
end
|
121
117
|
|
122
118
|
def test_inline_tti
|
123
|
-
actual = compile_inline(
|
124
|
-
assert_equal
|
119
|
+
actual = compile_inline('test @<tti>{inline test} test2')
|
120
|
+
assert_equal 'test ``inline test`` test2', actual
|
125
121
|
end
|
126
122
|
|
127
123
|
def test_inline_ttb
|
128
|
-
actual = compile_inline(
|
129
|
-
assert_equal
|
124
|
+
actual = compile_inline('test @<ttb>{inline test} test2')
|
125
|
+
assert_equal 'test ``inline test`` test2', actual
|
130
126
|
end
|
131
127
|
|
132
128
|
def test_inline_uchar
|
133
|
-
actual = compile_inline(
|
134
|
-
assert_equal
|
129
|
+
actual = compile_inline('test @<uchar>{2460} test2')
|
130
|
+
assert_equal 'test ① test2', actual
|
135
131
|
end
|
136
132
|
|
137
133
|
def test_inline_comment
|
138
|
-
actual = compile_inline(
|
139
|
-
assert_equal
|
134
|
+
actual = compile_inline('test @<comment>{コメント} test2')
|
135
|
+
assert_equal 'test test2', actual
|
140
136
|
end
|
141
137
|
|
142
138
|
def test_inline_comment_for_draft
|
143
|
-
@config[
|
144
|
-
actual = compile_inline(
|
145
|
-
assert_equal
|
139
|
+
@config['draft'] = true
|
140
|
+
actual = compile_inline('test @<comment>{コメント} test2')
|
141
|
+
assert_equal 'test コメント test2', actual
|
146
142
|
end
|
147
143
|
|
148
144
|
def test_inline_in_table
|
149
145
|
actual = compile_block("//table{\n★1☆\t▲2☆\n------------\n★3☆\t▲4☆<>&\n//}\n")
|
150
|
-
assert_equal %Q
|
146
|
+
assert_equal %Q( * - ★1☆\n - ▲2☆\n * - ★3☆\n - ▲4☆<>&\n\n), actual
|
151
147
|
end
|
152
148
|
|
153
149
|
def test_emtable
|
154
150
|
actual = compile_block("//emtable[foo]{\nA\n//}\n//emtable{\nA\n//}")
|
155
|
-
assert_equal %Q
|
151
|
+
assert_equal %Q(.. list-table:: foo\n :header-rows: 1\n\n * - A\n\n * - A\n\n), actual
|
156
152
|
end
|
157
153
|
|
158
154
|
def test_paragraph
|
159
155
|
actual = compile_block("foo\nbar\n")
|
160
|
-
assert_equal %Q
|
156
|
+
assert_equal %Q(foobar\n\n), actual
|
161
157
|
end
|
162
158
|
|
163
159
|
def test_tabbed_paragraph
|
164
160
|
actual = compile_block("\tfoo\nbar\n")
|
165
|
-
assert_equal %Q
|
161
|
+
assert_equal %Q(\tfoobar\n\n), actual
|
166
162
|
end
|
167
163
|
|
168
164
|
def test_flushright
|
169
165
|
actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
|
170
|
-
assert_equal %Q
|
166
|
+
assert_equal %Q(.. flushright::\n\n foobar\nbuz\n\n), actual
|
171
167
|
end
|
172
168
|
|
173
169
|
def test_noindent
|
174
170
|
actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
|
175
|
-
assert_equal %Q
|
171
|
+
assert_equal %Q(foobar\n\nfoo2bar2\n\n), actual
|
176
172
|
end
|
177
173
|
|
178
174
|
def test_comment
|
179
|
-
actual = compile_block(
|
180
|
-
assert_equal
|
175
|
+
actual = compile_block('//comment[コメント]')
|
176
|
+
assert_equal "\n", actual
|
181
177
|
end
|
182
178
|
|
183
179
|
def test_comment_for_draft
|
184
|
-
@config[
|
185
|
-
actual = compile_block(
|
186
|
-
assert_equal
|
180
|
+
@config['draft'] = true
|
181
|
+
actual = compile_block('//comment[コメント]')
|
182
|
+
assert_equal "\n", actual
|
187
183
|
end
|
188
184
|
|
189
185
|
def test_list
|
190
|
-
def @chapter.list(
|
191
|
-
Book::ListIndex::Item.new(
|
186
|
+
def @chapter.list(_id)
|
187
|
+
Book::ListIndex::Item.new('test', 1)
|
192
188
|
end
|
193
189
|
actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
194
|
-
assert_equal %Q
|
190
|
+
assert_equal %Q(.. _samplelist:\n\n-foo\n-bar\n), actual
|
195
191
|
end
|
196
192
|
|
197
193
|
def test_listnum
|
198
|
-
def @chapter.list(
|
199
|
-
Book::ListIndex::Item.new(
|
194
|
+
def @chapter.list(_id)
|
195
|
+
Book::ListIndex::Item.new('test', 1)
|
200
196
|
end
|
201
197
|
actual = compile_block("//listnum[test][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
202
|
-
assert_equal %Q
|
198
|
+
assert_equal %Q(.. _test:\n\n1\n2\n\n), actual
|
203
199
|
end
|
204
200
|
|
205
201
|
def test_emlistnum
|
206
202
|
actual = compile_block("//emlistnum[this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
207
|
-
assert_equal %Q
|
203
|
+
assert_equal %Q(this is @<b>{test}<&>_\n\n.. code-block:: none\n :linenos:\n\n foo\n bar\n\n), actual
|
208
204
|
end
|
209
205
|
|
210
206
|
def test_major_blocks
|
@@ -242,25 +238,25 @@ class RSTBuidlerTest < Test::Unit::TestCase
|
|
242
238
|
end
|
243
239
|
|
244
240
|
def test_image
|
245
|
-
def @chapter.image(
|
246
|
-
item = Book::ImageIndex::Item.new(
|
247
|
-
item.instance_eval{@path=
|
241
|
+
def @chapter.image(_id)
|
242
|
+
item = Book::ImageIndex::Item.new('sampleimg', 1)
|
243
|
+
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
248
244
|
item
|
249
245
|
end
|
250
246
|
|
251
247
|
actual = compile_block("//image[sampleimg][sample photo]{\nfoo\n//}\n")
|
252
|
-
assert_equal %Q
|
248
|
+
assert_equal %Q(.. _sampleimg:\n\n.. figure:: images/-/sampleimg.png\n\n sample photo\n\n), actual
|
253
249
|
end
|
254
250
|
|
255
251
|
def test_image_with_metric
|
256
|
-
def @chapter.image(
|
257
|
-
item = Book::ImageIndex::Item.new(
|
258
|
-
item.instance_eval{@path=
|
252
|
+
def @chapter.image(_id)
|
253
|
+
item = Book::ImageIndex::Item.new('sampleimg', 1)
|
254
|
+
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
259
255
|
item
|
260
256
|
end
|
261
257
|
|
262
258
|
actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\nfoo\n//}\n")
|
263
|
-
assert_equal %Q
|
259
|
+
assert_equal %Q(.. _sampleimg:\n\n.. figure:: images/-/sampleimg.png\n :scale:120.0%\n\n sample photo\n\n), actual
|
264
260
|
end
|
265
261
|
|
266
262
|
def test_texequation
|
@@ -275,57 +271,57 @@ EOS
|
|
275
271
|
end
|
276
272
|
|
277
273
|
def test_inline_raw0
|
278
|
-
assert_equal
|
274
|
+
assert_equal 'normal', compile_inline('@<raw>{normal}')
|
279
275
|
end
|
280
276
|
|
281
277
|
def test_inline_raw1
|
282
|
-
assert_equal
|
278
|
+
assert_equal 'body', compile_inline('@<raw>{|top|body}')
|
283
279
|
end
|
284
280
|
|
285
281
|
def test_inline_raw2
|
286
|
-
assert_equal
|
282
|
+
assert_equal 'body', compile_inline('@<raw>{|top, latex|body}')
|
287
283
|
end
|
288
284
|
|
289
285
|
def test_inline_raw3
|
290
|
-
assert_equal
|
286
|
+
assert_equal 'body', compile_inline('@<raw>{|idgxml, html|body}')
|
291
287
|
end
|
292
288
|
|
293
289
|
def test_inline_raw4
|
294
|
-
assert_equal
|
290
|
+
assert_equal '|top body', compile_inline('@<raw>{|top body}')
|
295
291
|
end
|
296
292
|
|
297
293
|
def test_inline_raw5
|
298
|
-
assert_equal "nor\nmal", compile_inline(
|
294
|
+
assert_equal "nor\nmal", compile_inline('@<raw>{|top|nor\\nmal}')
|
299
295
|
end
|
300
296
|
|
301
297
|
def test_block_raw0
|
302
|
-
actual = compile_block(
|
303
|
-
expected = %Q(
|
304
|
-
assert_equal expected
|
298
|
+
actual = compile_block(%Q(//raw[<>!"\\n& ]\n))
|
299
|
+
expected = %Q(<>!"\n& )
|
300
|
+
assert_equal expected, actual
|
305
301
|
end
|
306
302
|
|
307
303
|
def test_block_raw1
|
308
|
-
actual = compile_block(
|
304
|
+
actual = compile_block(%Q(//raw[|top|<>!"\\n& ]\n))
|
309
305
|
expected = ''
|
310
|
-
assert_equal expected
|
306
|
+
assert_equal expected, actual
|
311
307
|
end
|
312
308
|
|
313
309
|
def test_block_raw2
|
314
|
-
actual = compile_block(
|
310
|
+
actual = compile_block(%Q(//raw[|top, latex|<>!"\\n& ]\n))
|
315
311
|
expected = ''
|
316
|
-
assert_equal expected
|
312
|
+
assert_equal expected, actual
|
317
313
|
end
|
318
314
|
|
319
315
|
def test_block_raw3
|
320
|
-
actual = compile_block(
|
316
|
+
actual = compile_block(%Q(//raw[|latex, idgxml|<>!"\\n& ]\n))
|
321
317
|
expected = ''
|
322
|
-
assert_equal expected
|
318
|
+
assert_equal expected, actual
|
323
319
|
end
|
324
320
|
|
325
321
|
def test_block_raw4
|
326
|
-
actual = compile_block(
|
327
|
-
expected = %Q(|top
|
328
|
-
assert_equal expected
|
322
|
+
actual = compile_block(%Q(//raw[|top <>!"\\n& ]\n))
|
323
|
+
expected = %Q(|top <>!"\n& )
|
324
|
+
assert_equal expected, actual
|
329
325
|
end
|
330
326
|
|
331
327
|
def column_helper(review)
|
@@ -333,7 +329,7 @@ EOS
|
|
333
329
|
end
|
334
330
|
|
335
331
|
def test_column_ref
|
336
|
-
review
|
332
|
+
review = <<-EOS
|
337
333
|
===[column]{foo} test
|
338
334
|
|
339
335
|
inside column
|
@@ -342,7 +338,7 @@ inside column
|
|
342
338
|
|
343
339
|
this is @<column>{foo}.
|
344
340
|
EOS
|
345
|
-
expected
|
341
|
+
expected = <<-EOS
|
346
342
|
.. column:: test
|
347
343
|
|
348
344
|
inside column
|
@@ -357,5 +353,4 @@ EOS
|
|
357
353
|
|
358
354
|
assert_equal expected, column_helper(review)
|
359
355
|
end
|
360
|
-
|
361
356
|
end
|
data/test/test_template.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'test_helper'
|
4
2
|
require 'review/template'
|
5
3
|
|
@@ -13,15 +11,13 @@ class TemplateTest < Test::Unit::TestCase
|
|
13
11
|
def test_load
|
14
12
|
tmplfile = File.expand_path('./assets/test.xml.erb', File.dirname(__FILE__))
|
15
13
|
tmpl = ReVIEW::Template.load(tmplfile)
|
16
|
-
assert_equal("<test>\n<name></name>\n</test>\n",tmpl.result(binding))
|
14
|
+
assert_equal("<test>\n<name></name>\n</test>\n", tmpl.result(binding))
|
17
15
|
end
|
18
16
|
|
19
17
|
def test_open_with_value
|
20
18
|
tmplfile = File.expand_path('./assets/test.xml.erb', File.dirname(__FILE__))
|
21
19
|
tmpl = ReVIEW::Template.load(tmplfile)
|
22
|
-
@name =
|
23
|
-
assert_equal("<test>\n<name>test</name>\n</test>\n",tmpl.result(binding))
|
20
|
+
@name = 'test'
|
21
|
+
assert_equal("<test>\n<name>test</name>\n</test>\n", tmpl.result(binding))
|
24
22
|
end
|
25
23
|
end
|
26
|
-
|
27
|
-
|