review 2.0.0 → 2.1.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/.rubocop.yml +43 -1
- data/.rubocop_todo.yml +0 -5
- data/.travis.yml +2 -1
- data/README.md +2 -1
- data/appveyor.yml +10 -1
- data/bin/review-init +12 -0
- data/bin/review-validate +5 -4
- data/doc/NEWS.ja.md +82 -0
- data/doc/NEWS.md +84 -0
- data/doc/config.yml.sample +1 -0
- data/doc/config.yml.sample-simple +77 -0
- data/doc/customize_epub.md +47 -0
- data/doc/preproc.ja.md +153 -0
- data/doc/preproc.md +160 -0
- data/lib/epubmaker/producer.rb +6 -3
- data/lib/lineinput.rb +4 -4
- data/lib/review/book/base.rb +4 -0
- data/lib/review/book/compilable.rb +3 -3
- data/lib/review/book/index.rb +3 -24
- data/lib/review/book/part.rb +6 -2
- data/lib/review/configure.rb +4 -2
- data/lib/review/htmlbuilder.rb +17 -10
- data/lib/review/htmlutils.rb +4 -5
- data/lib/review/i18n.rb +17 -11
- data/lib/review/i18n.yml +6 -0
- data/lib/review/idgxmlbuilder.rb +2 -2
- data/lib/review/makerhelper.rb +1 -1
- data/lib/review/markdownbuilder.rb +12 -1
- data/lib/review/md2inaobuilder.rb +66 -0
- data/lib/review/pdfmaker.rb +20 -7
- data/lib/review/preprocessor.rb +2 -2
- data/lib/review/topbuilder.rb +18 -0
- data/lib/review/version.rb +1 -1
- data/lib/review/webtocprinter.rb +9 -2
- data/templates/LICENSE +20 -0
- data/templates/README.md +8 -0
- data/templates/latex/layout.tex.erb +58 -36
- data/templates/web/html/layout-html5.html.erb +1 -1
- data/test/assets/test_template.tex +44 -8
- data/test/book_test_helper.rb +10 -7
- data/test/sample-book/src/Rakefile +7 -0
- data/test/test_book.rb +1 -4
- data/test/test_epub3maker.rb +1 -3
- data/test/test_htmlbuilder.rb +30 -8
- data/test/test_i18n.rb +28 -0
- data/test/test_idgxmlbuilder.rb +2 -2
- data/test/test_index.rb +10 -0
- data/test/test_location.rb +30 -0
- data/test/test_markdownbuilder.rb +6 -0
- data/test/test_md2inaobuilder.rb +75 -0
- data/test/test_pdfmaker.rb +1 -0
- data/test/test_review_ext.rb +3 -2
- data/test/test_topbuilder.rb +11 -0
- data/test/test_webtocprinter.rb +164 -0
- data/test/test_yamlloader.rb +6 -7
- metadata +14 -1
data/lib/review/book/index.rb
CHANGED
@@ -79,9 +79,10 @@ module ReVIEW
|
|
79
79
|
@items.each(&block)
|
80
80
|
end
|
81
81
|
|
82
|
-
def
|
83
|
-
return @index.
|
82
|
+
def key?(id)
|
83
|
+
return @index.key?(id)
|
84
84
|
end
|
85
|
+
alias_method :has_key?, :key?
|
85
86
|
end
|
86
87
|
|
87
88
|
|
@@ -238,28 +239,6 @@ module ReVIEW
|
|
238
239
|
end
|
239
240
|
end
|
240
241
|
|
241
|
-
class FormatRef
|
242
|
-
def initialize(locale, index)
|
243
|
-
@locale = locale
|
244
|
-
@index = index
|
245
|
-
end
|
246
|
-
|
247
|
-
def title(id)
|
248
|
-
sprintf(@locale["#{@index.item_type}_caption_format".to_sym],
|
249
|
-
@index.title(id))
|
250
|
-
end
|
251
|
-
|
252
|
-
def number(id)
|
253
|
-
sprintf(@locale["#{@index.item_type}_number_format".to_sym],
|
254
|
-
@index.number(id))
|
255
|
-
end
|
256
|
-
|
257
|
-
def method_missing(mid, *args, &block)
|
258
|
-
super unless @index.respond_to?(mid)
|
259
|
-
@index.__send__(mid, *args, &block)
|
260
|
-
end
|
261
|
-
end
|
262
|
-
|
263
242
|
class BibpaperIndex < Index
|
264
243
|
Item = Struct.new(:id, :number, :caption)
|
265
244
|
|
data/lib/review/book/part.rb
CHANGED
@@ -21,8 +21,8 @@ module ReVIEW
|
|
21
21
|
@book = book
|
22
22
|
@number = number
|
23
23
|
@chapters = chapters
|
24
|
+
@name = name ? File.basename(name, '.re') : nil
|
24
25
|
@path = name
|
25
|
-
@title = nil
|
26
26
|
if io
|
27
27
|
@content = io.read
|
28
28
|
elsif @path && File.exist?(@path)
|
@@ -30,7 +30,11 @@ module ReVIEW
|
|
30
30
|
else
|
31
31
|
@content = nil
|
32
32
|
end
|
33
|
-
|
33
|
+
if file?
|
34
|
+
@title = nil
|
35
|
+
else
|
36
|
+
@title = name
|
37
|
+
end
|
34
38
|
@volume = nil
|
35
39
|
end
|
36
40
|
|
data/lib/review/configure.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
require 'securerandom'
|
3
|
+
|
2
4
|
module ReVIEW
|
3
5
|
class Configure < Hash
|
4
6
|
|
@@ -23,7 +25,7 @@ module ReVIEW
|
|
23
25
|
"date" => nil, # publishing date
|
24
26
|
"rights" => nil, # Copyright messages
|
25
27
|
"description" => nil, # Description
|
26
|
-
"urnid" =>
|
28
|
+
"urnid" => "urn:uid:#{SecureRandom.uuid}", # Identifier
|
27
29
|
"stylesheet" => "stylesheet.css", # stylesheet file
|
28
30
|
"coverfile" => nil, # content file of body of cover page
|
29
31
|
"mytoc" => nil, # whether make own table of contents or not
|
@@ -52,7 +54,7 @@ module ReVIEW
|
|
52
54
|
"page_metric" => ReVIEW::Book::PageMetric::A5,
|
53
55
|
"ext" => '.re',
|
54
56
|
"image_dir" => 'images',
|
55
|
-
"image_types" => %w(
|
57
|
+
"image_types" => %w(.ai .psd .eps .pdf .tif .tiff .png .bmp .jpg .jpeg .gif .svg),
|
56
58
|
"image_scale2width" => true, # for LaTeX
|
57
59
|
"bib_file" => "bib.re",
|
58
60
|
"colophon_order" => %w(aut csl trl dsr ill cov edt pbl contact prt),
|
data/lib/review/htmlbuilder.rb
CHANGED
@@ -50,7 +50,7 @@ module ReVIEW
|
|
50
50
|
def builder_init_file
|
51
51
|
@warns = []
|
52
52
|
@errors = []
|
53
|
-
@chapter.book.image_types = %w(
|
53
|
+
@chapter.book.image_types = %w(.png .jpg .jpeg .gif .svg)
|
54
54
|
@column = 0
|
55
55
|
@sec_counter = SecCounter.new(5, @chapter)
|
56
56
|
@nonum_counter = 0
|
@@ -444,9 +444,11 @@ module ReVIEW
|
|
444
444
|
|
445
445
|
def list_body(id, lines, lang)
|
446
446
|
id ||= ''
|
447
|
-
|
448
|
-
body = lines.inject(''){|i, j| i + detab(j) + "\n"}
|
447
|
+
class_names = ["list"]
|
449
448
|
lexer = lang || File.extname(id).gsub(/\./, '')
|
449
|
+
class_names.push("language-#{lexer}") unless lexer.blank?
|
450
|
+
print %Q[<pre class="#{class_names.join(" ")}">]
|
451
|
+
body = lines.inject(''){|i, j| i + detab(j) + "\n"}
|
450
452
|
puts highlight(:body => body, :lexer => lexer, :format => 'html')
|
451
453
|
puts '</pre>'
|
452
454
|
end
|
@@ -491,7 +493,9 @@ module ReVIEW
|
|
491
493
|
puts highlight(:body => body, :lexer => lexer, :format => 'html',
|
492
494
|
:options => {:linenos => 'inline', :nowrap => false})
|
493
495
|
else
|
494
|
-
|
496
|
+
class_names = ["list"]
|
497
|
+
class_names.push("language-#{lang}") unless lang.blank?
|
498
|
+
print %Q[<pre class="#{class_names.join(" ")}">]
|
495
499
|
lines.each_with_index do |line, i|
|
496
500
|
puts detab((i+1).to_s.rjust(2) + ": " + line)
|
497
501
|
end
|
@@ -504,7 +508,9 @@ module ReVIEW
|
|
504
508
|
if caption.present?
|
505
509
|
puts %Q(<p class="caption">#{compile_inline(caption)}</p>)
|
506
510
|
end
|
507
|
-
|
511
|
+
class_names = ["emlist"]
|
512
|
+
class_names.push("language-#{lang}") unless lang.blank?
|
513
|
+
print %Q[<pre class="#{class_names.join(" ")}">]
|
508
514
|
body = lines.inject(''){|i, j| i + detab(j) + "\n"}
|
509
515
|
lexer = lang
|
510
516
|
puts highlight(:body => body, :lexer => lexer, :format => 'html')
|
@@ -524,7 +530,9 @@ module ReVIEW
|
|
524
530
|
puts highlight(:body => body, :lexer => lexer, :format => 'html',
|
525
531
|
:options => {:linenos => 'inline', :nowrap => false})
|
526
532
|
else
|
527
|
-
|
533
|
+
class_names = ["emlist"]
|
534
|
+
class_names.push("language-#{lang}") unless lang.blank?
|
535
|
+
print %Q[<pre class="#{class_names.join(" ")}">]
|
528
536
|
lines.each_with_index do |line, i|
|
529
537
|
puts detab((i+1).to_s.rjust(2) + ": " + line)
|
530
538
|
end
|
@@ -622,7 +630,7 @@ module ReVIEW
|
|
622
630
|
end
|
623
631
|
|
624
632
|
def image_dummy(id, caption, lines)
|
625
|
-
puts %Q[<div class="image">]
|
633
|
+
puts %Q[<div id="#{normalize_id(id)}" class="image">]
|
626
634
|
puts %Q[<pre class="dummyimage">]
|
627
635
|
lines.each do |line|
|
628
636
|
puts detab(line)
|
@@ -761,7 +769,7 @@ module ReVIEW
|
|
761
769
|
def indepimage(id, caption="", metric=nil)
|
762
770
|
metrics = parse_metric("html", metric)
|
763
771
|
caption = "" if caption.nil?
|
764
|
-
puts %Q[<div class="image">]
|
772
|
+
puts %Q[<div id="#{normalize_id(id)}" class="image">]
|
765
773
|
begin
|
766
774
|
puts %Q[<img src="#{@chapter.image(id).path.sub(/\A\.\//, "")}" alt="#{escape_html(compile_inline(caption))}"#{metrics} />]
|
767
775
|
rescue
|
@@ -932,8 +940,7 @@ module ReVIEW
|
|
932
940
|
if @book.config["mathml"]
|
933
941
|
require 'math_ml'
|
934
942
|
require 'math_ml/symbol/character_reference'
|
935
|
-
parser = MathML::LaTeX::Parser.new(
|
936
|
-
:symbol => MathML::Symbol::CharacterReference)
|
943
|
+
parser = MathML::LaTeX::Parser.new(:symbol => MathML::Symbol::CharacterReference)
|
937
944
|
%Q[<span class="equation">#{parser.parse(str, nil)}</span>]
|
938
945
|
else
|
939
946
|
%Q[<span class="equation">#{escape_html(str)}</span>]
|
data/lib/review/htmlutils.rb
CHANGED
@@ -69,11 +69,10 @@ module ReVIEW
|
|
69
69
|
begin
|
70
70
|
require 'pygments'
|
71
71
|
begin
|
72
|
-
Pygments.highlight(
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
:lexer => lexer)
|
72
|
+
Pygments.highlight(unescape_html(body),
|
73
|
+
:options => options,
|
74
|
+
:formatter => format,
|
75
|
+
:lexer => lexer)
|
77
76
|
rescue MentosError
|
78
77
|
body
|
79
78
|
end
|
data/lib/review/i18n.rb
CHANGED
@@ -119,41 +119,47 @@ module ReVIEW
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
percents = frmt.scan(
|
122
|
+
percents = frmt.scan(/%[A-Za-z]{1,3}/)
|
123
|
+
remove_args = []
|
123
124
|
percents.each_with_index do |i, idx|
|
124
125
|
case i
|
125
126
|
when "%pA"
|
126
127
|
frmt.sub!(i, ALPHA_U[args[idx]])
|
127
|
-
|
128
|
+
remove_args << idx
|
128
129
|
when "%pa"
|
129
130
|
frmt.sub!(i, ALPHA_L[args[idx]])
|
130
|
-
|
131
|
+
remove_args << idx
|
131
132
|
when "%pAW"
|
132
133
|
frmt.sub!(i, ALPHA_UW[args[idx]])
|
133
|
-
|
134
|
+
remove_args << idx
|
134
135
|
when "%paW"
|
135
136
|
frmt.sub!(i, ALPHA_LW[args[idx]])
|
136
|
-
|
137
|
+
remove_args << idx
|
137
138
|
when "%pR"
|
138
139
|
frmt.sub!(i, ROMAN_U[args[idx]])
|
139
|
-
|
140
|
+
remove_args << idx
|
140
141
|
when "%pr"
|
141
142
|
frmt.sub!(i, ROMAN_L[args[idx]])
|
142
|
-
|
143
|
+
remove_args << idx
|
143
144
|
when "%pRW"
|
144
145
|
frmt.sub!(i, ROMAN_UW[args[idx]])
|
145
|
-
|
146
|
+
remove_args << idx
|
146
147
|
when "%pJ"
|
147
148
|
frmt.sub!(i, JAPAN[args[idx]])
|
148
|
-
|
149
|
+
remove_args << idx
|
149
150
|
when "%pdW"
|
150
151
|
frmt.sub!(i, ARABIC_LW[args[idx]])
|
151
|
-
|
152
|
+
remove_args << idx
|
152
153
|
when "%pDW"
|
153
154
|
frmt.sub!(i, ARABIC_UW[args[idx]])
|
154
|
-
|
155
|
+
remove_args << idx
|
156
|
+
else
|
157
|
+
# noop
|
155
158
|
end
|
156
159
|
end
|
160
|
+
remove_args.reverse_each do |idx|
|
161
|
+
args.delete_at idx
|
162
|
+
end
|
157
163
|
args_matched = (frmt.count("%") == args.size)
|
158
164
|
frmt.gsub!('##', '%%')
|
159
165
|
args_matched ? (frmt % args) : frmt
|
data/lib/review/i18n.yml
CHANGED
@@ -6,7 +6,9 @@ ja:
|
|
6
6
|
columnname: "コラム"
|
7
7
|
column_head: "■コラム"
|
8
8
|
part: 第%d部
|
9
|
+
part_short: "%pR"
|
9
10
|
chapter: 第%d章
|
11
|
+
chapter_short: "%d"
|
10
12
|
chapter_postfix: " "
|
11
13
|
chapter_quote: "「%s」"
|
12
14
|
appendix: 付録%pA
|
@@ -66,7 +68,9 @@ en:
|
|
66
68
|
columnname: "Column"
|
67
69
|
column_head: "Column"
|
68
70
|
part: "Part %s"
|
71
|
+
part_short: "%pR"
|
69
72
|
chapter: Chapter %d
|
73
|
+
chapter_short: "%d"
|
70
74
|
chapter_postfix: ". "
|
71
75
|
chapter_quote: '"%s"'
|
72
76
|
appendix: Appendix %s
|
@@ -123,7 +127,9 @@ zh-TW:
|
|
123
127
|
table: 表
|
124
128
|
list: List
|
125
129
|
part: 第%d部份
|
130
|
+
part_short: "%pR"
|
126
131
|
chapter: 第%d章
|
132
|
+
chapter_short: "%d"
|
127
133
|
chapter_postfix: " "
|
128
134
|
chapter_quote: "「%s」"
|
129
135
|
appendix: 附錄%s
|
data/lib/review/idgxmlbuilder.rb
CHANGED
@@ -392,7 +392,7 @@ module ReVIEW
|
|
392
392
|
|
393
393
|
def quotedlist(lines, css_class, caption)
|
394
394
|
print %Q[<list type='#{css_class}'>]
|
395
|
-
puts "<caption aid:pstyle='#{css_class}-title'>#{compile_inline(caption)}</caption>"
|
395
|
+
puts "<caption aid:pstyle='#{css_class}-title'>#{compile_inline(caption)}</caption>" if caption.present?
|
396
396
|
print %Q[<pre>]
|
397
397
|
no = 1
|
398
398
|
lines.each do |line|
|
@@ -811,7 +811,7 @@ module ReVIEW
|
|
811
811
|
@column += 1
|
812
812
|
a_id = %Q[id="column-#{@column}"]
|
813
813
|
print "<#{type}column #{a_id}>"
|
814
|
-
puts %Q[<title aid:pstyle="#{type}column-title">#{compile_inline(caption)}</title
|
814
|
+
puts %Q[<title aid:pstyle="#{type}column-title">#{compile_inline(caption)}</title><?dtp level="9" section="#{escape_html(compile_inline(caption))}"?>]
|
815
815
|
end
|
816
816
|
|
817
817
|
def common_column_end(type)
|
data/lib/review/makerhelper.rb
CHANGED
@@ -53,7 +53,7 @@ module ReVIEW
|
|
53
53
|
image_files << "#{from_dir}/#{fname}.#{conv_type}"
|
54
54
|
end
|
55
55
|
|
56
|
-
exts = options[:exts] || %w(png gif jpg jpeg svg pdf eps)
|
56
|
+
exts = options[:exts] || %w(png gif jpg jpeg svg pdf eps ai tif)
|
57
57
|
exts_str = exts.join('|')
|
58
58
|
if !is_converted && fname =~ /\.(#{exts_str})$/i
|
59
59
|
FileUtils.cp "#{from_dir}/#{fname}", to_dir
|
@@ -5,11 +5,13 @@
|
|
5
5
|
|
6
6
|
require 'review/builder'
|
7
7
|
require 'review/textutils'
|
8
|
+
require 'review/htmlutils'
|
8
9
|
|
9
10
|
module ReVIEW
|
10
11
|
|
11
12
|
class MARKDOWNBuilder < Builder
|
12
13
|
include TextUtils
|
14
|
+
include HTMLUtils
|
13
15
|
|
14
16
|
def extname
|
15
17
|
'.md'
|
@@ -18,7 +20,7 @@ module ReVIEW
|
|
18
20
|
def builder_init_file
|
19
21
|
@blank_seen = nil
|
20
22
|
@ul_indent = 0
|
21
|
-
@chapter.book.image_types = %w(
|
23
|
+
@chapter.book.image_types = %w(.png .jpg .jpeg .gif .svg)
|
22
24
|
end
|
23
25
|
private :builder_init_file
|
24
26
|
|
@@ -290,6 +292,15 @@ module ReVIEW
|
|
290
292
|
def nofunc_text(str)
|
291
293
|
str
|
292
294
|
end
|
295
|
+
|
296
|
+
def compile_ruby(base, ruby)
|
297
|
+
if @book.htmlversion == 5
|
298
|
+
%Q[<ruby>#{escape_html(base)}<rp>#{I18n.t("ruby_prefix")}</rp><rt>#{escape_html(ruby)}</rt><rp>#{I18n.t("ruby_postfix")}</rp></ruby>]
|
299
|
+
else
|
300
|
+
%Q[<ruby><rb>#{escape_html(base)}</rb><rp>#{I18n.t("ruby_prefix")}</rp><rt>#{ruby}</rt><rp>#{I18n.t("ruby_postfix")}</rp></ruby>]
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
293
304
|
end
|
294
305
|
|
295
306
|
end # module ReVIEW
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# This program is free software.
|
3
|
+
# You can distribute or modify this program under the terms of
|
4
|
+
# the GNU LGPL, Lesser General Public License version 2.1.
|
5
|
+
|
6
|
+
require 'review/markdownbuilder'
|
7
|
+
|
8
|
+
module ReVIEW
|
9
|
+
|
10
|
+
class MD2INAOBuilder < MARKDOWNBuilder
|
11
|
+
def paragraph(lines)
|
12
|
+
puts " " + lines.join
|
13
|
+
puts "\n"
|
14
|
+
end
|
15
|
+
|
16
|
+
def list_header(id, caption, lang)
|
17
|
+
lang ||= ""
|
18
|
+
puts "```#{lang}"
|
19
|
+
print %Q[●リスト#{@chapter.list(id).number}::#{compile_inline(caption)}\n\n]
|
20
|
+
end
|
21
|
+
|
22
|
+
def cmd(lines)
|
23
|
+
# WEB+DB では使っていないらしいけど
|
24
|
+
puts "!!! cmd"
|
25
|
+
lines.each do |line|
|
26
|
+
puts detab(line)
|
27
|
+
end
|
28
|
+
puts ""
|
29
|
+
end
|
30
|
+
|
31
|
+
def dl_begin
|
32
|
+
puts '<dl>'
|
33
|
+
end
|
34
|
+
|
35
|
+
def dt(line)
|
36
|
+
puts "<dt>#{line}</dt>"
|
37
|
+
end
|
38
|
+
|
39
|
+
def dd(lines)
|
40
|
+
puts "<dd>#{lines.join}</dd>"
|
41
|
+
end
|
42
|
+
|
43
|
+
def dl_end
|
44
|
+
puts '</dl>'
|
45
|
+
end
|
46
|
+
|
47
|
+
def comment(lines, comment = nil)
|
48
|
+
lines ||= []
|
49
|
+
lines.unshift comment unless comment.blank?
|
50
|
+
str = lines.join("\n")
|
51
|
+
puts '<span class="red">'
|
52
|
+
puts str
|
53
|
+
puts '</span>'
|
54
|
+
end
|
55
|
+
|
56
|
+
def compile_ruby(base, ruby)
|
57
|
+
if base.length == 1
|
58
|
+
%Q[<span class='monoruby'>#{escape_html(base)}(#{escape_html(ruby)})</span>]
|
59
|
+
else
|
60
|
+
%Q[<span class='groupruby'>#{escape_html(base)}(#{escape_html(ruby)})</span>]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end # module ReVIEW
|
data/lib/review/pdfmaker.rb
CHANGED
@@ -30,10 +30,11 @@ module ReVIEW
|
|
30
30
|
include FileUtils
|
31
31
|
include ReVIEW::LaTeXUtils
|
32
32
|
|
33
|
-
attr_accessor :config, :basedir
|
33
|
+
attr_accessor :config, :basedir, :basehookdir
|
34
34
|
|
35
35
|
def initialize
|
36
36
|
@basedir = nil
|
37
|
+
@basehookdir = nil
|
37
38
|
@input_files = Hash.new{|h, key| h[key] = ""}
|
38
39
|
end
|
39
40
|
|
@@ -121,6 +122,7 @@ module ReVIEW
|
|
121
122
|
@config.merge!(cmd_config)
|
122
123
|
I18n.setup(@config["language"])
|
123
124
|
@basedir = File.dirname(yamlfile)
|
125
|
+
@basehookdir = File.absolute_path(File.dirname(yamlfile))
|
124
126
|
|
125
127
|
begin
|
126
128
|
@config.check_version(ReVIEW::VERSION)
|
@@ -226,7 +228,7 @@ module ReVIEW
|
|
226
228
|
ReVIEW::MakerHelper.copy_images_to_dir(from, to)
|
227
229
|
Dir.chdir(to) do
|
228
230
|
images = Dir.glob("**/*").find_all{|f|
|
229
|
-
File.file?(f) and f =~ /\.(jpg|jpeg|png|pdf)\z/
|
231
|
+
File.file?(f) and f =~ /\.(jpg|jpeg|png|pdf|ai|eps|tif)\z/
|
230
232
|
}
|
231
233
|
break if images.empty?
|
232
234
|
system("extractbb", *images)
|
@@ -274,15 +276,15 @@ module ReVIEW
|
|
274
276
|
def make_authors
|
275
277
|
authors = ""
|
276
278
|
if @config["aut"].present?
|
277
|
-
author_names = join_with_separator(@config.names_of("aut"), ReVIEW::I18n.t("names_splitter"))
|
279
|
+
author_names = join_with_separator(@config.names_of("aut").map{|s| escape_latex(s)}, ReVIEW::I18n.t("names_splitter"))
|
278
280
|
authors = ReVIEW::I18n.t("author_with_label", author_names)
|
279
281
|
end
|
280
282
|
if @config["csl"].present?
|
281
|
-
csl_names = join_with_separator(@config.names_of("csl"), ReVIEW::I18n.t("names_splitter"))
|
283
|
+
csl_names = join_with_separator(@config.names_of("csl").map{|s| escape_latex(s)}, ReVIEW::I18n.t("names_splitter"))
|
282
284
|
authors += " \\\\\n"+ ReVIEW::I18n.t("supervisor_with_label", csl_names)
|
283
285
|
end
|
284
286
|
if @config["trl"].present?
|
285
|
-
trl_names = join_with_separator(@config.names_of("trl"), ReVIEW::I18n.t("names_splitter"))
|
287
|
+
trl_names = join_with_separator(@config.names_of("trl").map{|s| escape_latex(s)}, ReVIEW::I18n.t("names_splitter"))
|
286
288
|
authors += " \\\\\n"+ ReVIEW::I18n.t("translator_with_label", trl_names)
|
287
289
|
end
|
288
290
|
authors
|
@@ -348,6 +350,17 @@ module ReVIEW
|
|
348
350
|
@coverimageoption = "width=\\textwidth,height=\\textheight,keepaspectratio"
|
349
351
|
end
|
350
352
|
|
353
|
+
@locale_latex = Hash.new
|
354
|
+
part_tuple = I18n.get("part").split(/\%[A-Za-z]{1,3}/, 2)
|
355
|
+
chapter_tuple = I18n.get("chapter").split(/\%[A-Za-z]{1,3}/, 2)
|
356
|
+
appendix_tuple = I18n.get("appendix").split(/\%[A-Za-z]{1,3}/, 2)
|
357
|
+
@locale_latex["prepartname"] = part_tuple[0]
|
358
|
+
@locale_latex["postpartname"] = part_tuple[1]
|
359
|
+
@locale_latex["prechaptername"] = chapter_tuple[0]
|
360
|
+
@locale_latex["postchaptername"] = chapter_tuple[1]
|
361
|
+
@locale_latex["preappendixname"] = appendix_tuple[0]
|
362
|
+
@locale_latex["postappendixname"] = appendix_tuple[1]
|
363
|
+
|
351
364
|
template = File.expand_path('./latex/layout.tex.erb', ReVIEW::Template::TEMPLATE_DIR)
|
352
365
|
layout_file = File.join(@basedir, "layouts", "layout.tex.erb")
|
353
366
|
if File.exist?(layout_file)
|
@@ -378,11 +391,11 @@ module ReVIEW
|
|
378
391
|
|
379
392
|
def call_hook(hookname)
|
380
393
|
if @config["pdfmaker"].instance_of?(Hash) && @config["pdfmaker"][hookname]
|
381
|
-
hook = File.absolute_path(@config["pdfmaker"][hookname], @
|
394
|
+
hook = File.absolute_path(@config["pdfmaker"][hookname], @basehookdir)
|
382
395
|
if ENV["REVIEW_SAFE_MODE"].to_i & 1 > 0
|
383
396
|
warn "hook configuration is prohibited in safe mode. ignored."
|
384
397
|
else
|
385
|
-
system_or_raise("#{hook} #{Dir.pwd} #{@
|
398
|
+
system_or_raise("#{hook} #{Dir.pwd} #{@basehookdir}")
|
386
399
|
end
|
387
400
|
end
|
388
401
|
end
|