review 5.6.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rubocop.yml +31 -0
- data/.github/workflows/ruby-tex.yml +1 -1
- data/.github/workflows/ruby-win.yml +1 -1
- data/.github/workflows/ruby.yml +2 -2
- data/.rubocop.yml +13 -2
- data/NEWS.ja.md +22 -0
- data/NEWS.md +21 -0
- data/README.md +1 -1
- data/lib/review/book/base.rb +1 -1
- data/lib/review/builder.rb +4 -8
- data/lib/review/epubmaker/epubcommon.rb +13 -7
- data/lib/review/epubmaker/epubv2.rb +0 -5
- data/lib/review/epubmaker/epubv3.rb +9 -1
- data/lib/review/epubmaker/producer.rb +2 -3
- data/lib/review/epubmaker.rb +2 -4
- data/lib/review/htmlbuilder.rb +2 -2
- data/lib/review/idgxmlbuilder.rb +4 -3
- data/lib/review/img_math.rb +9 -2
- data/lib/review/init.rb +3 -3
- data/lib/review/latexbuilder.rb +1 -1
- data/lib/review/lineinput.rb +2 -2
- data/lib/review/makerhelper.rb +2 -2
- data/lib/review/pdfmaker.rb +3 -5
- data/lib/review/update.rb +3 -7
- data/lib/review/version.rb +1 -1
- data/lib/review/yamlloader.rb +0 -3
- data/review.gemspec +2 -3
- data/samples/syntax-book/Gemfile +1 -1
- data/templates/opf/epubv2.opf.erb +2 -0
- data/templates/opf/epubv3.opf.erb +2 -0
- data/templates/opf/opf_manifest_epubv2.opf.erb +2 -0
- data/templates/opf/opf_manifest_epubv3.opf.erb +2 -0
- data/templates/opf/opf_tocx_epubv3.opf.erb +2 -0
- metadata +10 -139
- data/test/assets/black.eps +0 -280
- data/test/assets/fit.png +0 -0
- data/test/assets/header_listener.html +0 -35
- data/test/assets/img_math/img1.png +0 -0
- data/test/assets/img_math/img2.png +0 -0
- data/test/assets/img_math/img3.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 +0 -65
- data/test/assets/syntax_book_index_detail.txt +0 -60
- data/test/assets/test.xml.erb +0 -3
- data/test/assets/test_template.tex +0 -189
- data/test/assets/test_template_backmatter.tex +0 -200
- data/test/book_test_helper.rb +0 -44
- data/test/run_test.rb +0 -12
- data/test/test_book.rb +0 -588
- data/test/test_book_chapter.rb +0 -329
- data/test/test_book_part.rb +0 -53
- data/test/test_builder.rb +0 -128
- data/test/test_catalog.rb +0 -174
- data/test/test_catalog_converter_cmd.rb +0 -73
- data/test/test_compiler.rb +0 -52
- data/test/test_configure.rb +0 -91
- data/test/test_converter.rb +0 -21
- data/test/test_epub3maker.rb +0 -733
- data/test/test_epubmaker.rb +0 -931
- data/test/test_epubmaker_cmd.rb +0 -56
- data/test/test_extentions_hash.rb +0 -66
- data/test/test_helper.rb +0 -62
- data/test/test_htmlbuilder.rb +0 -3315
- data/test/test_htmltoc.rb +0 -29
- data/test/test_htmlutils.rb +0 -43
- data/test/test_i18n.rb +0 -300
- data/test/test_idgxmlbuilder.rb +0 -1529
- data/test/test_idgxmlmaker_cmd.rb +0 -50
- data/test/test_image_finder.rb +0 -81
- data/test/test_img_math.rb +0 -120
- data/test/test_index.rb +0 -287
- data/test/test_indexbuilder.rb +0 -52
- data/test/test_latexbuilder.rb +0 -2972
- data/test/test_latexbuilder_v2.rb +0 -1654
- data/test/test_lineinput.rb +0 -104
- data/test/test_location.rb +0 -30
- data/test/test_logger.rb +0 -33
- data/test/test_makerhelper.rb +0 -44
- data/test/test_markdownbuilder.rb +0 -371
- data/test/test_md2inaobuilder.rb +0 -90
- data/test/test_pdfmaker.rb +0 -354
- data/test/test_pdfmaker_cmd.rb +0 -130
- data/test/test_plaintextbuilder.rb +0 -1214
- data/test/test_preprocessor.rb +0 -196
- data/test/test_review_ext.rb +0 -30
- data/test/test_reviewheaderlistener.rb +0 -49
- data/test/test_rstbuilder.rb +0 -619
- data/test/test_sec_counter.rb +0 -156
- data/test/test_template.rb +0 -33
- data/test/test_textmaker_cmd.rb +0 -58
- data/test/test_textutils.rb +0 -187
- data/test/test_tocprinter.rb +0 -46
- data/test/test_topbuilder.rb +0 -1301
- data/test/test_update.rb +0 -473
- data/test/test_webtocprinter.rb +0 -195
- data/test/test_yamlloader.rb +0 -186
- data/test/test_zip_exporter.rb +0 -106
data/test/test_preprocessor.rb
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
require 'test_helper'
|
|
2
|
-
require 'review/preprocessor'
|
|
3
|
-
require 'stringio'
|
|
4
|
-
require 'book_test_helper'
|
|
5
|
-
|
|
6
|
-
class PreprocessorTest < Test::Unit::TestCase
|
|
7
|
-
include ReVIEW
|
|
8
|
-
include BookTestHelper
|
|
9
|
-
|
|
10
|
-
def test_mapfile
|
|
11
|
-
preproc = ReVIEW::Preprocessor.new({})
|
|
12
|
-
|
|
13
|
-
ch01_re = <<-'REFILE'
|
|
14
|
-
= test1
|
|
15
|
-
|
|
16
|
-
//list[hello.rb.1][hello.re]{
|
|
17
|
-
#@mapfile(hello.rb)
|
|
18
|
-
#@end
|
|
19
|
-
//}
|
|
20
|
-
REFILE
|
|
21
|
-
|
|
22
|
-
hello_rb = <<-'RBFILE'
|
|
23
|
-
#!/usr/bin/env ruby
|
|
24
|
-
|
|
25
|
-
class Hello
|
|
26
|
-
def hello(name)
|
|
27
|
-
print "hello, #{name}!\n"
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
if __FILE__ == $0
|
|
32
|
-
Hello.new.hello("world")
|
|
33
|
-
end
|
|
34
|
-
RBFILE
|
|
35
|
-
|
|
36
|
-
expected = <<-'EXPECTED'
|
|
37
|
-
= test1
|
|
38
|
-
|
|
39
|
-
//list[hello.rb.1][hello.re]{
|
|
40
|
-
#@mapfile(hello.rb)
|
|
41
|
-
#!/usr/bin/env ruby
|
|
42
|
-
|
|
43
|
-
class Hello
|
|
44
|
-
def hello(name)
|
|
45
|
-
print "hello, #{name}!\n"
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
if __FILE__ == $0
|
|
50
|
-
Hello.new.hello("world")
|
|
51
|
-
end
|
|
52
|
-
#@end
|
|
53
|
-
//}
|
|
54
|
-
EXPECTED
|
|
55
|
-
converted = mktmpbookdir('catalog.yml' => "CHAPS:\n - ch01.re\n",
|
|
56
|
-
'ch01.re' => ch01_re,
|
|
57
|
-
'hello.rb' => hello_rb) do |_dir, _book, _files|
|
|
58
|
-
preproc.process('ch01.re')
|
|
59
|
-
end
|
|
60
|
-
assert_equal expected, converted
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def test_mapfile_tabwidth_is_4
|
|
64
|
-
param = { 'tabwidth' => 4 }
|
|
65
|
-
preproc = ReVIEW::Preprocessor.new(param)
|
|
66
|
-
|
|
67
|
-
ch01 = <<-'REFILE'
|
|
68
|
-
//emlist[test1][inc.txt]{
|
|
69
|
-
#@mapfile(inc.txt)
|
|
70
|
-
#@end
|
|
71
|
-
//}
|
|
72
|
-
REFILE
|
|
73
|
-
|
|
74
|
-
inc_txt = <<-'INC_TXT'
|
|
75
|
-
test.
|
|
76
|
-
test2.
|
|
77
|
-
|
|
78
|
-
test3.
|
|
79
|
-
|
|
80
|
-
test4.
|
|
81
|
-
|
|
82
|
-
test5.
|
|
83
|
-
INC_TXT
|
|
84
|
-
|
|
85
|
-
expected = <<-'EXPECTED'
|
|
86
|
-
//emlist[test1][inc.txt]{
|
|
87
|
-
#@mapfile(inc.txt)
|
|
88
|
-
test.
|
|
89
|
-
test2.
|
|
90
|
-
|
|
91
|
-
test3.
|
|
92
|
-
|
|
93
|
-
test4.
|
|
94
|
-
|
|
95
|
-
test5.
|
|
96
|
-
#@end
|
|
97
|
-
//}
|
|
98
|
-
EXPECTED
|
|
99
|
-
converted = nil
|
|
100
|
-
mktmpbookdir('catalog.yml' => "CHAPS:\n - ch01.re\n",
|
|
101
|
-
'inc.txt' => inc_txt,
|
|
102
|
-
'ch01.re' => ch01) do |_dir, _book, _files|
|
|
103
|
-
converted = preproc.process('ch01.re')
|
|
104
|
-
end
|
|
105
|
-
assert_equal expected, converted
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def test_maprange
|
|
109
|
-
preproc = ReVIEW::Preprocessor.new({})
|
|
110
|
-
|
|
111
|
-
ch01_re = <<-'REFILE'
|
|
112
|
-
//list[range.rb][range.rb(抜粋)]{
|
|
113
|
-
#@maprange(range.rb,sample)
|
|
114
|
-
#@end
|
|
115
|
-
//}
|
|
116
|
-
REFILE
|
|
117
|
-
|
|
118
|
-
range_rb = <<-'RBFILE'
|
|
119
|
-
#!/usr/bin/env ruby
|
|
120
|
-
|
|
121
|
-
class Hello
|
|
122
|
-
#@range_begin(sample)
|
|
123
|
-
def hello(name)
|
|
124
|
-
print "hello, #{name}!\n"
|
|
125
|
-
end
|
|
126
|
-
#@range_end(sample)
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
if __FILE__ == $0
|
|
130
|
-
Hello.new.hello("world")
|
|
131
|
-
end
|
|
132
|
-
RBFILE
|
|
133
|
-
|
|
134
|
-
expected = <<-'EXPECTED'
|
|
135
|
-
//list[range.rb][range.rb(抜粋)]{
|
|
136
|
-
#@maprange(range.rb,sample)
|
|
137
|
-
def hello(name)
|
|
138
|
-
print "hello, #{name}!\n"
|
|
139
|
-
end
|
|
140
|
-
#@end
|
|
141
|
-
//}
|
|
142
|
-
EXPECTED
|
|
143
|
-
converted = mktmpbookdir('catalog.yml' => "CHAPS:\n - ch01.re\n",
|
|
144
|
-
'ch01.re' => ch01_re,
|
|
145
|
-
'range.rb' => range_rb) do |_dir, _book, _files|
|
|
146
|
-
preproc.process('ch01.re')
|
|
147
|
-
end
|
|
148
|
-
assert_equal expected, converted
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
def test_at_at_maprange
|
|
152
|
-
preproc = ReVIEW::Preprocessor.new({})
|
|
153
|
-
|
|
154
|
-
ch01_re = <<-'REFILE'
|
|
155
|
-
//list[range.c][range.c(抜粋)]{
|
|
156
|
-
#@maprange(range.c,sample)
|
|
157
|
-
#@end
|
|
158
|
-
//}
|
|
159
|
-
REFILE
|
|
160
|
-
|
|
161
|
-
range_c = <<-'CFILE'
|
|
162
|
-
#include <stdio.h>
|
|
163
|
-
|
|
164
|
-
/* #@@range_begin(sample) */
|
|
165
|
-
void
|
|
166
|
-
put_hello(char *name)
|
|
167
|
-
{
|
|
168
|
-
printf("hello, %s!\n", name);
|
|
169
|
-
}
|
|
170
|
-
/* #@@range_end(sample) */
|
|
171
|
-
|
|
172
|
-
int main()
|
|
173
|
-
{
|
|
174
|
-
put_hello("world");
|
|
175
|
-
}
|
|
176
|
-
CFILE
|
|
177
|
-
|
|
178
|
-
expected = <<-'EXPECTED'
|
|
179
|
-
//list[range.c][range.c(抜粋)]{
|
|
180
|
-
#@maprange(range.c,sample)
|
|
181
|
-
void
|
|
182
|
-
put_hello(char *name)
|
|
183
|
-
{
|
|
184
|
-
printf("hello, %s!\n", name);
|
|
185
|
-
}
|
|
186
|
-
#@end
|
|
187
|
-
//}
|
|
188
|
-
EXPECTED
|
|
189
|
-
converted = mktmpbookdir('catalog.yml' => "CHAPS:\n - ch01.re\n",
|
|
190
|
-
'ch01.re' => ch01_re,
|
|
191
|
-
'range.c' => range_c) do |_dir, _book, _files|
|
|
192
|
-
preproc.process('ch01.re')
|
|
193
|
-
end
|
|
194
|
-
assert_equal expected, converted
|
|
195
|
-
end
|
|
196
|
-
end
|
data/test/test_review_ext.rb
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require 'test_helper'
|
|
2
|
-
require 'book_test_helper'
|
|
3
|
-
require 'review/compiler'
|
|
4
|
-
require 'review/htmlbuilder'
|
|
5
|
-
|
|
6
|
-
class ReviewExtTest < Test::Unit::TestCase
|
|
7
|
-
include BookTestHelper
|
|
8
|
-
|
|
9
|
-
def test_builder_init_on_review_ext
|
|
10
|
-
review_ext = <<-EOB
|
|
11
|
-
module ReVIEW
|
|
12
|
-
class HTMLBuilder
|
|
13
|
-
attr_reader :builder_init_test
|
|
14
|
-
def initialize(strict = false)
|
|
15
|
-
super
|
|
16
|
-
@builder_init_test = "test"
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
EOB
|
|
21
|
-
|
|
22
|
-
mktmpbookdir('CHAPS' => "ch01.re\n",
|
|
23
|
-
'ch01.re' => "= test\n\ntest.\n",
|
|
24
|
-
'review-ext.rb' => review_ext) do |_dir, _book, _files|
|
|
25
|
-
builder = ReVIEW::HTMLBuilder.new(false)
|
|
26
|
-
ReVIEW::Compiler.new(builder)
|
|
27
|
-
assert_equal 'test', builder.builder_init_test
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
require 'test_helper'
|
|
2
|
-
require 'rexml/document'
|
|
3
|
-
require 'rexml/streamlistener'
|
|
4
|
-
require 'review/epubmaker'
|
|
5
|
-
|
|
6
|
-
class ReVIEWHeaderListenerTest < Test::Unit::TestCase
|
|
7
|
-
def setup
|
|
8
|
-
@epubmaker = ReVIEW::EPUBMaker.new
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def teardown
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def test_epubmaker_parse_headlines
|
|
15
|
-
# original Re:VIEW source:
|
|
16
|
-
#
|
|
17
|
-
# = first chapter
|
|
18
|
-
# == first section
|
|
19
|
-
# === first @<embed>{<img src="images/icon1.jpg" alt="subsection" />}
|
|
20
|
-
# == second section
|
|
21
|
-
# ==={dummy1} dummy subsection
|
|
22
|
-
# == third section
|
|
23
|
-
# ==[notoc] notoc section
|
|
24
|
-
# ==[notoc]{dummy2} notoc section
|
|
25
|
-
# ==[nodisp] nodisp section
|
|
26
|
-
# ==[nodisp]{dummy3} nodisp section
|
|
27
|
-
# ==[nonum] nonum section
|
|
28
|
-
# ==[nonum]{dummy4} nonum section
|
|
29
|
-
Dir.mktmpdir do |_dir|
|
|
30
|
-
path = File.join(assets_dir, 'header_listener.html')
|
|
31
|
-
headlines = @epubmaker.parse_headlines(path)
|
|
32
|
-
|
|
33
|
-
expected = [{ 'id' => 'h1', 'level' => 1, 'notoc' => nil, 'title' => '第1章 first chapter' },
|
|
34
|
-
{ 'id' => 'h1-1', 'level' => 2, 'notoc' => nil, 'title' => '1.1 first section' },
|
|
35
|
-
{ 'id' => 'h1-1-1', 'level' => 3, 'notoc' => nil, 'title' => 'first subsection' },
|
|
36
|
-
{ 'id' => 'h1-2', 'level' => 2, 'notoc' => nil, 'title' => '1.2 second section' },
|
|
37
|
-
{ 'id' => 'h1-2-1', 'level' => 3, 'notoc' => nil, 'title' => 'dummy subsection' },
|
|
38
|
-
{ 'id' => 'h1-3', 'level' => 2, 'notoc' => nil, 'title' => '1.3 third section' },
|
|
39
|
-
{ 'id' => 'ch01_nonum1', 'level' => 2, 'notoc' => 'true', 'title' => 'notoc section' },
|
|
40
|
-
{ 'id' => 'dummy2', 'level' => 2, 'notoc' => 'true', 'title' => 'notoc section' },
|
|
41
|
-
{ 'id' => 'ch01_nonum3', 'level' => 2, 'notoc' => nil, 'title' => 'nodisp section' },
|
|
42
|
-
{ 'id' => 'dummy3', 'level' => 2, 'notoc' => nil, 'title' => 'nodisp section' },
|
|
43
|
-
{ 'id' => 'ch01_nonum5', 'level' => 2, 'notoc' => nil, 'title' => 'nonum section' },
|
|
44
|
-
{ 'id' => 'dummy4', 'level' => 2, 'notoc' => nil, 'title' => 'nonum section' }]
|
|
45
|
-
|
|
46
|
-
assert_equal expected, headlines
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|