review 1.6.0 → 1.7.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 +43 -1
- data/.rubocop_todo.yml +605 -0
- data/.travis.yml +9 -0
- data/ChangeLog +4 -0
- data/Dockerfile +22 -0
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/bin/review-check +8 -21
- data/bin/review-compile +9 -15
- data/bin/review-epubmaker-legacy +6 -6
- data/bin/review-index +2 -13
- data/bin/review-preproc +1 -14
- data/bin/review-validate +1 -1
- data/bin/review-vol +1 -13
- data/doc/NEWS.ja.md +22 -0
- data/doc/NEWS.md +22 -0
- data/doc/quickstart.ja.md +1 -1
- data/doc/quickstart.md +1 -1
- data/lib/epubmaker/content.rb +3 -3
- data/lib/epubmaker/epubcommon.rb +91 -108
- data/lib/epubmaker/epubv2.rb +14 -67
- data/lib/epubmaker/epubv3.rb +25 -59
- data/lib/epubmaker/producer.rb +12 -0
- data/lib/review/book/base.rb +12 -4
- data/lib/review/book/compilable.rb +1 -3
- data/lib/review/book/index.rb +4 -4
- data/lib/review/builder.rb +6 -11
- data/lib/review/compiler.rb +7 -7
- data/lib/review/configure.rb +20 -8
- data/lib/review/epubbuilder.rb +1 -1
- data/lib/review/epubmaker.rb +52 -122
- data/lib/review/ewbbuilder.rb +4 -4
- data/lib/review/exception.rb +1 -1
- data/lib/review/htmlbuilder.rb +49 -54
- data/lib/review/htmltoc.rb +45 -0
- data/lib/review/htmlutils.rb +3 -3
- data/lib/review/i18n.rb +6 -2
- data/lib/review/i18n.yml +1 -1
- data/lib/review/idgxmlbuilder.rb +4 -5
- data/lib/review/inaobuilder.rb +1 -1
- data/lib/review/latexbuilder.rb +2 -2
- data/lib/review/latexutils.rb +6 -6
- data/lib/review/markdownbuilder.rb +4 -3
- data/lib/review/pdfmaker.rb +92 -92
- data/lib/review/preprocessor.rb +14 -51
- data/lib/review/template.rb +21 -0
- data/lib/review/textbuilder.rb +1 -1
- data/lib/review/textutils.rb +0 -28
- data/lib/review/tocparser.rb +3 -3
- data/lib/review/tocprinter.rb +8 -31
- data/lib/review/topbuilder.rb +2 -3
- data/lib/review/unfold.rb +2 -2
- data/lib/review/version.rb +1 -1
- data/review.gemspec +2 -1
- data/templates/html/layout-html5.html.erb +17 -0
- data/templates/html/layout-xhtml1.html.erb +20 -0
- data/templates/ncx/epubv2.ncx.erb +11 -0
- data/templates/opf/epubv2.opf.erb +21 -0
- data/templates/opf/epubv3.opf.erb +18 -0
- data/templates/xml/container.xml.erb +6 -0
- data/test/assets/test.xml.erb +3 -0
- data/test/test.re +1 -1
- data/test/test_book.rb +4 -4
- data/test/test_book_chapter.rb +0 -76
- data/test/test_book_part.rb +1 -1
- data/test/test_builder.rb +0 -49
- data/test/test_configure.rb +50 -0
- data/test/test_htmlbuilder.rb +54 -4
- data/test/test_htmltoc.rb +32 -0
- data/test/test_i18n.rb +3 -5
- data/test/test_idgxmlbuilder.rb +0 -2
- data/test/test_inaobuilder.rb +2 -4
- data/test/test_latexbuilder.rb +2 -4
- data/test/test_lineinput.rb +0 -18
- data/test/test_markdownbuilder.rb +5 -4
- data/test/test_pdfmaker.rb +11 -10
- data/test/test_template.rb +26 -0
- data/test/test_topbuilder.rb +0 -2
- metadata +35 -4
- data/rubocop-todo.yml +0 -456
data/test/test_book_part.rb
CHANGED
@@ -33,7 +33,7 @@ class PartTest < Test::Unit::TestCase
|
|
33
33
|
assert_equal 0, part.volume.lines
|
34
34
|
|
35
35
|
chs = []
|
36
|
-
tfs = []
|
36
|
+
tfs = [] ## prevent from removing Tempfile
|
37
37
|
Tempfile.open('part_test') do |o|
|
38
38
|
o.print "12345"
|
39
39
|
chs << Book::Chapter.new(book, nil, nil, o.path)
|
data/test/test_builder.rb
CHANGED
@@ -52,47 +52,6 @@ class BuidlerTest < Test::Unit::TestCase
|
|
52
52
|
assert_raises(NoMethodError) do # XXX: OK?
|
53
53
|
b.puts ""
|
54
54
|
end
|
55
|
-
|
56
|
-
if "".respond_to?(:encode)
|
57
|
-
utf8_str = "あいうえお"
|
58
|
-
eucjp_str = "あいうえお".encode("EUC-JP")
|
59
|
-
sjis_str = "あいうえお".encode("Shift_JIS")
|
60
|
-
jis_str = "あいうえお".encode("ISO-2022-JP")
|
61
|
-
else
|
62
|
-
utf8_str = "\xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88\xe3\x81\x8a" # "あいうえお"
|
63
|
-
eucjp_str = "\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa"
|
64
|
-
sjis_str = "\x82\xa0\x82\xa2\x82\xa4\x82\xa6\x82\xa8"
|
65
|
-
jis_str = "\x1b\x24\x42\x24\x22\x24\x24\x24\x26\x24\x28\x24\x2a\x1b\x28\x42"
|
66
|
-
end
|
67
|
-
|
68
|
-
[
|
69
|
-
['EUC', eucjp_str],
|
70
|
-
['SJIS', sjis_str],
|
71
|
-
# ['JIS', jis_str],
|
72
|
-
# ['jis', jis_str],
|
73
|
-
# ['jIs', jis_str],
|
74
|
-
['XYZ', utf8_str],
|
75
|
-
].each do |enc, expect|
|
76
|
-
params = {"outencoding" => enc}
|
77
|
-
|
78
|
-
[
|
79
|
-
[:print, utf8_str, expect],
|
80
|
-
[:puts, utf8_str, "#{expect}\n"],
|
81
|
-
[:print, "#{utf8_str}\n", "#{expect}\n"],
|
82
|
-
[:puts, "#{utf8_str}\n", "#{expect}\n"],
|
83
|
-
].each do |m, instr, expstr|
|
84
|
-
b = Builder.new
|
85
|
-
chapter = ReVIEW::Book::Chapter.new(ReVIEW::Book::Base.load, nil, '-', nil)
|
86
|
-
b.bind(nil, chapter, nil)
|
87
|
-
chapter.book.config = params
|
88
|
-
b.__send__(m, instr)
|
89
|
-
if "".respond_to?(:encode)
|
90
|
-
assert_equal expstr.encode("UTF-8"), b.result
|
91
|
-
else
|
92
|
-
assert_equal expstr, b.result
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
55
|
end
|
97
56
|
|
98
57
|
def test_not_implemented_methods
|
@@ -131,14 +90,6 @@ class BuidlerTest < Test::Unit::TestCase
|
|
131
90
|
assert_equal [:text, text], @b.compile_inline(text)
|
132
91
|
end
|
133
92
|
|
134
|
-
def test_convert_outencoding
|
135
|
-
book = ReVIEW::Book::Base.new(nil)
|
136
|
-
book.config = {'outencoding' => "EUC"}
|
137
|
-
b = Builder.new
|
138
|
-
ret = b.convert_outencoding("a", book.config["outencoding"])
|
139
|
-
assert_equal "a", ret
|
140
|
-
end
|
141
|
-
|
142
93
|
class XBuilder < Builder
|
143
94
|
def list_header(id, caption)
|
144
95
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
require 'review/epubmaker'
|
5
|
+
|
6
|
+
class ConfigureTest < Test::Unit::TestCase
|
7
|
+
include ReVIEW
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@maker = ReVIEW::EPUBMaker.new
|
11
|
+
@config = ReVIEW::Configure.values
|
12
|
+
@config.merge!({
|
13
|
+
"bookname" => "sample",
|
14
|
+
"title" => "Sample Book",
|
15
|
+
"version" => 2,
|
16
|
+
"urnid" => "http://example.jp/",
|
17
|
+
"date" => "2011-01-01",
|
18
|
+
"language" => "ja",
|
19
|
+
"epubmaker" => {"flattocindent" => true},
|
20
|
+
})
|
21
|
+
@output = StringIO.new
|
22
|
+
I18n.setup(@config["language"])
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_configure_class
|
26
|
+
assert_equal ReVIEW::Configure, @config.class
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_configure_get
|
30
|
+
bookname = @config["bookname"]
|
31
|
+
assert_equal "sample", bookname
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_configure_get2
|
35
|
+
assert_equal true, @config["epubmaker"]["flattocindent"]
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_configure_with_maker
|
39
|
+
@config.maker = "epubmaker"
|
40
|
+
assert_equal true, @config["flattocindent"]
|
41
|
+
assert_equal true, @config["epubmaker"]["flattocindent"]
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_configure_with_invalidmaker
|
45
|
+
@config.maker = "pdfmaker"
|
46
|
+
assert_equal nil, @config["flattocindent"]
|
47
|
+
assert_equal true, @config["epubmaker"]["flattocindent"]
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
data/test/test_htmlbuilder.rb
CHANGED
@@ -14,10 +14,9 @@ class HTMLBuidlerTest < Test::Unit::TestCase
|
|
14
14
|
@builder = HTMLBuilder.new()
|
15
15
|
@config = ReVIEW::Configure.values
|
16
16
|
@config.merge!({
|
17
|
-
"secnolevel" => 2,
|
18
|
-
"
|
19
|
-
"
|
20
|
-
"stylesheet" => nil, # for HTMLBuilder
|
17
|
+
"secnolevel" => 2, # for IDGXMLBuilder, HTMLBuilder
|
18
|
+
"stylesheet" => nil, # for HTMLBuilder
|
19
|
+
"htmlext" => "html",
|
21
20
|
})
|
22
21
|
@book = Book::Base.new(".")
|
23
22
|
@book.config = @config
|
@@ -521,6 +520,35 @@ class HTMLBuidlerTest < Test::Unit::TestCase
|
|
521
520
|
assert_equal "<div class=\"caption-code\">\n<p class=\"caption\">リスト1.1: this is <b>test</b><&>_</p>\n<pre class=\"list\">def foo(a1, a2=:test)\n (1..3).times{|i| a.include?(:foo)}\n return true\nend\n</pre>\n</div>\n", actual
|
522
521
|
end
|
523
522
|
|
523
|
+
def test_listnum
|
524
|
+
def @chapter.list(id)
|
525
|
+
Book::ListIndex::Item.new("samplelist",1)
|
526
|
+
end
|
527
|
+
|
528
|
+
@book.config["highlight"] = false
|
529
|
+
actual = compile_block(<<-EOS)
|
530
|
+
//listnum[samplelist][this is @<b>{test}<&>_][ruby]{
|
531
|
+
def foo(a1, a2=:test)
|
532
|
+
(1..3).times{|i| a.include?(:foo)}
|
533
|
+
return true
|
534
|
+
end
|
535
|
+
//}
|
536
|
+
EOS
|
537
|
+
|
538
|
+
expected =<<-EOS
|
539
|
+
<div class="code">
|
540
|
+
<p class="caption">リスト1.1: this is <b>test</b><&>_</p>
|
541
|
+
<pre class="list"> 1: def foo(a1, a2=:test)
|
542
|
+
2: (1..3).times{|i| a.include?(:foo)}
|
543
|
+
3: return true
|
544
|
+
4: end
|
545
|
+
</pre>
|
546
|
+
</div>
|
547
|
+
EOS
|
548
|
+
|
549
|
+
assert_equal expected, actual
|
550
|
+
end
|
551
|
+
|
524
552
|
def test_listnum_pygments_lang
|
525
553
|
def @chapter.list(id)
|
526
554
|
Book::ListIndex::Item.new("samplelist",1)
|
@@ -583,6 +611,19 @@ class HTMLBuidlerTest < Test::Unit::TestCase
|
|
583
611
|
assert_equal %Q|<div class="emlist-code">\n<pre class="emlist"> lineA\n lineB\n lineC\n</pre>\n</div>\n|, actual
|
584
612
|
end
|
585
613
|
|
614
|
+
def test_emlistnum
|
615
|
+
@book.config["highlight"] = false
|
616
|
+
actual = compile_block("//emlistnum{\nlineA\nlineB\n//}\n")
|
617
|
+
expected =<<-EOS
|
618
|
+
<div class="emlistnum-code">
|
619
|
+
<pre class="emlist"> 1: lineA
|
620
|
+
2: lineB
|
621
|
+
</pre>
|
622
|
+
</div>
|
623
|
+
EOS
|
624
|
+
assert_equal expected, actual
|
625
|
+
end
|
626
|
+
|
586
627
|
def test_emlist_with_4tab
|
587
628
|
@config["tabwidth"] = 4
|
588
629
|
actual = compile_block("//emlist{\n\tlineA\n\t\tlineB\n\tlineC\n//}\n")
|
@@ -626,6 +667,15 @@ class HTMLBuidlerTest < Test::Unit::TestCase
|
|
626
667
|
assert_equal %Q|<a href="bib.html#bib-id_sample_3Dbib">[1]</a>|, compile_inline("@<bib>{sample=bib}")
|
627
668
|
end
|
628
669
|
|
670
|
+
def test_bib_htmlext
|
671
|
+
def @chapter.bibpaper(id)
|
672
|
+
Book::BibpaperIndex::Item.new("samplebib",1,"sample bib")
|
673
|
+
end
|
674
|
+
|
675
|
+
@config["htmlext"] = "xhtml"
|
676
|
+
assert_equal %Q|<a href="bib.xhtml#bib-samplebib">[1]</a>|, compile_inline("@<bib>{samplebib}")
|
677
|
+
end
|
678
|
+
|
629
679
|
def test_bibpaper
|
630
680
|
def @chapter.bibpaper(id)
|
631
681
|
Book::BibpaperIndex::Item.new("samplebib",1,"sample bib")
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
require 'review/htmltoc'
|
5
|
+
|
6
|
+
class HTMLTocTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
end
|
10
|
+
|
11
|
+
def teardown
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_tocfilename
|
15
|
+
toc = HTMLToc.new("/var/tmp")
|
16
|
+
assert_equal "/var/tmp/toc-html.txt", toc.tocfilename
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_encode_args
|
20
|
+
toc = HTMLToc.new("/var/tmp")
|
21
|
+
assert_equal "chaptype=pre", toc.encode_args({:chaptype => "pre"})
|
22
|
+
assert_equal "force_include=true,chaptype=body,properties=foo", toc.encode_args({:force_include => true, :chaptype => "body", "properties"=>"foo"})
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_decode_args
|
26
|
+
toc = HTMLToc.new("/var/tmp")
|
27
|
+
assert_equal({:chaptype => "pre"}, toc.decode_args("chaptype=pre"))
|
28
|
+
assert_equal({:force_include => "true", :chaptype => "body",:properties=>"foo"}, toc.decode_args("force_include=true,chaptype=body,properties=foo"))
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
data/test/test_i18n.rb
CHANGED
@@ -10,7 +10,7 @@ require 'tmpdir'
|
|
10
10
|
class I18nTest < Test::Unit::TestCase
|
11
11
|
include ReVIEW
|
12
12
|
|
13
|
-
if RUBY_VERSION !~ /^1.8/
|
13
|
+
if RUBY_VERSION !~ /^1.8/ ## to avoid Travis error :-(
|
14
14
|
def test_load_locale_yml
|
15
15
|
Dir.mktmpdir do |dir|
|
16
16
|
Dir.chdir(dir) do
|
@@ -137,10 +137,8 @@ class I18nTest < Test::Unit::TestCase
|
|
137
137
|
I18n.setup "en"
|
138
138
|
@builder = HTMLBuilder.new()
|
139
139
|
@config = {
|
140
|
-
"secnolevel" => 2,
|
141
|
-
"
|
142
|
-
"outencoding" => "UTF-8",
|
143
|
-
"stylesheet" => nil, # for HTMLBuilder
|
140
|
+
"secnolevel" => 2, # for IDGXMLBuilder, HTMLBuilder
|
141
|
+
"stylesheet" => nil, # for HTMLBuilder
|
144
142
|
"ext" => ".re"
|
145
143
|
}
|
146
144
|
@book = Book::Base.new(".")
|
data/test/test_idgxmlbuilder.rb
CHANGED
data/test/test_inaobuilder.rb
CHANGED
@@ -9,10 +9,8 @@ class INAOBuidlerTest < Test::Unit::TestCase
|
|
9
9
|
|
10
10
|
def setup
|
11
11
|
@param = {
|
12
|
-
"secnolevel" => 2,
|
13
|
-
"
|
14
|
-
"outencoding" => "UTF-8",
|
15
|
-
"stylesheet" => nil, # for HTMLBuilder
|
12
|
+
"secnolevel" => 2, # for IDGXMLBuilder, HTMLBuilder
|
13
|
+
"stylesheet" => nil, # for HTMLBuilder
|
16
14
|
}
|
17
15
|
end
|
18
16
|
|
data/test/test_latexbuilder.rb
CHANGED
@@ -12,11 +12,9 @@ class LATEXBuidlerTest < Test::Unit::TestCase
|
|
12
12
|
@builder = LATEXBuilder.new()
|
13
13
|
@config = ReVIEW::Configure.values
|
14
14
|
@config.merge!( {
|
15
|
-
"secnolevel" => 2,
|
15
|
+
"secnolevel" => 2, # for IDGXMLBuilder, EPUBBuilder
|
16
16
|
"toclevel" => 2,
|
17
|
-
"
|
18
|
-
"outencoding" => "UTF-8",
|
19
|
-
"stylesheet" => nil, # for EPUBBuilder
|
17
|
+
"stylesheet" => nil, # for EPUBBuilder
|
20
18
|
})
|
21
19
|
@book = Book::Base.new(nil)
|
22
20
|
@book.config = @config
|
data/test/test_lineinput.rb
CHANGED
@@ -73,24 +73,6 @@ class LineInputTest < Test::Unit::TestCase
|
|
73
73
|
assert li.next?
|
74
74
|
end
|
75
75
|
|
76
|
-
def test_skip_blank_lines
|
77
|
-
if "".respond_to?(:encode)
|
78
|
-
euc_jp_spc = " ".encode("EUC-JP")
|
79
|
-
else
|
80
|
-
euc_jp_spc = "\xa1\xa1" # EUC-JP 全角空白
|
81
|
-
end
|
82
|
-
[
|
83
|
-
["", 0, nil],
|
84
|
-
["\n \n \nabc", 3, 'abc'],
|
85
|
-
["\t", 1, nil],
|
86
|
-
[euc_jp_spc, 0, euc_jp_spc],
|
87
|
-
].each do |text, n, rest|
|
88
|
-
li = LineInput.new(StringIO.new(text))
|
89
|
-
assert_equal n, li.skip_blank_lines
|
90
|
-
assert_equal rest, li.gets
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
76
|
def test_gets_if
|
95
77
|
io = StringIO.new
|
96
78
|
li = LineInput.new(io)
|
@@ -12,10 +12,8 @@ class MARKDOWNBuilderTest < Test::Unit::TestCase
|
|
12
12
|
def setup
|
13
13
|
@builder = MARKDOWNBuilder.new()
|
14
14
|
@config = {
|
15
|
-
"secnolevel" => 2,
|
16
|
-
"
|
17
|
-
"outencoding" => "UTF-8",
|
18
|
-
"stylesheet" => nil, # for HTMLBuilder
|
15
|
+
"secnolevel" => 2, # for IDGXMLBuilder, HTMLBuilder
|
16
|
+
"stylesheet" => nil, # for HTMLBuilder
|
19
17
|
}
|
20
18
|
@book = Book::Base.new(nil)
|
21
19
|
@book.config = @config
|
@@ -74,6 +72,7 @@ BBB
|
|
74
72
|
|
75
73
|
assert_equal <<-EOS, actual
|
76
74
|
リスト1.1 caption
|
75
|
+
|
77
76
|
```
|
78
77
|
AAA
|
79
78
|
BBB
|
@@ -91,6 +90,7 @@ BBB
|
|
91
90
|
|
92
91
|
assert_equal <<-EOS, actual
|
93
92
|
リスト1.1 caption
|
93
|
+
|
94
94
|
```ruby
|
95
95
|
AAA
|
96
96
|
BBB
|
@@ -109,6 +109,7 @@ BBB
|
|
109
109
|
assert_equal <<-EOS, actual
|
110
110
|
|
111
111
|
caption
|
112
|
+
|
112
113
|
```ruby
|
113
114
|
AAA
|
114
115
|
BBB
|
data/test/test_pdfmaker.rb
CHANGED
@@ -17,6 +17,7 @@ class PDFMakerTest < Test::Unit::TestCase
|
|
17
17
|
"date" => "2011-01-01",
|
18
18
|
"language" => "ja",
|
19
19
|
})
|
20
|
+
@maker.config = @config
|
20
21
|
@output = StringIO.new
|
21
22
|
I18n.setup(@config["language"])
|
22
23
|
end
|
@@ -26,7 +27,8 @@ class PDFMakerTest < Test::Unit::TestCase
|
|
26
27
|
Dir.chdir(dir) do
|
27
28
|
pdf_file = File.join(dir, "sample.pdf")
|
28
29
|
FileUtils.touch(pdf_file)
|
29
|
-
@maker.
|
30
|
+
@maker.basedir = Dir.pwd
|
31
|
+
@maker.remove_old_file
|
30
32
|
assert !File.exist?(pdf_file)
|
31
33
|
end
|
32
34
|
end
|
@@ -35,13 +37,13 @@ class PDFMakerTest < Test::Unit::TestCase
|
|
35
37
|
def test_check_book_none
|
36
38
|
Dir.mktmpdir do |dir|
|
37
39
|
assert_nothing_raised do
|
38
|
-
@maker.
|
40
|
+
@maker.remove_old_file
|
39
41
|
end
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
43
45
|
def test_buildpath
|
44
|
-
assert_equal(@maker.build_path
|
46
|
+
assert_equal(@maker.build_path, "./sample-pdf")
|
45
47
|
end
|
46
48
|
|
47
49
|
def test_parse_opts_help
|
@@ -78,7 +80,7 @@ class PDFMakerTest < Test::Unit::TestCase
|
|
78
80
|
"csl"=>["監修三郎"],
|
79
81
|
"trl"=>["翻訳四郎","翻訳五郎",]})
|
80
82
|
Dir.mktmpdir do |dir|
|
81
|
-
authors = @maker.make_authors
|
83
|
+
authors = @maker.make_authors
|
82
84
|
assert_equal("テスト太郎、テスト次郎 著 \\\\\n監修三郎 監修 \\\\\n翻訳四郎、翻訳五郎 訳",
|
83
85
|
authors)
|
84
86
|
end
|
@@ -87,7 +89,7 @@ class PDFMakerTest < Test::Unit::TestCase
|
|
87
89
|
def test_make_authors_only_aut
|
88
90
|
@config.merge!({"aut"=>"テスト太郎"})
|
89
91
|
Dir.mktmpdir do |dir|
|
90
|
-
authors = @maker.make_authors
|
92
|
+
authors = @maker.make_authors
|
91
93
|
assert_equal("テスト太郎 著", authors)
|
92
94
|
end
|
93
95
|
end
|
@@ -104,7 +106,7 @@ class PDFMakerTest < Test::Unit::TestCase
|
|
104
106
|
"prt"=>"テスト出版",
|
105
107
|
})
|
106
108
|
Dir.mktmpdir do |dir|
|
107
|
-
okuduke = @maker.make_colophon
|
109
|
+
okuduke = @maker.make_colophon
|
108
110
|
assert_equal("著 者 & テスト太郎、テスト次郎 \\\\\n監 修 & 監修三郎 \\\\\n翻 訳 & 翻訳四郎、翻訳五郎 \\\\\nデザイン & デザイン六郎 \\\\\nイラスト & イラスト七郎、イラスト八郎 \\\\\n表 紙 & 表紙九郎 \\\\\n編 集 & 編集十郎 \\\\\n発行所 & テスト出版 \\\\\n",
|
109
111
|
okuduke)
|
110
112
|
end
|
@@ -122,7 +124,7 @@ class PDFMakerTest < Test::Unit::TestCase
|
|
122
124
|
})
|
123
125
|
Dir.mktmpdir do |dir|
|
124
126
|
I18n.update({"prt" => "印刷所"},"ja")
|
125
|
-
okuduke = @maker.make_colophon
|
127
|
+
okuduke = @maker.make_colophon
|
126
128
|
assert_equal("著 者 & テスト太郎、テスト次郎 \\\\\n監 修 & 監修三郎 \\\\\nイラスト & イラスト七郎、イラスト八郎 \\\\\n発行所 & テスト出版 \\\\\n連絡先 & tarou@example.jp \\\\\n印刷所 & テスト印刷 \\\\\n",
|
127
129
|
okuduke)
|
128
130
|
end
|
@@ -130,7 +132,7 @@ class PDFMakerTest < Test::Unit::TestCase
|
|
130
132
|
|
131
133
|
def test_gettemplate
|
132
134
|
Dir.mktmpdir do |dir|
|
133
|
-
tmpl = @maker.get_template
|
135
|
+
tmpl = @maker.get_template
|
134
136
|
expect = File.read(File.join(assets_dir,"test_template.tex"))
|
135
137
|
assert_equal(expect, tmpl)
|
136
138
|
end
|
@@ -157,8 +159,7 @@ class PDFMakerTest < Test::Unit::TestCase
|
|
157
159
|
|
158
160
|
expect = File.read(File.join(assets_dir,"test_template_backmatter.tex"))
|
159
161
|
|
160
|
-
|
161
|
-
tmpl = maker.get_template(@config)
|
162
|
+
tmpl = @maker.get_template
|
162
163
|
tmpl.gsub!(/\A.*%% backmatter begins\n/m,"")
|
163
164
|
assert_equal(expect, tmpl)
|
164
165
|
end
|