review 2.0.0.beta1 → 2.0.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 +66 -1
- data/.rubocop_todo.yml +617 -0
- data/.travis.yml +16 -1
- data/ChangeLog +48 -0
- data/Dockerfile +22 -0
- data/Gemfile +0 -1
- data/README.md +97 -0
- data/Rakefile +10 -11
- data/appveyor.yml +9 -0
- data/bin/review +46 -0
- data/bin/review-check +8 -21
- data/bin/review-compile +26 -43
- data/bin/review-index +9 -22
- data/bin/review-init +21 -25
- data/bin/review-preproc +9 -13
- data/bin/review-validate +1 -1
- data/bin/review-vol +3 -17
- data/bin/review-webmaker +15 -0
- data/doc/NEWS.ja.md +534 -0
- data/doc/NEWS.md +538 -0
- data/doc/catalog.ja.md +10 -18
- data/doc/catalog.md +5 -9
- data/doc/config.yml.sample +319 -0
- data/doc/customize_epub.ja.md +42 -0
- data/doc/format.ja.md +320 -288
- data/doc/format.md +277 -170
- data/doc/format_idg.ja.md +82 -175
- data/doc/pdfmaker.ja.md +61 -0
- data/doc/pdfmaker.md +65 -0
- data/doc/quickstart.ja.md +88 -98
- data/doc/quickstart.md +72 -110
- data/doc/sample.css +41 -0
- data/doc/writing_vertical.ja.md +55 -0
- data/doc/writing_vertical.md +5 -0
- data/lib/epubmaker/content.rb +3 -3
- data/lib/epubmaker/epubcommon.rb +173 -145
- data/lib/epubmaker/epubv2.rb +24 -77
- data/lib/epubmaker/epubv3.rb +72 -73
- data/lib/epubmaker/producer.rb +54 -30
- data/lib/lineinput.rb +48 -0
- data/lib/review/book.rb +0 -1
- data/lib/review/book/base.rb +47 -27
- data/lib/review/book/chapter.rb +48 -19
- data/lib/review/book/compilable.rb +10 -14
- data/lib/review/book/index.rb +10 -19
- data/lib/review/book/page_metric.rb +0 -10
- data/lib/review/book/part.rb +17 -3
- data/lib/review/builder.rb +84 -68
- data/lib/review/catalog.rb +5 -1
- data/lib/review/compiler.rb +327 -4657
- data/lib/review/configure.rb +84 -10
- data/lib/review/converter.rb +28 -0
- data/lib/review/epubbuilder.rb +1 -1
- data/lib/review/epubmaker.rb +142 -158
- data/lib/review/ewbbuilder.rb +5 -5
- data/lib/review/exception.rb +1 -1
- data/lib/review/extentions.rb +1 -1
- data/lib/review/extentions/hash.rb +15 -0
- data/lib/review/extentions/string.rb +2 -1
- data/lib/review/htmlbuilder.rb +364 -348
- data/lib/review/htmltoc.rb +44 -0
- data/lib/review/htmlutils.rb +12 -6
- data/lib/review/i18n.rb +78 -6
- data/lib/review/i18n.yml +7 -4
- data/lib/review/idgxmlbuilder.rb +226 -267
- data/lib/review/latexbuilder.rb +281 -274
- data/lib/review/latexutils.rb +56 -49
- data/lib/review/makerhelper.rb +8 -4
- data/lib/review/markdownbuilder.rb +80 -124
- data/lib/review/pdfmaker.rb +197 -138
- data/lib/review/preprocessor.rb +16 -67
- data/lib/review/template.rb +24 -0
- data/lib/review/textbuilder.rb +1 -1
- data/lib/review/textutils.rb +18 -24
- data/lib/review/tocparser.rb +51 -106
- data/lib/review/tocprinter.rb +61 -117
- data/lib/review/topbuilder.rb +119 -126
- data/lib/review/unfold.rb +2 -2
- data/lib/review/version.rb +1 -1
- data/lib/review/webmaker.rb +302 -0
- data/lib/review/webtocprinter.rb +48 -0
- data/lib/review/yamlloader.rb +47 -0
- data/review.gemspec +3 -3
- data/templates/html/layout-html5.html.erb +17 -0
- data/templates/html/layout-xhtml1.html.erb +20 -0
- data/{lib/review → templates/latex}/layout.tex.erb +107 -115
- 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/web/html/layout-html5.html.erb +56 -0
- data/templates/web/html/layout-xhtml1.html.erb +20 -0
- data/templates/xml/container.xml.erb +6 -0
- data/test/assets/test.xml.erb +3 -0
- data/test/assets/test_template.tex +28 -71
- data/test/assets/test_template_backmatter.tex +1 -9
- data/test/sample-book/src/Rakefile +12 -3
- data/{doc/sample.yml → test/sample-book/src/config-epub2.yml} +92 -147
- data/test/sample-book/src/config.yml +40 -154
- data/test/sample-book/src/style-web.css +45 -0
- data/test/sample-book/src/style.css +23 -1
- data/test/test.re +1 -1
- data/test/test_book.rb +15 -17
- data/test/test_book_chapter.rb +2 -80
- data/test/test_book_part.rb +1 -1
- data/test/test_builder.rb +28 -6
- data/test/test_catalog.rb +17 -0
- data/test/test_compiler.rb +14 -59
- data/test/test_configure.rb +94 -0
- data/test/test_converter.rb +21 -0
- data/test/test_epub3maker.rb +155 -3
- data/test/test_epubmaker.rb +245 -30
- data/test/test_epubmaker_cmd.rb +2 -2
- data/test/test_extentions_hash.rb +60 -0
- data/test/test_helper.rb +4 -47
- data/test/test_htmlbuilder.rb +282 -175
- data/test/test_htmltoc.rb +33 -0
- data/test/test_i18n.rb +134 -70
- data/test/test_idgxmlbuilder.rb +58 -39
- data/test/test_latexbuilder.rb +132 -14
- data/test/test_lineinput.rb +5 -26
- data/test/test_makerhelper.rb +6 -4
- data/test/test_markdownbuilder.rb +23 -5
- data/test/test_pdfmaker.rb +86 -20
- data/test/test_pdfmaker_cmd.rb +1 -3
- data/test/test_review_ext.rb +1 -1
- data/test/test_template.rb +27 -0
- data/test/test_textutils.rb +36 -0
- data/test/test_tocparser.rb +25 -0
- data/test/test_topbuilder.rb +34 -2
- data/test/test_yamlloader.rb +188 -0
- metadata +71 -29
- data/README.rdoc +0 -81
- data/bin/review-epubmaker-legacy +0 -1024
- data/doc/ruby-uuid/README +0 -11
- data/doc/ruby-uuid/README.ja +0 -34
- data/lib/review/compiler/literals_1_8.kpeg +0 -19
- data/lib/review/compiler/literals_1_8.rb +0 -432
- data/lib/review/compiler/literals_1_9.kpeg +0 -22
- data/lib/review/compiler/literals_1_9.rb +0 -435
- data/lib/review/extentions/array.rb +0 -25
- data/lib/review/htmllayout.rb +0 -41
- data/lib/review/inaobuilder.rb +0 -357
- data/lib/review/location.rb +0 -24
- data/lib/review/node.rb +0 -267
- data/lib/review/review.kpeg +0 -724
- data/lib/uuid.rb +0 -312
- data/rubocop-todo.yml +0 -456
- data/test/test_inaobuilder.rb +0 -247
- data/test/test_uuid.rb +0 -157
data/lib/lineinput.rb
CHANGED
@@ -48,6 +48,46 @@ class LineInput
|
|
48
48
|
line
|
49
49
|
end
|
50
50
|
|
51
|
+
def peek
|
52
|
+
line = gets()
|
53
|
+
ungets line if line
|
54
|
+
line
|
55
|
+
end
|
56
|
+
|
57
|
+
def next?
|
58
|
+
peek() ? true : false
|
59
|
+
end
|
60
|
+
|
61
|
+
def skip_blank_lines
|
62
|
+
n = 0
|
63
|
+
while line = gets()
|
64
|
+
unless line.strip.empty?
|
65
|
+
ungets line
|
66
|
+
return n
|
67
|
+
end
|
68
|
+
n += 1
|
69
|
+
end
|
70
|
+
n
|
71
|
+
end
|
72
|
+
|
73
|
+
def gets_if(re)
|
74
|
+
line = gets()
|
75
|
+
if not line or not (re =~ line)
|
76
|
+
ungets line
|
77
|
+
return nil
|
78
|
+
end
|
79
|
+
line
|
80
|
+
end
|
81
|
+
|
82
|
+
def gets_unless(re)
|
83
|
+
line = gets()
|
84
|
+
if not line or re =~ line
|
85
|
+
ungets line
|
86
|
+
return nil
|
87
|
+
end
|
88
|
+
line
|
89
|
+
end
|
90
|
+
|
51
91
|
def each
|
52
92
|
while line = gets()
|
53
93
|
yield line
|
@@ -104,4 +144,12 @@ class LineInput
|
|
104
144
|
nil
|
105
145
|
end
|
106
146
|
|
147
|
+
def getblock(term_re)
|
148
|
+
buf = []
|
149
|
+
until_terminator(term_re) do |line|
|
150
|
+
buf.push line
|
151
|
+
end
|
152
|
+
buf
|
153
|
+
end
|
154
|
+
|
107
155
|
end
|
data/lib/review/book.rb
CHANGED
data/lib/review/book/base.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
#
|
2
|
-
# $Id: book.rb 4315 2009-09-02 04:15:24Z kmuto $
|
3
|
-
#
|
4
2
|
# Copyright (c) 2002-2008 Minero Aoki
|
5
|
-
# 2009 Minero Aoki, Kenshi Muto
|
3
|
+
# 2009-2016 Minero Aoki, Kenshi Muto
|
6
4
|
#
|
7
5
|
# This program is free software.
|
8
6
|
# You can distribute or modify this program under the terms of
|
@@ -48,6 +46,7 @@ module ReVIEW
|
|
48
46
|
@chapter_index = nil
|
49
47
|
@config = ReVIEW::Configure.values
|
50
48
|
@catalog = nil
|
49
|
+
@read_part = nil
|
51
50
|
end
|
52
51
|
|
53
52
|
def bib_file
|
@@ -84,10 +83,22 @@ module ReVIEW
|
|
84
83
|
end
|
85
84
|
end
|
86
85
|
|
86
|
+
def htmlversion
|
87
|
+
if config["htmlversion"].blank?
|
88
|
+
nil
|
89
|
+
else
|
90
|
+
config["htmlversion"].to_i
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
87
94
|
def parts
|
88
95
|
@parts ||= read_parts()
|
89
96
|
end
|
90
97
|
|
98
|
+
def parts=(parts)
|
99
|
+
@parts = parts
|
100
|
+
end
|
101
|
+
|
91
102
|
def parts_in_file
|
92
103
|
parts.find_all{|part|
|
93
104
|
part if part.present? and part.file?
|
@@ -102,6 +113,15 @@ module ReVIEW
|
|
102
113
|
parts.each(&block)
|
103
114
|
end
|
104
115
|
|
116
|
+
def contents
|
117
|
+
# TODO: includes predef, appendix, postdef
|
118
|
+
if parts.present?
|
119
|
+
chapters + parts
|
120
|
+
else
|
121
|
+
chapters
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
105
125
|
def chapters
|
106
126
|
parts().map {|p| p.chapters }.flatten
|
107
127
|
end
|
@@ -111,7 +131,7 @@ module ReVIEW
|
|
111
131
|
end
|
112
132
|
|
113
133
|
def each_chapter_r(&block)
|
114
|
-
chapters.
|
134
|
+
chapters.reverse_each(&block)
|
115
135
|
end
|
116
136
|
|
117
137
|
def chapter_index
|
@@ -158,32 +178,26 @@ module ReVIEW
|
|
158
178
|
@config ||= Configure.values
|
159
179
|
end
|
160
180
|
|
161
|
-
# backward compatible
|
162
|
-
def param=(param)
|
163
|
-
@config = param
|
164
|
-
end
|
165
|
-
|
166
181
|
def load_config(filename)
|
167
182
|
new_conf = YAML.load_file(filename)
|
168
183
|
@config.merge!(new_conf)
|
169
184
|
end
|
170
185
|
|
171
|
-
# backward compatible
|
172
|
-
def param
|
173
|
-
@config
|
174
|
-
end
|
175
|
-
|
176
186
|
def catalog
|
177
187
|
return @catalog if @catalog.present?
|
178
188
|
|
179
189
|
catalogfile_path = "#{basedir}/#{config["catalogfile"]}"
|
180
190
|
if File.file? catalogfile_path
|
181
|
-
@catalog = Catalog.new(
|
191
|
+
@catalog = File.open(catalogfile_path){|f| Catalog.new(f) }
|
182
192
|
end
|
183
193
|
|
184
194
|
@catalog
|
185
195
|
end
|
186
196
|
|
197
|
+
def catalog=(catalog)
|
198
|
+
@catalog = catalog
|
199
|
+
end
|
200
|
+
|
187
201
|
def read_CHAPS
|
188
202
|
if catalog
|
189
203
|
catalog.chaps
|
@@ -217,12 +231,12 @@ module ReVIEW
|
|
217
231
|
end
|
218
232
|
|
219
233
|
def read_PART
|
220
|
-
return @
|
234
|
+
return @read_part if @read_part
|
221
235
|
|
222
236
|
if catalog
|
223
|
-
@
|
237
|
+
@read_part = catalog.parts
|
224
238
|
else
|
225
|
-
@
|
239
|
+
@read_part = File.read("#{@basedir}/#{config["part_file"]}")
|
226
240
|
end
|
227
241
|
end
|
228
242
|
|
@@ -300,6 +314,8 @@ module ReVIEW
|
|
300
314
|
list
|
301
315
|
end
|
302
316
|
|
317
|
+
# return Array of Part, not Chapter
|
318
|
+
#
|
303
319
|
def parse_chapters
|
304
320
|
part = 0
|
305
321
|
num = 0
|
@@ -308,26 +324,32 @@ module ReVIEW
|
|
308
324
|
return catalog.parts_with_chaps.map do |entry|
|
309
325
|
if entry.is_a? Hash
|
310
326
|
chaps = entry.values.first.map do |chap|
|
311
|
-
Chapter.new(self, (num += 1), chap, "#{@basedir}/#{chap}")
|
327
|
+
chap = Chapter.new(self, (num += 1), chap, "#{@basedir}/#{chap}")
|
328
|
+
chap
|
312
329
|
end
|
313
330
|
Part.new(self, (part += 1), chaps, read_PART.split("\n")[part - 1])
|
314
331
|
else
|
315
332
|
chap = Chapter.new(self, (num += 1), entry, "#{@basedir}/#{entry}")
|
333
|
+
if chap.number
|
334
|
+
num = chap.number
|
335
|
+
else
|
336
|
+
num -= 1
|
337
|
+
end
|
316
338
|
Part.new(self, nil, [chap])
|
317
339
|
end
|
318
340
|
end
|
319
341
|
end
|
320
342
|
|
321
343
|
chap = read_CHAPS()\
|
322
|
-
|
323
|
-
|
344
|
+
.strip.lines.map {|line| line.strip }.join("\n").split(/\n{2,}/)\
|
345
|
+
.map {|part_chunk|
|
324
346
|
chaps = part_chunk.split.map {|chapid|
|
325
347
|
Chapter.new(self, (num += 1), chapid, "#{@basedir}/#{chapid}")
|
326
348
|
}
|
327
|
-
if part_exist? && read_PART.split("\n").size
|
349
|
+
if part_exist? && read_PART.split("\n").size > part
|
328
350
|
Part.new(self, (part += 1), chaps, read_PART.split("\n")[part-1])
|
329
351
|
else
|
330
|
-
Part.new(self,
|
352
|
+
Part.new(self, nil, chaps)
|
331
353
|
end
|
332
354
|
}
|
333
355
|
return chap
|
@@ -335,8 +357,7 @@ module ReVIEW
|
|
335
357
|
|
336
358
|
def mkpart_from_namelistfile(path)
|
337
359
|
chaps = []
|
338
|
-
File.read(path).split.each_with_index do |name, idx|
|
339
|
-
name.sub!(/\A\xEF\xBB\xBF/u, '') # remove BOM
|
360
|
+
File.read(path, :mode => 'r:BOM|utf-8').split.each_with_index do |name, idx|
|
340
361
|
if path =~ /PREDEF/
|
341
362
|
chaps << mkchap(name)
|
342
363
|
else
|
@@ -372,9 +393,8 @@ module ReVIEW
|
|
372
393
|
|
373
394
|
def read_FILE(filename)
|
374
395
|
res = ""
|
375
|
-
File.open("#{@basedir}/#{filename}") do |f|
|
396
|
+
File.open("#{@basedir}/#{filename}", 'r:BOM|utf-8') do |f|
|
376
397
|
while line = f.gets
|
377
|
-
line.sub!(/\A\xEF\xBB\xBF/u, '') # remove BOM
|
378
398
|
if /\A#/ =~ line
|
379
399
|
next
|
380
400
|
end
|
data/lib/review/book/chapter.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
#
|
2
|
-
# $Id: book.rb 4315 2009-09-02 04:15:24Z kmuto $
|
3
|
-
#
|
4
2
|
# Copyright (c) 2002-2008 Minero Aoki
|
5
|
-
# 2009 Minero Aoki, Kenshi Muto
|
3
|
+
# 2009-2016 Minero Aoki, Kenshi Muto
|
6
4
|
#
|
7
5
|
# This program is free software.
|
8
6
|
# You can distribute or modify this program under the terms of
|
@@ -10,11 +8,11 @@
|
|
10
8
|
# For details of the GNU LGPL, see the file "COPYING".
|
11
9
|
#
|
12
10
|
require 'review/book/compilable'
|
11
|
+
require 'review/lineinput'
|
12
|
+
require 'review/preprocessor'
|
13
|
+
|
13
14
|
module ReVIEW
|
14
15
|
module Book
|
15
|
-
ROMAN = %w[0 I II III IV V VI VII VIII IX X XI XII XIII XIV XV XVI XVII XVIII XIX XX XXI XXII XXIII XXIV XXV XXVI XXVII]
|
16
|
-
ALPHA = %w[0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
|
17
|
-
|
18
16
|
class Chapter
|
19
17
|
include Compilable
|
20
18
|
|
@@ -27,7 +25,19 @@ module ReVIEW
|
|
27
25
|
@path = path
|
28
26
|
@io = io
|
29
27
|
@title = nil
|
30
|
-
@
|
28
|
+
if @io
|
29
|
+
begin
|
30
|
+
@content = @io.read
|
31
|
+
rescue
|
32
|
+
@content = nil
|
33
|
+
end
|
34
|
+
else
|
35
|
+
@content = nil
|
36
|
+
end
|
37
|
+
if !@content && @path && File.exist?(@path)
|
38
|
+
@content = File.read(@path, :mode => 'r:BOM|utf-8')
|
39
|
+
@number = nil if ['nonum', 'nodisp', 'notoc'].include?(find_first_header_option)
|
40
|
+
end
|
31
41
|
@list_index = nil
|
32
42
|
@table_index = nil
|
33
43
|
@footnote_index = nil
|
@@ -37,6 +47,25 @@ module ReVIEW
|
|
37
47
|
@indepimage_index = nil
|
38
48
|
@headline_index = nil
|
39
49
|
@column_index = nil
|
50
|
+
@volume = nil
|
51
|
+
end
|
52
|
+
|
53
|
+
def find_first_header_option
|
54
|
+
f = LineInput.new(Preprocessor::Strip.new(StringIO.new(@content)))
|
55
|
+
while f.next?
|
56
|
+
case f.peek
|
57
|
+
when /\A=+[\[\s\{]/
|
58
|
+
m = /\A(=+)(?:\[(.+?)\])?(?:\{(.+?)\})?(.*)/.match(f.gets)
|
59
|
+
return m[2] # tag
|
60
|
+
when %r</\A//[a-z]+/>
|
61
|
+
line = f.gets
|
62
|
+
if line.rstrip[-1,1] == "{"
|
63
|
+
f.until_match(%r<\A//\}>)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
f.gets
|
67
|
+
end
|
68
|
+
nil
|
40
69
|
end
|
41
70
|
|
42
71
|
def inspect
|
@@ -44,27 +73,27 @@ module ReVIEW
|
|
44
73
|
end
|
45
74
|
|
46
75
|
def format_number(heading = true)
|
76
|
+
return "" unless @number
|
77
|
+
|
47
78
|
if on_PREDEF?
|
48
79
|
return "#{@number}"
|
49
80
|
end
|
50
81
|
|
51
82
|
if on_APPENDIX?
|
52
83
|
return "#{@number}" if @number < 1 || @number > 27
|
84
|
+
if @book.config["appendix_format"]
|
85
|
+
raise ReVIEW::ConfigError,
|
86
|
+
"'appendix_format:' in config.yml is obsoleted."
|
87
|
+
end
|
88
|
+
|
89
|
+
i18n_appendix = I18n.get("appendix")
|
90
|
+
fmt = i18n_appendix.scan(/%\w{1,3}/).first || "%s"
|
91
|
+
I18n.update({"appendix_without_heading" => fmt})
|
53
92
|
|
54
|
-
type = @book.config["appendix_format"].blank? ? "arabic" : @book.config["appendix_format"].downcase.strip
|
55
|
-
appendix = case type
|
56
|
-
when "roman"
|
57
|
-
ROMAN[@number]
|
58
|
-
when "alphabet", "alpha"
|
59
|
-
ALPHA[@number]
|
60
|
-
else
|
61
|
-
# nil, "arabic", etc...
|
62
|
-
"#{@number}"
|
63
|
-
end
|
64
93
|
if heading
|
65
|
-
return
|
94
|
+
return I18n.t("appendix", @number)
|
66
95
|
else
|
67
|
-
return "
|
96
|
+
return I18n.t("appendix_without_heading", @number)
|
68
97
|
end
|
69
98
|
end
|
70
99
|
|
@@ -42,20 +42,18 @@ module ReVIEW
|
|
42
42
|
return @title if @title
|
43
43
|
|
44
44
|
@title = ''
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
}
|
53
|
-
}
|
45
|
+
return @title if !content
|
46
|
+
content.each_line do |line|
|
47
|
+
if line =~ /\A=+/
|
48
|
+
@title = line.sub(/\A=+(\[.+?\])?(\{.+?\})?/, '').strip
|
49
|
+
break
|
50
|
+
end
|
51
|
+
end
|
54
52
|
@title
|
55
53
|
end
|
56
54
|
|
57
55
|
def size
|
58
|
-
|
56
|
+
content.size
|
59
57
|
end
|
60
58
|
|
61
59
|
def volume
|
@@ -66,17 +64,15 @@ module ReVIEW
|
|
66
64
|
@volume
|
67
65
|
end
|
68
66
|
|
67
|
+
# deprecated; use content()
|
69
68
|
def open(&block)
|
70
69
|
return (block_given?() ? yield(@io) : @io) if @io
|
71
|
-
|
70
|
+
StringIO.new(content)
|
72
71
|
end
|
73
72
|
|
74
73
|
attr_writer :content
|
75
74
|
|
76
75
|
def content
|
77
|
-
@content = convert_inencoding(File.read(path()),
|
78
|
-
book.config["inencoding"])
|
79
|
-
rescue
|
80
76
|
@content
|
81
77
|
end
|
82
78
|
|
data/lib/review/book/index.rb
CHANGED
@@ -58,8 +58,8 @@ module ReVIEW
|
|
58
58
|
@index.fetch(id)
|
59
59
|
rescue
|
60
60
|
if @index.keys.map{|i| i.split(/\|/).last }.flatten. # unfold all ids
|
61
|
-
|
62
|
-
|
61
|
+
reduce(Hash.new(0)){|h, i| h[i] += 1; h}. # number of occurrences
|
62
|
+
select{|k, v| k == id && v > 1 }.present? # detect duplicated
|
63
63
|
raise KeyError, "key '#{id}' is ambiguous for #{self.class}"
|
64
64
|
end
|
65
65
|
|
@@ -118,7 +118,7 @@ module ReVIEW
|
|
118
118
|
|
119
119
|
class TableIndex < Index
|
120
120
|
def TableIndex.item_type
|
121
|
-
'table'
|
121
|
+
'(table|imgtable)'
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -172,7 +172,7 @@ module ReVIEW
|
|
172
172
|
attr_reader :id
|
173
173
|
attr_reader :number
|
174
174
|
attr_reader :caption
|
175
|
-
attr_writer :index
|
175
|
+
attr_writer :index # internal use only
|
176
176
|
|
177
177
|
def bound?
|
178
178
|
path
|
@@ -184,7 +184,7 @@ module ReVIEW
|
|
184
184
|
end
|
185
185
|
|
186
186
|
def ImageIndex.item_type
|
187
|
-
'(image|graph)'
|
187
|
+
'(image|graph|imgtable)'
|
188
188
|
end
|
189
189
|
|
190
190
|
attr_reader :image_finder
|
@@ -245,12 +245,12 @@ module ReVIEW
|
|
245
245
|
end
|
246
246
|
|
247
247
|
def title(id)
|
248
|
-
sprintf(@locale["#{@index.item_type}_caption_format".
|
248
|
+
sprintf(@locale["#{@index.item_type}_caption_format".to_sym],
|
249
249
|
@index.title(id))
|
250
250
|
end
|
251
251
|
|
252
252
|
def number(id)
|
253
|
-
sprintf(@locale["#{@index.item_type}_number_format".
|
253
|
+
sprintf(@locale["#{@index.item_type}_number_format".to_sym],
|
254
254
|
@index.number(id))
|
255
255
|
end
|
256
256
|
|
@@ -296,7 +296,7 @@ module ReVIEW
|
|
296
296
|
end
|
297
297
|
|
298
298
|
def IndepImageIndex.item_type
|
299
|
-
'indepimage'
|
299
|
+
'(indepimage|imgtable)'
|
300
300
|
end
|
301
301
|
|
302
302
|
def number(id)
|
@@ -365,16 +365,7 @@ module ReVIEW
|
|
365
365
|
def number(id)
|
366
366
|
n = @chap.number
|
367
367
|
if @chap.on_APPENDIX? && @chap.number > 0 && @chap.number < 28
|
368
|
-
|
369
|
-
n = case type
|
370
|
-
when "roman"
|
371
|
-
ROMAN[@chap.number]
|
372
|
-
when "alphabet", "alpha"
|
373
|
-
ALPHA[@chap.number]
|
374
|
-
else
|
375
|
-
# nil, "arabic", etc...
|
376
|
-
"#{@chap.number}"
|
377
|
-
end
|
368
|
+
n = @chap.format_number(false)
|
378
369
|
end
|
379
370
|
return ([n] + self[id].number).join(".")
|
380
371
|
end
|
@@ -389,7 +380,7 @@ module ReVIEW
|
|
389
380
|
seq = 1
|
390
381
|
src.each do |line|
|
391
382
|
if m = COLUMN_PATTERN.match(line)
|
392
|
-
|
383
|
+
_level = m[1] ## not use it yet
|
393
384
|
id = m[2]
|
394
385
|
caption = m[3].strip
|
395
386
|
if !id || id == ""
|