review 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +42 -0
- data/README.rdoc +31 -0
- data/bin/review-catalog-converter +129 -0
- data/bin/review-check +4 -2
- data/bin/review-compile +7 -7
- data/bin/review-index +4 -3
- data/bin/review-init +3 -1
- data/bin/review-pdfmaker +2 -258
- data/bin/review-vol +2 -2
- data/doc/catalog.rdoc +18 -3
- data/doc/format.rdoc +2 -3
- data/doc/quickstart.rdoc +1 -1
- data/lib/epubmaker/epubv2.rb +16 -8
- data/lib/epubmaker/epubv3.rb +44 -12
- data/lib/epubmaker/producer.rb +4 -2
- data/lib/review/book.rb +0 -1
- data/lib/review/book/base.rb +72 -35
- data/lib/review/book/chapter.rb +8 -12
- data/lib/review/book/compilable.rb +8 -8
- data/lib/review/book/image_finder.rb +7 -0
- data/lib/review/book/index.rb +23 -5
- data/lib/review/book/volume.rb +2 -1
- data/lib/review/builder.rb +10 -5
- data/lib/review/catalog.rb +5 -0
- data/lib/review/compiler.rb +1 -1
- data/lib/review/configure.rb +12 -0
- data/lib/review/epubmaker.rb +13 -7
- data/lib/review/htmlbuilder.rb +26 -12
- data/lib/review/i18n.rb +2 -2
- data/lib/review/i18n.yml +21 -0
- data/lib/review/idgxmlbuilder.rb +11 -9
- data/lib/review/latexbuilder.rb +3 -2
- data/lib/review/{review.tex.erb → layout.tex.erb} +9 -1
- data/lib/review/markdownbuilder.rb +126 -4
- data/lib/review/pdfmaker.rb +291 -0
- data/lib/review/tocparser.rb +6 -5
- data/lib/review/tocprinter.rb +5 -2
- data/lib/review/version.rb +1 -1
- data/review.gemspec +1 -1
- data/rubocop-todo.yml +13 -0
- data/test/test_book.rb +95 -133
- data/test/test_book_chapter.rb +16 -21
- data/test/test_builder.rb +12 -7
- data/test/test_catalog.rb +15 -3
- data/test/test_catalog_converter_cmd.rb +73 -0
- data/test/test_epubmaker.rb +5 -5
- data/test/test_helper.rb +32 -21
- data/test/test_htmlbuilder.rb +219 -192
- data/test/test_i18n.rb +46 -19
- data/test/test_idgxmlbuilder.rb +177 -182
- data/test/test_inaobuilder.rb +1 -2
- data/test/test_index.rb +20 -0
- data/test/test_latexbuilder.rb +175 -183
- data/test/test_markdownbuilder.rb +41 -5
- data/test/test_pdfmaker.rb +130 -0
- data/test/test_topbuilder.rb +92 -96
- metadata +10 -6
- data/lib/review/book/parameters.rb +0 -98
- data/test/test_book_parameter.rb +0 -42
data/test/test_i18n.rb
CHANGED
@@ -5,45 +5,70 @@ require 'review/i18n'
|
|
5
5
|
require 'review/compiler'
|
6
6
|
require 'review/book'
|
7
7
|
require 'review/htmlbuilder'
|
8
|
+
require 'tmpdir'
|
8
9
|
|
9
10
|
class I18nTest < Test::Unit::TestCase
|
10
11
|
include ReVIEW
|
11
12
|
|
13
|
+
if RUBY_VERSION !~ /^1.8/ ## to avoid Travis error :-(
|
14
|
+
def test_load_locale_yml
|
15
|
+
Dir.mktmpdir do |dir|
|
16
|
+
Dir.chdir(dir) do
|
17
|
+
file = File.join(dir, "locale.yml")
|
18
|
+
File.open(file, "w"){|f| f.write("locale: ja\nfoo: \"bar\"\n")}
|
19
|
+
I18n.setup
|
20
|
+
assert_equal "bar", I18n.t("foo")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_load_locale_yaml
|
26
|
+
Dir.mktmpdir do |dir|
|
27
|
+
Dir.chdir(dir) do
|
28
|
+
file = File.join(dir, "locale.yaml")
|
29
|
+
File.open(file, "w"){|f| f.write("locale: ja\nfoo: \"bar\"\n")}
|
30
|
+
I18n.setup
|
31
|
+
assert_equal "bar", I18n.t("foo")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
12
37
|
def test_ja
|
13
38
|
I18n.i18n "ja"
|
14
|
-
assert_equal I18n.t("image")
|
15
|
-
assert_equal I18n.t("table")
|
16
|
-
assert_equal I18n.t("chapter", 1)
|
17
|
-
assert_equal I18n.t("etc")
|
39
|
+
assert_equal "図", I18n.t("image")
|
40
|
+
assert_equal "表", I18n.t("table")
|
41
|
+
assert_equal "第1章", I18n.t("chapter", 1)
|
42
|
+
assert_equal "etc", I18n.t("etc")
|
18
43
|
end
|
19
44
|
|
20
45
|
def test_ja_with_user_i18n
|
21
46
|
I18n.i18n "ja", {"image" => "ず"}
|
22
|
-
assert_equal I18n.t("image")
|
23
|
-
assert_equal I18n.t("table")
|
24
|
-
assert_equal I18n.t("chapter", 1)
|
25
|
-
assert_equal I18n.t("etc")
|
47
|
+
assert_equal "ず", I18n.t("image")
|
48
|
+
assert_equal "表", I18n.t("table")
|
49
|
+
assert_equal "第1章", I18n.t("chapter", 1)
|
50
|
+
assert_equal "etc", I18n.t("etc")
|
26
51
|
end
|
27
52
|
|
28
53
|
def test_en
|
29
54
|
I18n.i18n "en"
|
30
|
-
assert_equal I18n.t("image")
|
31
|
-
assert_equal I18n.t("table")
|
32
|
-
assert_equal I18n.t("chapter", 1)
|
33
|
-
assert_equal I18n.t("etc")
|
55
|
+
assert_equal "Figure ", I18n.t("image")
|
56
|
+
assert_equal "Table ", I18n.t("table")
|
57
|
+
assert_equal "Chapter 1", I18n.t("chapter", 1)
|
58
|
+
assert_equal "etc", I18n.t("etc")
|
34
59
|
end
|
35
60
|
|
36
61
|
def test_nil
|
37
62
|
I18n.i18n "nil"
|
38
|
-
assert_equal I18n.t("image")
|
39
|
-
assert_equal I18n.t("table")
|
40
|
-
assert_equal I18n.t("etc")
|
63
|
+
assert_equal "image", I18n.t("image")
|
64
|
+
assert_equal "table", I18n.t("table")
|
65
|
+
assert_equal "etc", I18n.t("etc")
|
41
66
|
end
|
42
67
|
|
43
68
|
def test_htmlbuilder
|
44
69
|
_setup_htmlbuilder
|
45
|
-
|
46
|
-
assert_equal %Q|<h1 id="test"><a id="h1"></a>Chapter 1. this is test.</h1>\n|,
|
70
|
+
actual = compile_block("={test} this is test.\n")
|
71
|
+
assert_equal %Q|<h1 id="test"><a id="h1"></a>Chapter 1. this is test.</h1>\n|, actual
|
47
72
|
end
|
48
73
|
|
49
74
|
def _setup_htmlbuilder
|
@@ -54,10 +79,12 @@ class I18nTest < Test::Unit::TestCase
|
|
54
79
|
"inencoding" => "UTF-8",
|
55
80
|
"outencoding" => "UTF-8",
|
56
81
|
"stylesheet" => nil, # for HTMLBuilder
|
82
|
+
"ext" => ".re"
|
57
83
|
}
|
58
|
-
|
84
|
+
@book = Book::Base.new(".")
|
85
|
+
@book.config = @config
|
59
86
|
@compiler = ReVIEW::Compiler.new(@builder)
|
60
|
-
@chapter = Book::Chapter.new(
|
87
|
+
@chapter = Book::Chapter.new(@book, 1, '-', nil, StringIO.new)
|
61
88
|
location = Location.new(nil, nil)
|
62
89
|
@builder.bind(@compiler, @chapter, location)
|
63
90
|
end
|
data/test/test_idgxmlbuilder.rb
CHANGED
@@ -11,243 +11,241 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
11
11
|
|
12
12
|
def setup
|
13
13
|
@builder = IDGXMLBuilder.new()
|
14
|
-
@config =
|
14
|
+
@config = ReVIEW::Configure.values
|
15
|
+
@config.merge!({
|
15
16
|
"secnolevel" => 2,
|
16
17
|
"inencoding" => "UTF-8",
|
17
18
|
"outencoding" => "UTF-8",
|
18
19
|
"nolf" => true,
|
19
20
|
"tableopt" => "10"
|
20
|
-
}
|
21
|
-
|
21
|
+
})
|
22
|
+
@book = Book::Base.new(nil)
|
23
|
+
@book.config = @config
|
22
24
|
@compiler = ReVIEW::Compiler.new(@builder)
|
23
|
-
@chapter = Book::Chapter.new(
|
25
|
+
@chapter = Book::Chapter.new(@book, 1, '-', nil, StringIO.new)
|
24
26
|
location = Location.new(nil, nil)
|
25
27
|
@builder.bind(@compiler, @chapter, location)
|
26
28
|
end
|
27
29
|
|
28
30
|
def test_headline_level1
|
29
|
-
|
30
|
-
assert_equal %Q
|
31
|
+
actual = compile_block("={test} this is test.\n")
|
32
|
+
assert_equal %Q|<title id="test" aid:pstyle="h1">第1章 this is test.</title><?dtp level="1" section="第1章 this is test."?>|, actual
|
31
33
|
end
|
32
34
|
|
33
35
|
def test_headline_level1_without_secno
|
34
36
|
@config["secnolevel"] = 0
|
35
|
-
|
36
|
-
assert_equal %Q
|
37
|
+
actual = compile_block("={test} this is test.\n")
|
38
|
+
assert_equal %Q|<title id="test" aid:pstyle="h1">this is test.</title><?dtp level="1" section="this is test."?>|, actual
|
37
39
|
end
|
38
40
|
|
39
41
|
def test_headline_level2
|
40
|
-
|
41
|
-
assert_equal %Q
|
42
|
+
actual = compile_block("=={test} this is test.\n")
|
43
|
+
assert_equal %Q|<title id="test" aid:pstyle="h2">1.1 this is test.</title><?dtp level="2" section="1.1 this is test."?>|, actual
|
42
44
|
end
|
43
45
|
|
44
46
|
def test_headline_level3
|
45
|
-
|
46
|
-
assert_equal %Q
|
47
|
+
actual = compile_block("==={test} this is test.\n")
|
48
|
+
assert_equal %Q|<title id="test" aid:pstyle="h3">this is test.</title><?dtp level="3" section="this is test."?>|, actual
|
47
49
|
end
|
48
50
|
|
49
51
|
|
50
52
|
def test_headline_level3_with_secno
|
51
53
|
@config["secnolevel"] = 3
|
52
|
-
|
53
|
-
assert_equal %Q
|
54
|
+
actual = compile_block("==={test} this is test.\n")
|
55
|
+
assert_equal %Q|<title id="test" aid:pstyle="h3">1.0.1 this is test.</title><?dtp level="3" section="1.0.1 this is test."?>|, actual
|
54
56
|
end
|
55
57
|
|
56
58
|
def test_label
|
57
|
-
|
58
|
-
assert_equal %Q
|
59
|
+
actual = compile_block("//label[label_test]\n")
|
60
|
+
assert_equal %Q|<label id='label_test' />|, actual
|
59
61
|
end
|
60
62
|
|
61
63
|
def test_inline_ref
|
62
|
-
|
63
|
-
assert_equal %Q|<ref idref='外部参照<>&'>「●● 外部参照<>&」</ref>|,
|
64
|
+
actual = compile_inline("@<ref>{外部参照<>&}")
|
65
|
+
assert_equal %Q|<ref idref='外部参照<>&'>「●● 外部参照<>&」</ref>|, actual
|
64
66
|
end
|
65
67
|
|
66
68
|
def test_href
|
67
|
-
|
68
|
-
assert_equal %Q|<a linkurl='http://github.com'>GitHub</a>|,
|
69
|
+
actual = compile_inline("@<href>{http://github.com,GitHub}")
|
70
|
+
assert_equal %Q|<a linkurl='http://github.com'>GitHub</a>|, actual
|
69
71
|
end
|
70
72
|
|
71
73
|
def test_href_without_label
|
72
|
-
|
73
|
-
assert_equal %Q|<a linkurl='http://github.com'>http://github.com</a>|,
|
74
|
+
actual = compile_inline("@<href>{http://github.com}")
|
75
|
+
assert_equal %Q|<a linkurl='http://github.com'>http://github.com</a>|, actual
|
74
76
|
end
|
75
77
|
|
76
78
|
def test_inline_href
|
77
|
-
|
78
|
-
assert_equal %Q|<a linkurl='http://github.com'>Git,Hub</a>|,
|
79
|
+
actual = compile_inline("@<href>{http://github.com, Git\\,Hub}")
|
80
|
+
assert_equal %Q|<a linkurl='http://github.com'>Git,Hub</a>|, actual
|
79
81
|
end
|
80
82
|
|
81
83
|
def test_inline_raw
|
82
|
-
|
83
|
-
assert_equal %Q|@<tt>{inline}|,
|
84
|
+
actual = compile_inline("@<raw>{@<tt>{inline\}}")
|
85
|
+
assert_equal %Q|@<tt>{inline}|, actual
|
84
86
|
end
|
85
87
|
|
86
88
|
def test_inline_in_table
|
87
|
-
|
88
|
-
assert_equal %Q
|
89
|
+
actual = compile_block("//table{\n@<b>{1}\t@<i>{2}\n------------\n@<b>{3}\t@<i>{4}<>&\n//}\n")
|
90
|
+
assert_equal %Q|<table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="2" aid:tcols="2"><td xyh="1,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><b>1</b></td><td xyh="2,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><i>2</i></td><td xyh="1,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><b>3</b></td><td xyh="2,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><i>4</i><>&</td></tbody></table>|, actual
|
89
91
|
end
|
90
92
|
|
91
93
|
def test_inline_in_table_without_header
|
92
|
-
|
93
|
-
assert_equal %Q
|
94
|
+
actual = compile_block("//table{\n@<b>{1}\t@<i>{2}\n@<b>{3}\t@<i>{4}<>&\n//}\n")
|
95
|
+
assert_equal %Q|<table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="2" aid:tcols="2"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><b>1</b></td><td xyh="2,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><i>2</i></td><td xyh="1,2,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><b>3</b></td><td xyh="2,2,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.2450142450142"><i>4</i><>&</td></tbody></table>|, actual
|
94
96
|
end
|
95
97
|
|
96
98
|
def test_inline_in_table_without_cellwidth
|
97
99
|
@config["tableopt"] = nil
|
98
|
-
|
99
|
-
assert_equal %Q
|
100
|
+
actual = compile_block("//table{\n@<b>{1}\t@<i>{2}\n------------\n@<b>{3}\t@<i>{4}<>&\n//}\n")
|
101
|
+
assert_equal %Q|<table><tbody><tr type="header"><b>1</b>\t<i>2</i></tr><tr type="lastline"><b>3</b>\t<i>4</i><>&</tr></tbody></table>|, actual
|
100
102
|
@config["tableopt"] = 10
|
101
103
|
end
|
102
104
|
|
103
105
|
def test_inline_in_table_without_header_and_cellwidth
|
104
106
|
@config["tableopt"] = nil
|
105
|
-
|
106
|
-
assert_equal %Q
|
107
|
+
actual = compile_block("//table{\n@<b>{1}\t@<i>{2}\n@<b>{3}\t@<i>{4}<>&\n//}\n")
|
108
|
+
assert_equal %Q|<table><tbody><tr><b>1</b>\t<i>2</i></tr><tr type="lastline"><b>3</b>\t<i>4</i><>&</tr></tbody></table>|, actual
|
107
109
|
@config["tableopt"] = 10
|
108
110
|
end
|
109
111
|
|
110
112
|
def test_inline_br
|
111
|
-
|
112
|
-
assert_equal %Q|\n|,
|
113
|
+
actual = compile_inline("@<br>{}")
|
114
|
+
assert_equal %Q|\n|, actual
|
113
115
|
end
|
114
116
|
|
115
117
|
def test_inline_uchar
|
116
|
-
|
117
|
-
assert_equal %Q|test ① test2|,
|
118
|
+
actual = compile_inline("test @<uchar>{2460} test2")
|
119
|
+
assert_equal %Q|test ① test2|, actual
|
118
120
|
end
|
119
121
|
|
120
122
|
def test_inline_ruby
|
121
|
-
|
122
|
-
assert_equal %Q|<GroupRuby><aid:ruby xmlns:aid="http://ns.adobe.com/AdobeInDesign/3.0/"><aid:rb>coffin</aid:rb><aid:rt>bed</aid:rt></aid:ruby></GroupRuby>|,
|
123
|
+
actual = compile_inline("@<ruby>{coffin, bed}")
|
124
|
+
assert_equal %Q|<GroupRuby><aid:ruby xmlns:aid="http://ns.adobe.com/AdobeInDesign/3.0/"><aid:rb>coffin</aid:rb><aid:rt>bed</aid:rt></aid:ruby></GroupRuby>|, actual
|
123
125
|
end
|
124
126
|
|
125
127
|
def test_inline_kw
|
126
|
-
|
127
|
-
assert_equal %Q|<keyword>ISO(International Organization for Standardization)</keyword><index value="ISO" /><index value="International Organization for Standardization" /> <keyword>Ruby<></keyword><index value="Ruby<>" />|,
|
128
|
+
actual = compile_inline("@<kw>{ISO, International Organization for Standardization } @<kw>{Ruby<>}")
|
129
|
+
assert_equal %Q|<keyword>ISO(International Organization for Standardization)</keyword><index value="ISO" /><index value="International Organization for Standardization" /> <keyword>Ruby<></keyword><index value="Ruby<>" />|, actual
|
128
130
|
end
|
129
131
|
|
130
132
|
def test_inline_maru
|
131
|
-
|
132
|
-
assert_equal %Q|①⑳Ⓐⓩ|,
|
133
|
+
actual = compile_inline("@<maru>{1}@<maru>{20}@<maru>{A}@<maru>{z}")
|
134
|
+
assert_equal %Q|①⑳Ⓐⓩ|, actual
|
133
135
|
end
|
134
136
|
|
135
137
|
def test_inline_ttb
|
136
|
-
|
137
|
-
assert_equal %Q|<tt style='bold'>test * <>"</tt><index value='test ESCAPED_ASTERISK <>"' />|,
|
138
|
+
actual = compile_inline("@<ttb>{test * <>\"}")
|
139
|
+
assert_equal %Q|<tt style='bold'>test * <>"</tt><index value='test ESCAPED_ASTERISK <>"' />|, actual
|
138
140
|
end
|
139
141
|
|
140
142
|
def test_inline_ttbold
|
141
|
-
|
142
|
-
assert_equal %Q|<tt style='bold'>test * <>"</tt><index value='test ESCAPED_ASTERISK <>"' />|,
|
143
|
+
actual = compile_inline("@<ttbold>{test * <>\"}")
|
144
|
+
assert_equal %Q|<tt style='bold'>test * <>"</tt><index value='test ESCAPED_ASTERISK <>"' />|, actual
|
143
145
|
end
|
144
146
|
|
145
147
|
def test_inline_balloon
|
146
|
-
|
147
|
-
assert_equal %Q|<balloon>①test</balloon>|,
|
148
|
+
actual = compile_inline("@<balloon>{@maru[1]test}")
|
149
|
+
assert_equal %Q|<balloon>①test</balloon>|, actual
|
148
150
|
end
|
149
151
|
|
150
152
|
def test_inline_m
|
151
|
-
|
152
|
-
assert_equal %Q|<replace idref="texinline-1"><pre>\\sin</pre></replace> <replace idref="texinline-2"><pre>\\frac{1}{2}</pre></replace>|,
|
153
|
+
actual = compile_inline("@<m>{\\sin} @<m>{\\frac{1\\}{2\\}}")
|
154
|
+
assert_equal %Q|<replace idref="texinline-1"><pre>\\sin</pre></replace> <replace idref="texinline-2"><pre>\\frac{1}{2}</pre></replace>|, actual
|
153
155
|
end
|
154
156
|
|
155
157
|
def test_paragraph
|
156
|
-
|
157
|
-
|
158
|
-
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><p>foobar</p>|, @builder.raw_result
|
158
|
+
actual = compile_block("foo\nbar\n")
|
159
|
+
assert_equal %Q|<p>foobar</p>|, actual
|
159
160
|
end
|
160
161
|
|
161
162
|
def test_tabbed_paragraph
|
162
|
-
|
163
|
-
|
164
|
-
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><p inlist="1">foobar</p>|, @builder.raw_result
|
163
|
+
actual = compile_block("\tfoo\nbar\n")
|
164
|
+
assert_equal %Q|<p inlist="1">foobar</p>|, actual
|
165
165
|
end
|
166
166
|
|
167
167
|
def test_quote
|
168
|
-
|
169
|
-
|
170
|
-
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><quote><p>foobar</p><p>buz</p></quote>|, @builder.raw_result
|
168
|
+
actual = compile_block("//quote{\nfoo\nbar\n\nbuz\n//}\n")
|
169
|
+
assert_equal %Q|<quote><p>foobar</p><p>buz</p></quote>|, actual
|
171
170
|
end
|
172
171
|
|
173
172
|
def test_quote_deprecated
|
174
|
-
|
175
|
-
|
176
|
-
@
|
177
|
-
|
178
|
-
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><quote>foo\n\nbuz</quote>|, @builder.raw_result
|
173
|
+
@book.config["deprecated-blocklines"] = true
|
174
|
+
actual = compile_block("//quote{\nfoo\n\nbuz\n//}\n")
|
175
|
+
@book.config["deprecated-blocklines"] = nil
|
176
|
+
assert_equal %Q|<quote>foo\n\nbuz</quote>|, actual
|
179
177
|
end
|
180
178
|
|
181
179
|
def test_note
|
182
|
-
|
183
|
-
assert_equal %Q
|
180
|
+
actual = compile_block("//note[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
181
|
+
assert_equal %Q|<note><title aid:pstyle='note-title'>this is <b>test</b><&>_</title><p>test1test1.5</p><p>test<i>2</i></p></note>|, actual
|
184
182
|
end
|
185
183
|
|
186
184
|
def test_memo
|
187
|
-
|
188
|
-
assert_equal %Q
|
185
|
+
actual = compile_block("//memo[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
186
|
+
assert_equal %Q|<memo><title aid:pstyle='memo-title'>this is <b>test</b><&>_</title><p>test1test1.5</p><p>test<i>2</i></p></memo>|, actual
|
189
187
|
end
|
190
188
|
|
191
189
|
def test_term
|
192
|
-
|
193
|
-
assert_equal %Q
|
190
|
+
actual = compile_block("//term{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
191
|
+
assert_equal %Q|<term><p>test1test1.5</p><p>test<i>2</i></p></term>|, actual
|
194
192
|
end
|
195
193
|
|
196
194
|
def test_term_deprecated
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
assert_equal %Q
|
195
|
+
@book.config["deprecated-blocklines"] = true
|
196
|
+
actual = compile_block("//term{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
197
|
+
@book.config["deprecated-blocklines"] = nil
|
198
|
+
assert_equal %Q|<term>test1\ntest1.5\n\ntest<i>2</i></term>|, actual
|
201
199
|
end
|
202
200
|
|
203
201
|
def test_notice
|
204
|
-
|
205
|
-
assert_equal %Q
|
202
|
+
actual = compile_block("//notice[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
203
|
+
assert_equal %Q|<notice-t><title aid:pstyle='notice-title'>this is <b>test</b><&>_</title><p>test1test1.5</p><p>test<i>2</i></p></notice-t>|, actual
|
206
204
|
end
|
207
205
|
|
208
206
|
def test_notice_without_caption
|
209
|
-
|
210
|
-
assert_equal %Q
|
207
|
+
actual = compile_block("//notice{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
208
|
+
assert_equal %Q|<notice><p>test1test1.5</p><p>test<i>2</i></p></notice>|, actual
|
211
209
|
end
|
212
210
|
|
213
211
|
def test_point
|
214
|
-
|
215
|
-
assert_equal %Q
|
212
|
+
actual = compile_block("//point[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
213
|
+
assert_equal %Q|<point-t><title aid:pstyle='point-title'>this is <b>test</b><&>_</title><p>test1test1.5</p><p>test<i>2</i></p></point-t>|, actual
|
216
214
|
end
|
217
215
|
|
218
216
|
def test_point_without_caption
|
219
|
-
|
220
|
-
assert_equal %Q
|
217
|
+
actual = compile_block("//point{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
218
|
+
assert_equal %Q|<point><p>test1test1.5</p><p>test<i>2</i></p></point>|, actual
|
221
219
|
end
|
222
220
|
|
223
221
|
def test_emlist
|
224
|
-
|
225
|
-
assert_equal %Q
|
222
|
+
actual = compile_block("//emlist[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
223
|
+
assert_equal %Q|<list type='emlist'><caption aid:pstyle='emlist-title'>this is <b>test</b><&>_</caption><pre>test1\ntest1.5\n\ntest<i>2</i>\n</pre></list>|, actual
|
226
224
|
end
|
227
225
|
|
228
226
|
def test_emlist_listinfo
|
229
227
|
@config["listinfo"] = true
|
230
|
-
|
231
|
-
assert_equal %Q
|
228
|
+
actual = compile_block("//emlist[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
229
|
+
assert_equal %Q|<list type='emlist'><caption aid:pstyle='emlist-title'>this is <b>test</b><&>_</caption><pre><listinfo line="1" begin="1">test1\n</listinfo><listinfo line="2">test1.5\n</listinfo><listinfo line="3">\n</listinfo><listinfo line="4" end="4">test<i>2</i>\n</listinfo></pre></list>|, actual
|
232
230
|
end
|
233
231
|
|
234
232
|
def test_emlist_with_tab
|
235
|
-
|
236
|
-
assert_equal %Q
|
233
|
+
actual = compile_block("//emlist[this is @<b>{test}<&>_]{\n\ttest1\n\t\ttest1.5\n\n\ttest@<i>{2}\n//}\n")
|
234
|
+
assert_equal %Q|<list type='emlist'><caption aid:pstyle='emlist-title'>this is <b>test</b><&>_</caption><pre> test1\n test1.5\n\n test<i>2</i>\n</pre></list>|, actual
|
237
235
|
end
|
238
236
|
|
239
237
|
def test_emlist_with_4tab
|
240
|
-
@
|
241
|
-
|
242
|
-
assert_equal %Q
|
238
|
+
@config["tabwidth"] = 4
|
239
|
+
actual = compile_block("//emlist[this is @<b>{test}<&>_]{\n\ttest1\n\t\ttest1.5\n\n\ttest@<i>{2}\n//}\n")
|
240
|
+
assert_equal %Q|<list type='emlist'><caption aid:pstyle='emlist-title'>this is <b>test</b><&>_</caption><pre> test1\n test1.5\n\n test<i>2</i>\n</pre></list>|, actual
|
243
241
|
end
|
244
242
|
|
245
243
|
def test_list
|
246
244
|
def @chapter.list(id)
|
247
245
|
Book::ListIndex::Item.new("samplelist",1)
|
248
246
|
end
|
249
|
-
|
250
|
-
assert_equal %Q
|
247
|
+
actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
248
|
+
assert_equal %Q|<codelist><caption>リスト1.1 this is <b>test</b><&>_</caption><pre>test1\ntest1.5\n\ntest<i>2</i>\n</pre></codelist>|, actual
|
251
249
|
end
|
252
250
|
|
253
251
|
def test_list_listinfo
|
@@ -255,39 +253,37 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
255
253
|
Book::ListIndex::Item.new("samplelist",1)
|
256
254
|
end
|
257
255
|
@config["listinfo"] = true
|
258
|
-
|
259
|
-
assert_equal %Q
|
256
|
+
actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
257
|
+
assert_equal %Q|<codelist><caption>リスト1.1 this is <b>test</b><&>_</caption><pre><listinfo line="1" begin="1">test1\n</listinfo><listinfo line="2">test1.5\n</listinfo><listinfo line="3">\n</listinfo><listinfo line="4" end="4">test<i>2</i>\n</listinfo></pre></codelist>|, actual
|
260
258
|
end
|
261
259
|
|
262
260
|
def test_insn
|
263
261
|
@config["listinfo"] = true
|
264
|
-
|
262
|
+
actual = compile_block("//insn[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
265
263
|
@config["listinfo"] = nil
|
266
|
-
assert_equal %Q
|
264
|
+
assert_equal %Q|<insn><floattitle type="insn">this is <b>test</b><&>_</floattitle><listinfo line="1" begin="1">test1\n</listinfo><listinfo line="2">test1.5\n</listinfo><listinfo line="3">\n</listinfo><listinfo line="4" end="4">test<i>2</i>\n</listinfo></insn>|, actual
|
267
265
|
end
|
268
266
|
|
269
267
|
def test_box
|
270
268
|
@config["listinfo"] = true
|
271
|
-
|
269
|
+
actual = compile_block("//box[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
272
270
|
@config["listinfo"] = nil
|
273
|
-
assert_equal %Q
|
271
|
+
assert_equal %Q|<box><caption aid:pstyle="box-title">this is <b>test</b><&>_</caption><listinfo line="1" begin="1">test1\n</listinfo><listinfo line="2">test1.5\n</listinfo><listinfo line="3">\n</listinfo><listinfo line="4" end="4">test<i>2</i>\n</listinfo></box>|, actual
|
274
272
|
end
|
275
273
|
|
276
274
|
def test_flushright
|
277
|
-
|
278
|
-
assert_equal %Q
|
275
|
+
actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
|
276
|
+
assert_equal %Q|<p align='right'>foobar</p><p align='right'>buz</p>|, actual
|
279
277
|
end
|
280
278
|
|
281
279
|
def test_centering
|
282
|
-
|
283
|
-
assert_equal %Q
|
280
|
+
actual = compile_block("//centering{\nfoo\nbar\n\nbuz\n//}\n")
|
281
|
+
assert_equal %Q|<p align='center'>foobar</p><p align='center'>buz</p>|, actual
|
284
282
|
end
|
285
283
|
|
286
284
|
def test_noindent
|
287
|
-
|
288
|
-
|
289
|
-
@builder.paragraph(["foo2", "bar2"])
|
290
|
-
assert_equal %Q|<?xml version="1.0" encoding="UTF-8"?>\n<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><p aid:pstyle="noindent" noindent='1'>foobar</p><p>foo2bar2</p>|, @builder.raw_result
|
285
|
+
actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
|
286
|
+
assert_equal %Q|<p aid:pstyle="noindent" noindent='1'>foobar</p><p>foo2bar2</p>|, actual
|
291
287
|
end
|
292
288
|
|
293
289
|
def test_image
|
@@ -297,8 +293,8 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
297
293
|
item
|
298
294
|
end
|
299
295
|
|
300
|
-
|
301
|
-
assert_equal %Q
|
296
|
+
actual = compile_block("//image[sampleimg][sample photo]{\n//}\n")
|
297
|
+
assert_equal %Q|<img><Image href="file://images/chap1-sampleimg.png" /><caption>図1.1 sample photo</caption></img>|, actual
|
302
298
|
end
|
303
299
|
|
304
300
|
def test_image_with_metric
|
@@ -308,8 +304,8 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
308
304
|
item
|
309
305
|
end
|
310
306
|
|
311
|
-
|
312
|
-
assert_equal %Q
|
307
|
+
actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\n//}\n")
|
308
|
+
assert_equal %Q|<img><Image href="file://images/chap1-sampleimg.png" scale="1.2" /><caption>図1.1 sample photo</caption></img>|, actual
|
313
309
|
end
|
314
310
|
|
315
311
|
def test_image_with_metric2
|
@@ -319,8 +315,8 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
319
315
|
item
|
320
316
|
end
|
321
317
|
|
322
|
-
|
323
|
-
assert_equal %Q
|
318
|
+
actual = compile_block("//image[sampleimg][sample photo][scale=1.2, html::class=sample, latex::ignore=params, idgxml::ostyle=object]{\n//}\n")
|
319
|
+
assert_equal %Q|<img><Image href="file://images/chap1-sampleimg.png" scale="1.2" ostyle="object" /><caption>図1.1 sample photo</caption></img>|, actual
|
324
320
|
end
|
325
321
|
|
326
322
|
def test_indepimage
|
@@ -330,8 +326,8 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
330
326
|
item
|
331
327
|
end
|
332
328
|
|
333
|
-
|
334
|
-
assert_equal %Q
|
329
|
+
actual = compile_block("//indepimage[sampleimg][sample photo]\n")
|
330
|
+
assert_equal %Q|<img><Image href="file://images/chap1-sampleimg.png" /><caption>sample photo</caption></img>|, actual
|
335
331
|
end
|
336
332
|
|
337
333
|
def test_indepimage_without_caption
|
@@ -341,8 +337,8 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
341
337
|
item
|
342
338
|
end
|
343
339
|
|
344
|
-
|
345
|
-
assert_equal %Q
|
340
|
+
actual = compile_block("//indepimage[sampleimg]\n")
|
341
|
+
assert_equal %Q|<img><Image href="file://images/chap1-sampleimg.png" /></img>|, actual
|
346
342
|
end
|
347
343
|
|
348
344
|
def test_indepimage_with_metric
|
@@ -352,8 +348,8 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
352
348
|
item
|
353
349
|
end
|
354
350
|
|
355
|
-
|
356
|
-
assert_equal %Q
|
351
|
+
actual = compile_block("//indepimage[sampleimg][sample photo][scale=1.2]\n")
|
352
|
+
assert_equal %Q|<img><Image href="file://images/chap1-sampleimg.png" scale="1.2" /><caption>sample photo</caption></img>|, actual
|
357
353
|
end
|
358
354
|
|
359
355
|
def test_indepimage_with_metric2
|
@@ -363,8 +359,8 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
363
359
|
item
|
364
360
|
end
|
365
361
|
|
366
|
-
|
367
|
-
assert_equal %Q
|
362
|
+
actual = compile_block("//indepimage[sampleimg][sample photo][scale=1.2, html::class=\"sample\", latex::ignore=params, idgxml::ostyle=\"object\"]\n")
|
363
|
+
assert_equal %Q|<img><Image href="file://images/chap1-sampleimg.png" scale="1.2" ostyle="object" /><caption>sample photo</caption></img>|, actual
|
368
364
|
end
|
369
365
|
|
370
366
|
def test_indepimage_without_caption_but_with_metric
|
@@ -374,14 +370,12 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
374
370
|
item
|
375
371
|
end
|
376
372
|
|
377
|
-
|
378
|
-
assert_equal %Q
|
373
|
+
actual = compile_block("//indepimage[sampleimg][][scale=1.2]\n")
|
374
|
+
assert_equal %Q|<img><Image href="file://images/chap1-sampleimg.png" scale="1.2" /></img>|, actual
|
379
375
|
end
|
380
376
|
|
381
377
|
def column_helper(review)
|
382
|
-
|
383
|
-
chap_singleton.send(:define_method, :content) { review }
|
384
|
-
@compiler.compile(@chapter)
|
378
|
+
compile_block(review)
|
385
379
|
end
|
386
380
|
|
387
381
|
def test_column_1
|
@@ -396,11 +390,10 @@ inside column
|
|
396
390
|
|
397
391
|
===[/column]
|
398
392
|
EOS
|
399
|
-
|
400
|
-
|
401
|
-
<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><column id="column-1"><title aid:pstyle="column-title">prev column</title><p>inside prev column</p></column><column id="column-2"><title aid:pstyle="column-title">test</title><p>inside column</p></column></doc>
|
393
|
+
expected =<<-EOS.chomp
|
394
|
+
<column id="column-1"><title aid:pstyle="column-title">prev column</title><p>inside prev column</p></column><column id="column-2"><title aid:pstyle="column-title">test</title><p>inside column</p></column>
|
402
395
|
EOS
|
403
|
-
assert_equal
|
396
|
+
assert_equal expected, column_helper(review)
|
404
397
|
end
|
405
398
|
|
406
399
|
def test_column_2
|
@@ -411,12 +404,11 @@ inside column
|
|
411
404
|
|
412
405
|
=== next level
|
413
406
|
EOS
|
414
|
-
|
415
|
-
|
416
|
-
<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><column id="column-1"><title aid:pstyle="column-title">test</title><p>inside column</p></column><title aid:pstyle=\"h3\">next level</title><?dtp level="3" section="next level"?></doc>
|
407
|
+
expected =<<-EOS.chomp
|
408
|
+
<column id="column-1"><title aid:pstyle="column-title">test</title><p>inside column</p></column><title aid:pstyle=\"h3\">next level</title><?dtp level="3" section="next level"?>
|
417
409
|
EOS
|
418
410
|
|
419
|
-
assert_equal
|
411
|
+
assert_equal expected, column_helper(review)
|
420
412
|
end
|
421
413
|
|
422
414
|
def test_column_3
|
@@ -438,11 +430,11 @@ EOS
|
|
438
430
|
* BBB
|
439
431
|
EOS
|
440
432
|
|
441
|
-
|
442
|
-
|
443
|
-
<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><ul><li aid:pstyle="ul-item">AAA</li><li aid:pstyle="ul-item">BBB</li></ul>
|
433
|
+
expected =<<-EOS.chomp
|
434
|
+
<ul><li aid:pstyle="ul-item">AAA</li><li aid:pstyle="ul-item">BBB</li></ul>
|
444
435
|
EOS
|
445
|
-
|
436
|
+
actual = compile_block(src)
|
437
|
+
assert_equal expected, actual
|
446
438
|
end
|
447
439
|
|
448
440
|
def test_ul_cont
|
@@ -453,11 +445,11 @@ EOS
|
|
453
445
|
-BB
|
454
446
|
EOS
|
455
447
|
|
456
|
-
|
457
|
-
|
458
|
-
<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><ul><li aid:pstyle="ul-item">AAA-AA</li><li aid:pstyle="ul-item">BBB-BB</li></ul>
|
448
|
+
expected =<<-EOS.chomp
|
449
|
+
<ul><li aid:pstyle="ul-item">AAA-AA</li><li aid:pstyle="ul-item">BBB-BB</li></ul>
|
459
450
|
EOS
|
460
|
-
|
451
|
+
actual = compile_block(src)
|
452
|
+
assert_equal expected, actual
|
461
453
|
end
|
462
454
|
|
463
455
|
def test_ul_nest1
|
@@ -466,11 +458,11 @@ EOS
|
|
466
458
|
** AA
|
467
459
|
EOS
|
468
460
|
|
469
|
-
|
470
|
-
|
471
|
-
<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><ul><li aid:pstyle="ul-item">AAA<ul2><li aid:pstyle="ul-item">AA</li></ul2></li></ul>
|
461
|
+
expected =<<-EOS.chomp
|
462
|
+
<ul><li aid:pstyle="ul-item">AAA<ul2><li aid:pstyle="ul-item">AA</li></ul2></li></ul>
|
472
463
|
EOS
|
473
|
-
|
464
|
+
actual = compile_block(src)
|
465
|
+
assert_equal expected, actual
|
474
466
|
end
|
475
467
|
|
476
468
|
def test_ul_nest2
|
@@ -481,10 +473,11 @@ EOS
|
|
481
473
|
** BB
|
482
474
|
EOS
|
483
475
|
|
484
|
-
|
485
|
-
|
476
|
+
expected =<<-EOS.chomp
|
477
|
+
<ul><li aid:pstyle="ul-item">AAA<ul2><li aid:pstyle="ul-item">AA</li></ul2></li><li aid:pstyle="ul-item">BBB<ul2><li aid:pstyle="ul-item">BB</li></ul2></li></ul>
|
486
478
|
EOS
|
487
|
-
|
479
|
+
actual = compile_block(src)
|
480
|
+
assert_equal expected, actual
|
488
481
|
end
|
489
482
|
|
490
483
|
def test_ul_nest3
|
@@ -495,10 +488,11 @@ EOS
|
|
495
488
|
** BB
|
496
489
|
EOS
|
497
490
|
|
498
|
-
|
499
|
-
|
491
|
+
expected =<<-EOS.chomp
|
492
|
+
<ul><li aid:pstyle="ul-item"><ul2><li aid:pstyle="ul-item">AAA</li></ul2></li><li aid:pstyle="ul-item">AA</li><li aid:pstyle="ul-item">BBB<ul2><li aid:pstyle="ul-item">BB</li></ul2></li></ul>
|
500
493
|
EOS
|
501
|
-
|
494
|
+
actual = compile_block(src)
|
495
|
+
assert_equal expected, actual
|
502
496
|
end
|
503
497
|
|
504
498
|
def test_ul_nest4
|
@@ -512,10 +506,11 @@ EOS
|
|
512
506
|
** G
|
513
507
|
EOS
|
514
508
|
|
515
|
-
|
516
|
-
|
509
|
+
expected =<<-EOS.chomp
|
510
|
+
<ul><li aid:pstyle="ul-item">A<ul2><li aid:pstyle="ul-item">B</li><li aid:pstyle="ul-item">C<ul3><li aid:pstyle="ul-item">D</li></ul3></li><li aid:pstyle="ul-item">E</li></ul2></li><li aid:pstyle="ul-item">F<ul2><li aid:pstyle="ul-item">G</li></ul2></li></ul>
|
517
511
|
EOS
|
518
|
-
|
512
|
+
actual = compile_block(src)
|
513
|
+
assert_equal expected, actual
|
519
514
|
end
|
520
515
|
|
521
516
|
def test_ol
|
@@ -524,65 +519,65 @@ EOS
|
|
524
519
|
3. BBB
|
525
520
|
EOS
|
526
521
|
|
527
|
-
|
528
|
-
|
529
|
-
<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><ol><li aid:pstyle="ol-item" olnum="1" num="3">AAA</li><li aid:pstyle="ol-item" olnum="2" num="3">BBB</li></ol>
|
522
|
+
expected =<<-EOS.chomp
|
523
|
+
<ol><li aid:pstyle="ol-item" olnum="1" num="3">AAA</li><li aid:pstyle="ol-item" olnum="2" num="3">BBB</li></ol>
|
530
524
|
EOS
|
531
|
-
|
525
|
+
actual = compile_block(src)
|
526
|
+
assert_equal expected, actual
|
532
527
|
end
|
533
528
|
|
534
529
|
def test_inline_raw0
|
535
|
-
assert_equal "normal",
|
530
|
+
assert_equal "normal", compile_inline("@<raw>{normal}")
|
536
531
|
end
|
537
532
|
|
538
533
|
def test_inline_raw1
|
539
|
-
assert_equal "body",
|
534
|
+
assert_equal "body", compile_inline("@<raw>{|idgxml|body}")
|
540
535
|
end
|
541
536
|
|
542
537
|
def test_inline_raw2
|
543
|
-
assert_equal "body",
|
538
|
+
assert_equal "body", compile_inline("@<raw>{|idgxml, latex|body}")
|
544
539
|
end
|
545
540
|
|
546
541
|
def test_inline_raw3
|
547
|
-
assert_equal "",
|
542
|
+
assert_equal "", compile_inline("@<raw>{|latex, html|body}")
|
548
543
|
end
|
549
544
|
|
550
545
|
def test_inline_raw4
|
551
|
-
assert_equal "|idgxml body",
|
546
|
+
assert_equal "|idgxml body", compile_inline("@<raw>{|idgxml body}")
|
552
547
|
end
|
553
548
|
|
554
549
|
def test_inline_raw5
|
555
|
-
assert_equal "nor\nmal",
|
550
|
+
assert_equal "nor\nmal", compile_inline("@<raw>{|idgxml|nor\\nmal}")
|
556
551
|
end
|
557
552
|
|
558
553
|
def test_block_raw0
|
559
|
-
|
560
|
-
|
561
|
-
assert_equal
|
554
|
+
actual = compile_block("//raw[<>!\"\\n& ]\n")
|
555
|
+
expected = %Q(<>!\"\n& )
|
556
|
+
assert_equal expected, actual
|
562
557
|
end
|
563
558
|
|
564
559
|
def test_block_raw1
|
565
|
-
|
566
|
-
|
567
|
-
assert_equal
|
560
|
+
actual = compile_block("//raw[|idgxml|<>!\"\\n& ]\n")
|
561
|
+
expected = %Q(<>!\"\n& )
|
562
|
+
assert_equal expected.chomp, actual
|
568
563
|
end
|
569
564
|
|
570
565
|
def test_block_raw2
|
571
|
-
|
572
|
-
|
573
|
-
assert_equal
|
566
|
+
actual = compile_block("//raw[|idgxml, latex|<>!\"\\n& ]\n")
|
567
|
+
expected = %Q(<>!\"\n& )
|
568
|
+
assert_equal expected.chomp, actual
|
574
569
|
end
|
575
570
|
|
576
571
|
def test_block_raw3
|
577
|
-
|
578
|
-
|
579
|
-
assert_equal
|
572
|
+
actual = compile_block("//raw[|latex, html|<>!\"\\n& ]\n")
|
573
|
+
expected = %Q()
|
574
|
+
assert_equal expected.chomp, actual
|
580
575
|
end
|
581
576
|
|
582
577
|
def test_block_raw4
|
583
|
-
|
584
|
-
|
585
|
-
assert_equal
|
578
|
+
actual = compile_block("//raw[|idgxml <>!\"\\n& ]\n")
|
579
|
+
expected = %Q(|idgxml <>!\"\n& )
|
580
|
+
assert_equal expected.chomp, actual
|
586
581
|
end
|
587
582
|
|
588
583
|
end
|