review 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +42 -0
  3. data/README.rdoc +31 -0
  4. data/bin/review-catalog-converter +129 -0
  5. data/bin/review-check +4 -2
  6. data/bin/review-compile +7 -7
  7. data/bin/review-index +4 -3
  8. data/bin/review-init +3 -1
  9. data/bin/review-pdfmaker +2 -258
  10. data/bin/review-vol +2 -2
  11. data/doc/catalog.rdoc +18 -3
  12. data/doc/format.rdoc +2 -3
  13. data/doc/quickstart.rdoc +1 -1
  14. data/lib/epubmaker/epubv2.rb +16 -8
  15. data/lib/epubmaker/epubv3.rb +44 -12
  16. data/lib/epubmaker/producer.rb +4 -2
  17. data/lib/review/book.rb +0 -1
  18. data/lib/review/book/base.rb +72 -35
  19. data/lib/review/book/chapter.rb +8 -12
  20. data/lib/review/book/compilable.rb +8 -8
  21. data/lib/review/book/image_finder.rb +7 -0
  22. data/lib/review/book/index.rb +23 -5
  23. data/lib/review/book/volume.rb +2 -1
  24. data/lib/review/builder.rb +10 -5
  25. data/lib/review/catalog.rb +5 -0
  26. data/lib/review/compiler.rb +1 -1
  27. data/lib/review/configure.rb +12 -0
  28. data/lib/review/epubmaker.rb +13 -7
  29. data/lib/review/htmlbuilder.rb +26 -12
  30. data/lib/review/i18n.rb +2 -2
  31. data/lib/review/i18n.yml +21 -0
  32. data/lib/review/idgxmlbuilder.rb +11 -9
  33. data/lib/review/latexbuilder.rb +3 -2
  34. data/lib/review/{review.tex.erb → layout.tex.erb} +9 -1
  35. data/lib/review/markdownbuilder.rb +126 -4
  36. data/lib/review/pdfmaker.rb +291 -0
  37. data/lib/review/tocparser.rb +6 -5
  38. data/lib/review/tocprinter.rb +5 -2
  39. data/lib/review/version.rb +1 -1
  40. data/review.gemspec +1 -1
  41. data/rubocop-todo.yml +13 -0
  42. data/test/test_book.rb +95 -133
  43. data/test/test_book_chapter.rb +16 -21
  44. data/test/test_builder.rb +12 -7
  45. data/test/test_catalog.rb +15 -3
  46. data/test/test_catalog_converter_cmd.rb +73 -0
  47. data/test/test_epubmaker.rb +5 -5
  48. data/test/test_helper.rb +32 -21
  49. data/test/test_htmlbuilder.rb +219 -192
  50. data/test/test_i18n.rb +46 -19
  51. data/test/test_idgxmlbuilder.rb +177 -182
  52. data/test/test_inaobuilder.rb +1 -2
  53. data/test/test_index.rb +20 -0
  54. data/test/test_latexbuilder.rb +175 -183
  55. data/test/test_markdownbuilder.rb +41 -5
  56. data/test/test_pdfmaker.rb +130 -0
  57. data/test/test_topbuilder.rb +92 -96
  58. metadata +10 -6
  59. data/lib/review/book/parameters.rb +0 -98
  60. data/test/test_book_parameter.rb +0 -42
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: review
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kmuto
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-29 00:00:00.000000000 Z
12
+ date: 2014-10-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -29,6 +29,7 @@ description: Re:VIEW is a digital publishing system for books and ebooks. It sup
29
29
  InDesign, EPUB and LaTeX.
30
30
  email: kmuto@debian.org
31
31
  executables:
32
+ - review-catalog-converter
32
33
  - review-check
33
34
  - review-checkdep
34
35
  - review-compile
@@ -53,6 +54,7 @@ files:
53
54
  - Gemfile
54
55
  - README.rdoc
55
56
  - Rakefile
57
+ - bin/review-catalog-converter
56
58
  - bin/review-check
57
59
  - bin/review-checkdep
58
60
  - bin/review-compile
@@ -102,7 +104,6 @@ files:
102
104
  - lib/review/book/image_finder.rb
103
105
  - lib/review/book/index.rb
104
106
  - lib/review/book/page_metric.rb
105
- - lib/review/book/parameters.rb
106
107
  - lib/review/book/part.rb
107
108
  - lib/review/book/volume.rb
108
109
  - lib/review/builder.rb
@@ -126,10 +127,11 @@ files:
126
127
  - lib/review/latexbuilder.rb
127
128
  - lib/review/latexindex.rb
128
129
  - lib/review/latexutils.rb
130
+ - lib/review/layout.tex.erb
129
131
  - lib/review/makerhelper.rb
130
132
  - lib/review/markdownbuilder.rb
133
+ - lib/review/pdfmaker.rb
131
134
  - lib/review/preprocessor.rb
132
- - lib/review/review.tex.erb
133
135
  - lib/review/sec_counter.rb
134
136
  - lib/review/textbuilder.rb
135
137
  - lib/review/textutils.rb
@@ -164,10 +166,10 @@ files:
164
166
  - test/test.re
165
167
  - test/test_book.rb
166
168
  - test/test_book_chapter.rb
167
- - test/test_book_parameter.rb
168
169
  - test/test_book_part.rb
169
170
  - test/test_builder.rb
170
171
  - test/test_catalog.rb
172
+ - test/test_catalog_converter_cmd.rb
171
173
  - test/test_compiler.rb
172
174
  - test/test_epubmaker.rb
173
175
  - test/test_epubmaker_cmd.rb
@@ -183,6 +185,7 @@ files:
183
185
  - test/test_lineinput.rb
184
186
  - test/test_makerhelper.rb
185
187
  - test/test_markdownbuilder.rb
188
+ - test/test_pdfmaker.rb
186
189
  - test/test_pdfmaker_cmd.rb
187
190
  - test/test_preprocessor.rb
188
191
  - test/test_textutils.rb
@@ -236,10 +239,10 @@ test_files:
236
239
  - test/test.re
237
240
  - test/test_book.rb
238
241
  - test/test_book_chapter.rb
239
- - test/test_book_parameter.rb
240
242
  - test/test_book_part.rb
241
243
  - test/test_builder.rb
242
244
  - test/test_catalog.rb
245
+ - test/test_catalog_converter_cmd.rb
243
246
  - test/test_compiler.rb
244
247
  - test/test_epubmaker.rb
245
248
  - test/test_epubmaker_cmd.rb
@@ -255,6 +258,7 @@ test_files:
255
258
  - test/test_lineinput.rb
256
259
  - test/test_makerhelper.rb
257
260
  - test/test_markdownbuilder.rb
261
+ - test/test_pdfmaker.rb
258
262
  - test/test_pdfmaker_cmd.rb
259
263
  - test/test_preprocessor.rb
260
264
  - test/test_textutils.rb
@@ -1,98 +0,0 @@
1
- #
2
- # $Id: book.rb 4315 2009-09-02 04:15:24Z kmuto $
3
- #
4
- # Copyright (c) 2002-2008 Minero Aoki
5
- # 2009 Minero Aoki, Kenshi Muto
6
- #
7
- # This program is free software.
8
- # You can distribute or modify this program under the terms of
9
- # the GNU LGPL, Lesser General Public License version 2.1.
10
- # For details of the GNU LGPL, see the file "COPYING".
11
- #
12
- module ReVIEW
13
- module Book
14
- class Parameters
15
-
16
- def Parameters.default
17
- new()
18
- end
19
-
20
- def Parameters.load(path)
21
- mod = Module.new
22
- mod.module_eval File.read(path), path
23
- new(
24
- :chapter_file => const_get_safe(mod, :CHAPS_FILE),
25
- :part_file => const_get_safe(mod, :PART_FILE),
26
- :bib_file => const_get_safe(mod, :BIB_FILE),
27
- :reject_file => const_get_safe(mod, :REJECT_FILE) ||
28
- const_get_safe(mod, :WORDS_FILE),
29
- :predef_file => const_get_safe(mod, :PREDEF_FILE),
30
- :postdef_file => const_get_safe(mod, :POSTDEF_FILE),
31
- :ext => const_get_safe(mod, :EXT),
32
- :image_dir => const_get_safe(mod, :IMAGE_DIR),
33
- :image_types => const_get_safe(mod, :IMAGE_TYPES),
34
- :page_metric => get_page_metric(mod)
35
- )
36
- end
37
-
38
- def Parameters.get_page_metric(mod)
39
- if paper = const_get_safe(mod, :PAPER)
40
- unless PageMetric.respond_to?(paper.downcase)
41
- raise ConfigError, "unknown paper size: #{paper}"
42
- end
43
- return PageMetric.send(paper.downcase)
44
- end
45
- PageMetric.new(const_get_safe(mod, :LINES_PER_PAGE_list) || 46,
46
- const_get_safe(mod, :COLUMNS_list) || 80,
47
- const_get_safe(mod, :LINES_PER_PAGE_text) || 30,
48
- const_get_safe(mod, :COLUMNS_text) || 74, # 37zw
49
- const_get_safe(mod, :PAGE_PER_KBYTE) || 1) # 37zw
50
- end
51
-
52
- def Parameters.const_get_safe(mod, name)
53
- return nil unless mod.const_defined?(name)
54
- mod.const_get(name)
55
- end
56
- private_class_method :const_get_safe
57
-
58
- def initialize(params = {})
59
- @chapter_file = params[:chapter_file] || 'CHAPS'
60
- @part_file = params[:part_file] || 'PART'
61
- @reject_file = params[:reject_file] || 'REJECT'
62
- @predef_file = params[:predef_file] || 'PREDEF'
63
- @postdef_file = params[:postdef_file] || 'POSTDEF'
64
- @page_metric = params[:page_metric] || PageMetric.a5
65
- @ext = params[:ext] || '.re'
66
- @image_dir = params[:image_dir] || 'images'
67
- @image_types = unify_exts(params[:image_types] ||
68
- %w( ai psd eps pdf tif tiff png bmp jpg jpeg gif svg ))
69
- @bib_file = params[:bib_file] || "bib#{@ext}"
70
- end
71
-
72
- def unify_exts(list)
73
- list.map {|ext| (ext[0] == '.') ? ext : ".#{ext}" }
74
- end
75
- private :unify_exts
76
-
77
- def self.path_param(name)
78
- module_eval(<<-End, __FILE__, __LINE__ + 1)
79
- def #{name}
80
- "\#{@basedir}/\#{@#{name}}"
81
- end
82
- End
83
- end
84
-
85
- path_param :chapter_file
86
- path_param :part_file
87
- path_param :bib_file
88
- path_param :reject_file
89
- path_param :predef_file
90
- path_param :postdef_file
91
- attr_reader :ext
92
- path_param :image_dir
93
- attr_accessor :image_types
94
- attr_reader :page_metric
95
-
96
- end
97
- end
98
- end
@@ -1,42 +0,0 @@
1
- require 'book_test_helper'
2
-
3
- class ParametersTest < Test::Unit::TestCase
4
- include BookTestHelper
5
-
6
- def test_s_default
7
- assert Book::Parameters.default
8
- end
9
-
10
- def test_s_load
11
- Tempfile.open('parameters_test') do |io|
12
- io.puts 'CHAPS_FILE = "x_CHAPS"'
13
- io.puts 'PAPER = "B5"' # XXX: avoid erros of the last line of Parameters.get_page_metric
14
- io.close
15
-
16
- params = Book::Parameters.load(io.path)
17
- assert_equal '/x_CHAPS', params.chapter_file # XXX: OK? (leading / and uninitialized @basedir)
18
- assert_equal '/PART', params.part_file
19
- end
20
- end
21
-
22
- def test_s_get_page_metric
23
- mod = Module.new
24
- assert_nothing_raised do # XXX: OK?
25
- params = Book::Parameters.get_page_metric(mod)
26
- assert params
27
- end
28
-
29
- mod = Module.new
30
- mod.module_eval { const_set(:PAPER, 'A5') }
31
- assert_nothing_raised do
32
- params = Book::Parameters.get_page_metric(mod)
33
- assert params
34
- end
35
-
36
- mod = Module.new
37
- mod.module_eval { const_set(:PAPER, 'X5') }
38
- assert_raises ConfigError do
39
- Book::Parameters.get_page_metric(mod)
40
- end
41
- end
42
- end