review 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +1 -0
  3. data/ChangeLog +100 -0
  4. data/README.rdoc +11 -12
  5. data/Rakefile +6 -2
  6. data/bin/review-check +1 -1
  7. data/bin/review-compile +13 -4
  8. data/bin/review-epubmaker +172 -24
  9. data/bin/review-epubmaker-ng +8 -161
  10. data/bin/review-index +1 -1
  11. data/bin/review-init +17 -5
  12. data/bin/review-pdfmaker +40 -19
  13. data/bin/review-preproc +1 -1
  14. data/bin/review-validate +2 -2
  15. data/bin/review-vol +1 -1
  16. data/debian/control +2 -2
  17. data/doc/format.rdoc +23 -6
  18. data/doc/format_idg.rdoc +3 -3
  19. data/doc/libepubmaker/config.yaml +163 -0
  20. data/doc/quickstart.rdoc +27 -27
  21. data/doc/sample.yaml +10 -5
  22. data/lib/epubmaker.rb +2 -5
  23. data/lib/epubmaker/content.rb +9 -6
  24. data/lib/epubmaker/epubv2.rb +233 -109
  25. data/lib/epubmaker/epubv3.rb +83 -119
  26. data/lib/epubmaker/producer.rb +50 -20
  27. data/lib/epubmaker/resource.rb +22 -8
  28. data/lib/review/book/base.rb +1 -0
  29. data/lib/review/book/chapter.rb +2 -2
  30. data/lib/review/book/compilable.rb +1 -1
  31. data/lib/review/book/index.rb +33 -27
  32. data/lib/review/book/parameters.rb +3 -2
  33. data/lib/review/book/part.rb +1 -1
  34. data/lib/review/builder.rb +10 -42
  35. data/lib/review/compiler.rb +1 -1
  36. data/lib/review/configure.rb +3 -3
  37. data/lib/review/epubmaker.rb +428 -0
  38. data/lib/review/htmlbuilder.rb +45 -95
  39. data/lib/review/htmlutils.rb +2 -0
  40. data/lib/review/i18n.yaml +25 -0
  41. data/lib/review/idgxmlbuilder.rb +11 -9
  42. data/lib/review/inaobuilder.rb +1 -1
  43. data/lib/review/latexbuilder.rb +7 -6
  44. data/lib/review/latexutils.rb +6 -0
  45. data/lib/review/makerhelper.rb +4 -2
  46. data/lib/review/markdownbuilder.rb +8 -0
  47. data/lib/review/sec_counter.rb +71 -0
  48. data/lib/review/topbuilder.rb +0 -1
  49. data/lib/review/version.rb +2 -2
  50. data/review.gemspec +4 -4
  51. data/test/sample-book/README.md +2 -2
  52. data/test/sample-book/src/Rakefile +2 -2
  53. data/test/sample-book/src/config.yml +4 -4
  54. data/test/sample-book/src/images/cover.jpg +0 -0
  55. data/test/sample-book/src/sty/{samplemacro.sty → reviewmacro.sty} +1 -1
  56. data/test/test_book_parameter.rb +1 -1
  57. data/test/test_epubmaker.rb +77 -15
  58. data/test/test_epubmaker_cmd.rb +11 -7
  59. data/test/test_helper.rb +7 -0
  60. data/test/test_htmlbuilder.rb +39 -6
  61. data/test/test_idgxmlbuilder.rb +14 -2
  62. data/test/test_inaobuilder.rb +2 -1
  63. data/test/test_latexbuilder.rb +23 -2
  64. data/test/test_makerhelper.rb +19 -3
  65. data/test/test_markdownbuilder.rb +35 -0
  66. data/test/test_pdfmaker_cmd.rb +11 -7
  67. data/test/test_topbuilder.rb +36 -2
  68. metadata +18 -18
  69. data/VERSION +0 -1
  70. data/doc/libepubmaker/sample.yaml +0 -90
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Copyright (c) 2002-2007 Minero Aoki
4
- # 2008-2012 Minero Aoki, Kenshi Muto, Masayoshi Takahashi,
4
+ # 2008-2014 Minero Aoki, Kenshi Muto, Masayoshi Takahashi,
5
5
  # KADO Masanori
6
6
  #
7
7
  # This program is free software.
@@ -13,6 +13,7 @@ require 'review/builder'
13
13
  require 'review/htmlutils'
14
14
  require 'review/htmllayout'
15
15
  require 'review/textutils'
16
+ require 'review/sec_counter'
16
17
 
17
18
  module ReVIEW
18
19
 
@@ -47,10 +48,6 @@ module ReVIEW
47
48
 
48
49
  def builder_init(no_error = false)
49
50
  @no_error = no_error
50
- @section = 0
51
- @subsection = 0
52
- @subsubsection = 0
53
- @subsubsubsection = 0
54
51
  @column = 0
55
52
  @noindent = nil
56
53
  @ol_num = nil
@@ -60,24 +57,26 @@ module ReVIEW
60
57
  def builder_init_file
61
58
  @warns = []
62
59
  @errors = []
60
+ @chapter.book.image_types = %w( .png .jpg .jpeg .gif .svg )
61
+ @sec_counter = SecCounter.new(5, @chapter)
63
62
  end
64
63
  private :builder_init_file
65
64
 
66
65
  def result
67
66
  layout_file = File.join(@book.basedir, "layouts", "layout.erb")
68
- if File.exists?(layout_file)
67
+ if File.exist?(layout_file)
68
+ title = convert_outencoding(strip_html(compile_inline(@chapter.title)), ReVIEW.book.param["outencoding"])
69
69
  messages() +
70
- HTMLLayout.new(@output.string, @chapter.title, layout_file).result
70
+ HTMLLayout.new(@output.string, title, layout_file).result
71
71
  else
72
72
  # default XHTML header/footer
73
73
  header = <<EOT
74
74
  <?xml version="1.0" encoding="#{ReVIEW.book.param["outencoding"] || :UTF-8}"?>
75
75
  EOT
76
-
77
- if ReVIEW.book.param["htmlversion"] == 5
76
+ if ReVIEW.book.param["htmlversion"].to_i == 5
78
77
  header += <<EOT
79
78
  <!DOCTYPE html>
80
- <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="#{ReVIEW.book.param["language"]}">
79
+ <html xmlns="http://www.w3.org/1999/xhtml" xmlns:#{xmlns_ops_prefix}="http://www.idpf.org/2007/ops" xml:lang="#{ReVIEW.book.param["language"]}">
81
80
  <head>
82
81
  <meta charset="#{ReVIEW.book.param["outencoding"] || :UTF-8}" />
83
82
  EOT
@@ -99,7 +98,7 @@ EOT
99
98
  end
100
99
  end
101
100
  header += <<EOT
102
- <meta name="generator" content="ReVIEW" />
101
+ <meta name="generator" content="Re:VIEW" />
103
102
  <title>#{convert_outencoding(strip_html(compile_inline(@chapter.title)), ReVIEW.book.param["outencoding"])}</title>
104
103
  </head>
105
104
  <body>
@@ -112,6 +111,14 @@ EOT
112
111
  end
113
112
  end
114
113
 
114
+ def xmlns_ops_prefix
115
+ if ReVIEW.book.param["epubversion"].to_i == 3
116
+ "epub"
117
+ else
118
+ "ops"
119
+ end
120
+ end
121
+
115
122
  def warn(msg)
116
123
  if @no_error
117
124
  @warns.push [@location.filename, @location.lineno, msg]
@@ -155,75 +162,9 @@ EOT
155
162
  end
156
163
 
157
164
  def headline_prefix(level)
158
- anchor = ""
159
- case level
160
- when 1
161
- @section = 0
162
- @subsection = 0
163
- @subsubsection = 0
164
- @subsubsubsection = 0
165
- anchor = "#{@chapter.number}"
166
- if ReVIEW.book.param["secnolevel"] >= 1
167
- if @chapter.number.blank?
168
- prefix = ""
169
- else
170
- placeholder = if @chapter.is_a? ReVIEW::Book::Part
171
- 'part'
172
- elsif @chapter.on_POSTDEF?
173
- 'appendix'
174
- else
175
- 'chapter'
176
- end
177
- prefix = "#{I18n.t(placeholder, @chapter.number)}#{I18n.t("chapter_postfix")}"
178
- end
179
- end
180
- when 2
181
- @section += 1
182
- @subsection = 0
183
- @subsubsection = 0
184
- @subsubsubsection = 0
185
- anchor = "#{@chapter.number}-#{@section}"
186
- if ReVIEW.book.param["secnolevel"] >= 2
187
- if @chapter.number.blank? or @chapter.on_POSTDEF?
188
- prefix = ""
189
- else
190
- prefix = "#{@chapter.number}.#{@section}#{I18n.t("chapter_postfix")}"
191
- end
192
- end
193
- when 3
194
- @subsection += 1
195
- @subsubsection = 0
196
- @subsubsubsection = 0
197
- anchor = "#{@chapter.number}-#{@section}-#{@subsection}"
198
- if ReVIEW.book.param["secnolevel"] >= 3
199
- if @chapter.number.blank? or @chapter.on_POSTDEF?
200
- prefix = ""
201
- else
202
- prefix = "#{@chapter.number}.#{@section}.#{@subsection}#{I18n.t("chapter_postfix")}"
203
- end
204
- end
205
- when 4
206
- @subsubsection += 1
207
- @subsubsubsection = 0
208
- anchor = "#{@chapter.number}-#{@section}-#{@subsection}-#{@subsubsection}"
209
- if ReVIEW.book.param["secnolevel"] >= 4
210
- if @chapter.number.blank? or @chapter.on_POSTDEF?
211
- prefix = ""
212
- else
213
- prefix = "#{@chapter.number}.#{@section}.#{@subsection}.#{@subsubsection}#{I18n.t("chapter_postfix")}"
214
- end
215
- end
216
- when 5
217
- @subsubsubsection += 1
218
- anchor = "#{@chapter.number}-#{@section}-#{@subsection}-#{@subsubsection}-#{@subsubsubsection}"
219
- if ReVIEW.book.param["secnolevel"] >= 5
220
- if @chapter.number.blank? or @chapter.on_POSTDEF?
221
- prefix = ""
222
- else
223
- prefix = "#{@chapter.number}.#{@section}.#{@subsection}.#{@subsubsection}.#{@subsubsubsection}#{I18n.t("chapter_postfix")}"
224
- end
225
- end
226
- end
165
+ @sec_counter.inc(level)
166
+ anchor = @sec_counter.anchor(level)
167
+ prefix = @sec_counter.prefix(level, ReVIEW.book.param["secnolevel"])
227
168
  [prefix, anchor]
228
169
  end
229
170
  private :headline_prefix
@@ -542,8 +483,9 @@ EOT
542
483
  puts '</div>'
543
484
  end
544
485
 
545
- def emlistnum(lines)
486
+ def emlistnum(lines, caption = nil)
546
487
  puts %Q[<div class="emlistnum-code">]
488
+ puts %Q(<p class="caption">#{caption}</p>) unless caption.nil?
547
489
  print %Q[<pre class="emlist">]
548
490
  lines.each_with_index do |line, i|
549
491
  puts detab((i+1).to_s.rjust(2) + ": " + line)
@@ -615,7 +557,7 @@ QUOTE
615
557
  def texequation(lines)
616
558
  puts %Q[<div class="equation">]
617
559
  if ReVIEW.book.param["mathml"]
618
- p = MathML::LaTeX::Parser.new
560
+ p = MathML::LaTeX::Parser.new(:symbol=>MathML::Symbol::CharacterReference)
619
561
  puts p.parse(unescape_html(lines.join("\n")), true)
620
562
  else
621
563
  print '<pre>'
@@ -684,7 +626,7 @@ QUOTE
684
626
  puts %Q[<div class="table">]
685
627
  begin
686
628
  table_header id, caption unless caption.nil?
687
- rescue KeyError => err
629
+ rescue KeyError
688
630
  error "no such table: #{id}"
689
631
  end
690
632
  table_begin rows.first.size
@@ -747,7 +689,11 @@ QUOTE
747
689
  end
748
690
 
749
691
  def footnote(id, str)
750
- puts %Q(<div class="footnote"><p class="footnote">[<a id="fn-#{id}">*#{@chapter.footnote(id).number}</a>] #{compile_inline(str)}</p></div>)
692
+ if ReVIEW.book.param["epubversion"].to_i == 3
693
+ puts %Q(<div class="footnote" epub:type="footnote" id="fn-#{id}"><p class="footnote">[*#{@chapter.footnote(id).number}] #{compile_inline(str)}</p></div>)
694
+ else
695
+ puts %Q(<div class="footnote"><p class="footnote">[<a id="fn-#{id}">*#{@chapter.footnote(id).number}</a>] #{compile_inline(str)}</p></div>)
696
+ end
751
697
  end
752
698
 
753
699
  def indepimage(id, caption="", metric=nil)
@@ -805,10 +751,11 @@ QUOTE
805
751
  alias inline_ref inline_labelref
806
752
 
807
753
  def inline_chapref(id)
754
+ title = super
808
755
  if ReVIEW.book.param["chapterlink"]
809
- %Q(<a href="./#{id}.html">#{@chapter.env.chapter_index.display_string(id)}</a>)
756
+ %Q(<a href="./#{id}.html">#{title}</a>)
810
757
  else
811
- @chapter.env.chapter_index.display_string(id)
758
+ title
812
759
  end
813
760
  rescue KeyError
814
761
  error "unknown chapter: #{id}"
@@ -837,14 +784,17 @@ QUOTE
837
784
  nofunc_text("[UnknownChapter:#{id}]")
838
785
  end
839
786
 
840
-
841
787
  def inline_fn(id)
842
- %Q(<a href="#fn-#{id}">*#{@chapter.footnote(id).number}</a>)
788
+ if ReVIEW.book.param["epubversion"].to_i == 3
789
+ %Q(<a href="#fn-#{id}" class="noteref" epub:type="noteref">*#{@chapter.footnote(id).number}</a>)
790
+ else
791
+ %Q(<a href="#fn-#{id}" class="noteref">*#{@chapter.footnote(id).number}</a>)
792
+ end
843
793
  end
844
794
 
845
795
  def compile_ruby(base, ruby)
846
- if ReVIEW.book.param["htmlversion"] == 5
847
- %Q[<ruby>#{escape_html(base)}<rp>#{I18n.t("ruby_prefix")}</rp><rt>#{ruby}</rt><rp>#{I18n.t("ruby_postfix")}</rp></ruby>]
796
+ if ReVIEW.book.param["htmlversion"].to_i == 5
797
+ %Q[<ruby>#{escape_html(base)}<rp>#{I18n.t("ruby_prefix")}</rp><rt>#{escape_html(ruby)}</rt><rp>#{I18n.t("ruby_postfix")}</rp></ruby>]
848
798
  else
849
799
  %Q[<ruby><rb>#{escape_html(base)}</rb><rp>#{I18n.t("ruby_prefix")}</rp><rt>#{ruby}</rt><rp>#{I18n.t("ruby_postfix")}</rp></ruby>]
850
800
  end
@@ -876,7 +826,7 @@ QUOTE
876
826
  end
877
827
 
878
828
  def inline_tti(str)
879
- if ReVIEW.book.param["htmlversion"] == 5
829
+ if ReVIEW.book.param["htmlversion"].to_i == 5
880
830
  %Q(<code class="tt"><i>#{escape_html(str)}</i></code>)
881
831
  else
882
832
  %Q(<tt><i>#{escape_html(str)}</i></tt>)
@@ -884,7 +834,7 @@ QUOTE
884
834
  end
885
835
 
886
836
  def inline_ttb(str)
887
- if ReVIEW.book.param["htmlversion"] == 5
837
+ if ReVIEW.book.param["htmlversion"].to_i == 5
888
838
  %Q(<code class="tt"><b>#{escape_html(str)}</b></code>)
889
839
  else
890
840
  %Q(<tt><b>#{escape_html(str)}</b></tt>)
@@ -896,7 +846,7 @@ QUOTE
896
846
  end
897
847
 
898
848
  def inline_code(str)
899
- if ReVIEW.book.param["htmlversion"] == 5
849
+ if ReVIEW.book.param["htmlversion"].to_i == 5
900
850
  %Q(<code class="inline-code tt">#{escape_html(str)}</code>)
901
851
  else
902
852
  %Q(<tt class="inline-code">#{escape_html(str)}</tt>)
@@ -917,7 +867,7 @@ QUOTE
917
867
 
918
868
  def inline_m(str)
919
869
  if ReVIEW.book.param["mathml"]
920
- p = MathML::LaTeX::Parser.new
870
+ p = MathML::LaTeX::Parser.new(:symbol=>MathML::Symbol::CharacterReference)
921
871
  %Q[<span class="equation">#{p.parse(str, nil)}</span>]
922
872
  else
923
873
  %Q[<span class="equation">#{escape_html(str)}</span>]
@@ -1060,7 +1010,7 @@ QUOTE
1060
1010
  end
1061
1011
 
1062
1012
  def inline_tt(str)
1063
- if ReVIEW.book.param["htmlversion"] == 5
1013
+ if ReVIEW.book.param["htmlversion"].to_i == 5
1064
1014
  %Q(<code class="tt">#{escape_html(str)}</code>)
1065
1015
  else
1066
1016
  %Q(<tt>#{escape_html(str)}</tt>)
@@ -37,6 +37,8 @@ module ReVIEW
37
37
  lexer = ops[:lexer] || ''
38
38
  format = ops[:format] || ''
39
39
 
40
+ return body if ReVIEW.book.param["pygments"].nil?
41
+
40
42
  begin
41
43
  require 'pygments'
42
44
  begin
data/lib/review/i18n.yaml CHANGED
@@ -15,6 +15,11 @@ ja:
15
15
  caption_prefix_idgxml: " "
16
16
  ruby_prefix: "("
17
17
  ruby_postfix: ")"
18
+ aut: "著 者"
19
+ author_postfix: " 著"
20
+ supervisor_postfix: " 監修"
21
+ translator_postfix: " 訳"
22
+ names_splitter: "、"
18
23
 
19
24
  en:
20
25
  image: "Figure "
@@ -32,3 +37,23 @@ en:
32
37
  caption_prefix_idgxml: " "
33
38
  ruby_prefix: "("
34
39
  ruby_postfix: ")"
40
+ names_splitter: ", "
41
+
42
+ zh_TW:
43
+ image: 圖
44
+ table: 表
45
+ list: List
46
+ part: 第%d部份
47
+ chapter: 第%d章
48
+ chapter_postfix: " "
49
+ appendix: 附錄%d
50
+ numberless_image: "圖:"
51
+ format_number: "%s.%d"
52
+ format_number_header: "%s.%d:"
53
+ format_number_without_chapter: "%d"
54
+ format_number_header_without_chapter: "%d:"
55
+ caption_prefix: " "
56
+ caption_prefix_idgxml: " "
57
+ ruby_prefix: "("
58
+ ruby_postfix: ")"
59
+ names_splitter: ", "
@@ -287,14 +287,23 @@ module ReVIEW
287
287
 
288
288
  def ol_begin
289
289
  puts '<ol>'
290
+ if !@ol_num
291
+ @ol_num = 1
292
+ end
290
293
  end
291
294
 
292
295
  def ol_item(lines, num)
293
- puts %Q(<li aid:pstyle="ol-item" num="#{num}">#{lines.join.chomp}</li>)
296
+ puts %Q(<li aid:pstyle="ol-item" olnum="#{@ol_num}" num="#{num}">#{lines.join.chomp}</li>)
297
+ @ol_num += 1
294
298
  end
295
299
 
296
300
  def ol_end
297
301
  puts '</ol>'
302
+ @ol_num = nil
303
+ end
304
+
305
+ def olnum(num)
306
+ @ol_num = num.to_i
298
307
  end
299
308
 
300
309
  def dl_begin
@@ -476,13 +485,6 @@ module ReVIEW
476
485
  end
477
486
 
478
487
  def image_dummy(id, caption, lines)
479
- if ReVIEW.book.param["subdirmode"]
480
- warn "image file not exist: images/#{@chapter.id}/#{id}.eps" unless File.exist?("images/#{@chapter.id}/#{id}.eps")
481
- elsif ReVIEW.book.param["singledirmode"]
482
- warn "image file not exist: images/#{@chapter.id}/#{id}.eps" unless File.exist?("images/#{id}.eps")
483
- else
484
- warn "image file not exist: images/#{@chapter.id}-#{id}.eps" unless File.exist?("images/#{@chapter.id}-#{id}.eps")
485
- end
486
488
  puts "<img>"
487
489
  print %Q[<pre aid:pstyle="dummyimage">]
488
490
  lines.each do |line|
@@ -558,7 +560,7 @@ module ReVIEW
558
560
 
559
561
  begin
560
562
  table_header id, caption unless caption.nil?
561
- rescue KeyError => err
563
+ rescue KeyError
562
564
  error "no such table: #{id}"
563
565
  end
564
566
  return if rows.empty?
@@ -286,7 +286,7 @@ module ReVIEW
286
286
  puts "◆table/◆"
287
287
  begin
288
288
  table_header id, caption unless caption.nil?
289
- rescue KeyError => err
289
+ rescue KeyError
290
290
  error "no such table: #{id}"
291
291
  end
292
292
  return if rows.empty?
@@ -390,7 +390,7 @@ module ReVIEW
390
390
 
391
391
  begin
392
392
  table_header id, caption unless caption.nil?
393
- rescue KeyError => err
393
+ rescue KeyError
394
394
  error "no such table: #{id}"
395
395
  end
396
396
  return if rows.empty?
@@ -547,10 +547,11 @@ module ReVIEW
547
547
  end
548
548
 
549
549
  def inline_chapref(id)
550
+ title = super
550
551
  if ReVIEW.book.param["chapterlink"]
551
- "\\hyperref[chap:#{id}]{#{@chapter.env.chapter_index.display_string(id)}}"
552
+ "\\hyperref[chap:#{id}]{#{title}}"
552
553
  else
553
- @chapter.env.chapter_index.display_string(id)
554
+ title
554
555
  end
555
556
  rescue KeyError
556
557
  error "unknown chapter: #{id}"
@@ -617,9 +618,8 @@ module ReVIEW
617
618
  str.split(//).map {|c| macro('ruby', escape(c), macro('textgt', BOUTEN)) }.join('\allowbreak')
618
619
  end
619
620
 
620
- def inline_ruby(str)
621
- base, ruby = *str.split(/,/)
622
- macro('ruby', base, ruby)
621
+ def compile_ruby(base, ruby)
622
+ macro('ruby', escape(base), escape(ruby))
623
623
  end
624
624
 
625
625
  # math
@@ -747,6 +747,7 @@ module ReVIEW
747
747
 
748
748
  def bibpaper_bibpaper(id, caption, lines)
749
749
  print split_paragraph(lines).join("")
750
+ puts ""
750
751
  end
751
752
 
752
753
  def index(str)
@@ -43,6 +43,12 @@ module ReVIEW
43
43
  '⑧' => '\UTF{2467}',
44
44
  '⑨' => '\UTF{2468}',
45
45
  '⑩' => '\UTF{2469}',
46
+ '⑪' => '\UTF{246A}',
47
+ '⑫' => '\UTF{246B}',
48
+ '⑬' => '\UTF{246C}',
49
+ '⑭' => '\UTF{246D}',
50
+ '⑮' => '\UTF{246E}',
51
+ '⑯' => '\UTF{246F}',
46
52
  }
47
53
 
48
54
  kanalist = %w{。 「 」 、 ・ ヲ ァ ィ ゥ ェ ォ ャ ュ ョ ッ ー ア イ ウ エ オ カ キ ク ケ コ サ シ ス セ ソ タ チ ツ テ ト ナ ニ ヌ ネ ノ ハ ヒ フ ヘ ホ マ ミ ム メ モ ヤ ユ ヨ ラ リ ル レ ロ ワ ン ゙ ゚}
@@ -34,7 +34,7 @@ module ReVIEW
34
34
  dir.each do |fname|
35
35
  next if fname =~ /^\./
36
36
  if FileTest.directory?("#{from_dir}/#{fname}")
37
- image_files += copy_images_to_dir("#{from_dir}/#{fname}", "#{to_dir}/#{fname}")
37
+ image_files += copy_images_to_dir("#{from_dir}/#{fname}", "#{to_dir}/#{fname}", options)
38
38
  else
39
39
  Dir.mkdir(to_dir) unless File.exist?(to_dir)
40
40
 
@@ -45,7 +45,9 @@ module ReVIEW
45
45
  image_files << "#{from_dir}/#{fname}.#{conv_type}"
46
46
  end
47
47
 
48
- if !is_converted && fname =~ /\.(png|gif|jpg|jpeg|svg|pdf|eps)$/i
48
+ exts = options[:exts] || %w(png gif jpg jpeg svg pdf eps)
49
+ exts_str = exts.join('|')
50
+ if !is_converted && fname =~ /\.(#{exts_str})$/i
49
51
  FileUtils.cp "#{from_dir}/#{fname}", to_dir
50
52
  image_files << "#{from_dir}/#{fname}"
51
53
  end