review 1.2.0 → 1.3.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/.gitignore +36 -0
- data/.rubocop.yml +1 -0
- data/ChangeLog +102 -0
- data/README.rdoc +2 -2
- data/bin/review-check +18 -16
- data/bin/review-compile +49 -42
- data/bin/review-epubmaker +23 -993
- data/bin/review-epubmaker-legacy +1024 -0
- data/bin/review-index +17 -15
- data/bin/review-init +39 -9
- data/bin/review-pdfmaker +124 -89
- data/bin/review-preproc +16 -14
- data/bin/review-vol +17 -15
- data/debian/docs +1 -1
- data/doc/catalog.rdoc +34 -0
- data/doc/format.rdoc +16 -2
- data/doc/libepubmaker/{config.yaml → config.yml} +63 -19
- data/doc/quickstart.rdoc +1 -1
- data/doc/{sample.yaml → sample.yml} +0 -0
- data/lib/epubmaker.rb +1 -1
- data/lib/epubmaker/content.rb +9 -1
- data/lib/epubmaker/epubv2.rb +59 -7
- data/lib/epubmaker/epubv3.rb +14 -9
- data/lib/epubmaker/producer.rb +68 -27
- data/lib/epubmaker/resource.rb +3 -1
- data/lib/lineinput.rb +2 -2
- data/lib/review/book/base.rb +125 -24
- data/lib/review/book/chapter.rb +42 -0
- data/lib/review/book/compilable.rb +23 -4
- data/lib/review/book/image_finder.rb +64 -0
- data/lib/review/book/index.rb +64 -50
- data/lib/review/book/page_metric.rb +1 -1
- data/lib/review/builder.rb +19 -12
- data/lib/review/catalog.rb +47 -0
- data/lib/review/compiler.rb +3 -2
- data/lib/review/configure.rb +5 -3
- data/lib/review/epubmaker.rb +130 -46
- data/lib/review/ewbbuilder.rb +27 -31
- data/lib/review/extentions/string.rb +4 -4
- data/lib/review/htmlbuilder.rb +140 -79
- data/lib/review/htmllayout.rb +26 -4
- data/lib/review/htmlutils.rb +20 -1
- data/lib/review/i18n.rb +5 -2
- data/lib/review/{i18n.yaml → i18n.yml} +4 -2
- data/lib/review/idgxmlbuilder.rb +65 -39
- data/lib/review/latexbuilder.rb +72 -24
- data/lib/review/latexutils.rb +3 -1
- data/lib/review/makerhelper.rb +8 -2
- data/lib/review/preprocessor.rb +20 -20
- data/lib/review/review.tex.erb +4 -0
- data/lib/review/sec_counter.rb +9 -11
- data/lib/review/tocparser.rb +2 -2
- data/lib/review/tocprinter.rb +12 -12
- data/lib/review/topbuilder.rb +15 -15
- data/lib/review/version.rb +1 -1
- data/lib/uuid.rb +7 -7
- data/review.gemspec +2 -2
- data/rubocop-todo.yml +443 -0
- data/test/sample-book/src/config.yml +2 -2
- data/test/sample-book/src/{main.css → style.css} +0 -0
- data/test/test_book.rb +46 -48
- data/test/test_book_chapter.rb +25 -13
- data/test/test_builder.rb +3 -3
- data/test/test_catalog.rb +107 -0
- data/test/test_epubmaker.rb +6 -6
- data/test/test_htmlbuilder.rb +160 -39
- data/test/test_htmlutils.rb +22 -0
- data/test/test_i18n.rb +2 -2
- data/test/test_idgxmlbuilder.rb +33 -47
- data/test/test_image_finder.rb +82 -0
- data/test/test_inaobuilder.rb +1 -1
- data/test/test_latexbuilder.rb +35 -39
- data/test/test_lineinput.rb +2 -2
- data/test/test_markdownbuilder.rb +2 -2
- data/test/test_topbuilder.rb +39 -23
- metadata +23 -14
- data/bin/review-epubmaker-ng +0 -23
data/lib/review/htmllayout.rb
CHANGED
@@ -2,12 +2,34 @@
|
|
2
2
|
require 'erb'
|
3
3
|
|
4
4
|
class HTMLLayout
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
include ERB::Util
|
6
|
+
|
7
|
+
def initialize(params, template)
|
8
|
+
@body = params['body']
|
9
|
+
@title = params['title']
|
10
|
+
@toc = params['toc']
|
11
|
+
@next = params['next']
|
12
|
+
@prev = params['prev']
|
13
|
+
@builder = params['builder']
|
8
14
|
@template = template
|
9
15
|
end
|
10
|
-
attr_reader :body, :title
|
16
|
+
attr_reader :body, :title, :toc
|
17
|
+
|
18
|
+
def next_chapter
|
19
|
+
if @next.present?
|
20
|
+
"<a href='#{h @next.id}.html'>#{h @builder.compile_inline @next.title}</a>"
|
21
|
+
else
|
22
|
+
""
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def prev_chapter
|
27
|
+
if @prev.present?
|
28
|
+
"<a href='#{h @prev.id}.html'>#{h @builder.compile_inline @prev.title}</a>"
|
29
|
+
else
|
30
|
+
""
|
31
|
+
end
|
32
|
+
end
|
11
33
|
|
12
34
|
def result
|
13
35
|
if File.exist?(@template)
|
data/lib/review/htmlutils.rb
CHANGED
@@ -23,21 +23,29 @@ module ReVIEW
|
|
23
23
|
str.gsub(/[&"<>]/) {|c| t[c] }
|
24
24
|
end
|
25
25
|
|
26
|
+
alias_method :escape, :escape_html
|
27
|
+
|
26
28
|
def unescape_html(str)
|
27
29
|
# FIXME better code
|
28
30
|
str.gsub('"', '"').gsub('>', '>').gsub('<', '<').gsub('&', '&')
|
29
31
|
end
|
30
32
|
|
33
|
+
alias_method :unescape, :unescape_html
|
34
|
+
|
31
35
|
def strip_html(str)
|
32
36
|
str.gsub(/<\/?[^>]*>/, "")
|
33
37
|
end
|
34
38
|
|
39
|
+
def escape_comment(str)
|
40
|
+
str.gsub('-', '-')
|
41
|
+
end
|
42
|
+
|
35
43
|
def highlight(ops)
|
36
44
|
body = ops[:body] || ''
|
37
45
|
lexer = ops[:lexer] || ''
|
38
46
|
format = ops[:format] || ''
|
39
47
|
|
40
|
-
return body if
|
48
|
+
return body if @book.config["pygments"].nil?
|
41
49
|
|
42
50
|
begin
|
43
51
|
require 'pygments'
|
@@ -57,5 +65,16 @@ module ReVIEW
|
|
57
65
|
body
|
58
66
|
end
|
59
67
|
end
|
68
|
+
|
69
|
+
def normalize_id(id)
|
70
|
+
if id =~ /\A[a-z][a-z0-9_.-]*\Z/i
|
71
|
+
return id
|
72
|
+
elsif id =~ /\A[0-9_.-][a-z0-9_.-]*\Z/i
|
73
|
+
return "id_#{id}" # dummy prefix
|
74
|
+
else
|
75
|
+
return "id_#{CGI.escape(id.gsub("_", "__")).gsub("%", "_").gsub("+", "-")}" # escape all
|
76
|
+
end
|
77
|
+
end
|
60
78
|
end
|
79
|
+
|
61
80
|
end # module ReVIEW
|
data/lib/review/i18n.rb
CHANGED
@@ -4,7 +4,10 @@ require 'yaml'
|
|
4
4
|
module ReVIEW
|
5
5
|
class I18n
|
6
6
|
def self.setup
|
7
|
-
|
7
|
+
lfile = File.expand_path "locale.yml", ENV["PWD"]
|
8
|
+
# backward compatibility
|
9
|
+
lfile = File.expand_path "locale.yaml", ENV["PWD"] unless File.exist?(lfile)
|
10
|
+
user_i18n = YAML.load_file(lfile)
|
8
11
|
I18n.i18n user_i18n["locale"], user_i18n
|
9
12
|
rescue
|
10
13
|
I18n.i18n "ja"
|
@@ -12,7 +15,7 @@ module ReVIEW
|
|
12
15
|
|
13
16
|
def self.i18n(locale, user_i18n = {})
|
14
17
|
locale ||= "ja"
|
15
|
-
i18n_yaml_path = File.expand_path "i18n.
|
18
|
+
i18n_yaml_path = File.expand_path "i18n.yml", File.dirname(__FILE__)
|
16
19
|
@i18n = YAML.load_file(i18n_yaml_path)[locale]
|
17
20
|
if @i18n
|
18
21
|
@i18n.merge!(user_i18n)
|
@@ -2,10 +2,11 @@ ja:
|
|
2
2
|
image: 図
|
3
3
|
table: 表
|
4
4
|
list: リスト
|
5
|
+
column: "コラム「%s」"
|
5
6
|
part: 第%d部
|
6
7
|
chapter: 第%d章
|
7
8
|
chapter_postfix: " "
|
8
|
-
appendix: 付録%
|
9
|
+
appendix: 付録%s
|
9
10
|
numberless_image: "図:"
|
10
11
|
format_number: "%s.%d"
|
11
12
|
format_number_header: "%s.%d:"
|
@@ -25,6 +26,7 @@ en:
|
|
25
26
|
image: "Figure "
|
26
27
|
table: "Table "
|
27
28
|
list: "List "
|
29
|
+
column: "Column %s"
|
28
30
|
chapter: Chapter %d
|
29
31
|
chapter_postfix: ". "
|
30
32
|
appendix: Appendix %s
|
@@ -46,7 +48,7 @@ zh_TW:
|
|
46
48
|
part: 第%d部份
|
47
49
|
chapter: 第%d章
|
48
50
|
chapter_postfix: " "
|
49
|
-
appendix: 附錄%
|
51
|
+
appendix: 附錄%s
|
50
52
|
numberless_image: "圖:"
|
51
53
|
format_number: "%s.%d"
|
52
54
|
format_number_header: "%s.%d:"
|
data/lib/review/idgxmlbuilder.rb
CHANGED
@@ -66,6 +66,7 @@ module ReVIEW
|
|
66
66
|
@subsection = 0
|
67
67
|
@subsubsection = 0
|
68
68
|
@subsubsubsection = 0
|
69
|
+
@column = 0
|
69
70
|
@noindent = nil
|
70
71
|
@rootelement = "doc"
|
71
72
|
@secttags = nil
|
@@ -75,8 +76,14 @@ module ReVIEW
|
|
75
76
|
|
76
77
|
print %Q(<?xml version="1.0" encoding="UTF-8"?>\n)
|
77
78
|
print %Q(<#{@rootelement} xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/">)
|
78
|
-
|
79
|
-
|
79
|
+
if @book.config["nolf"].present?
|
80
|
+
IDGXMLBuilder.class_eval do
|
81
|
+
def puts(arg)
|
82
|
+
print arg
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
@secttags = true unless @book.config["structuredxml"].nil?
|
80
87
|
end
|
81
88
|
private :builder_init_file
|
82
89
|
|
@@ -173,7 +180,7 @@ module ReVIEW
|
|
173
180
|
end
|
174
181
|
@section += 1
|
175
182
|
print %Q(<sect id="sect:#{@chapter.number}.#{@section}">) unless @secttags.nil?
|
176
|
-
if
|
183
|
+
if @book.config["secnolevel"] >= 2
|
177
184
|
if @chapter.number.blank? or @chapter.on_POSTDEF?
|
178
185
|
prefix = ""
|
179
186
|
else
|
@@ -193,7 +200,7 @@ module ReVIEW
|
|
193
200
|
|
194
201
|
@subsection += 1
|
195
202
|
print %Q(<sect2 id="sect:#{@chapter.number}.#{@section}.#{@subsection}">) unless @secttags.nil?
|
196
|
-
if
|
203
|
+
if @book.config["secnolevel"] >= 3
|
197
204
|
if @chapter.number.blank? or @chapter.on_POSTDEF?
|
198
205
|
prefix = ""
|
199
206
|
else
|
@@ -210,8 +217,8 @@ module ReVIEW
|
|
210
217
|
end
|
211
218
|
|
212
219
|
@subsubsection += 1
|
213
|
-
print %Q(<sect3 id="sect:#{@chapter.number}.#{@section}.#{@subsection}.#{@subsubsection}">) unless @secttags.nil?
|
214
|
-
if
|
220
|
+
print %Q(<sect3 id="sect:#{@chapter.number}.#{@section}.#{@subsection}.#{@subsubsection}">) unless @secttags.nil?
|
221
|
+
if @book.config["secnolevel"] >= 4
|
215
222
|
if @chapter.number.blank? or @chapter.on_POSTDEF?
|
216
223
|
prefix = ""
|
217
224
|
else
|
@@ -227,7 +234,7 @@ module ReVIEW
|
|
227
234
|
|
228
235
|
@subsubsubsection += 1
|
229
236
|
print %Q(<sect4 id="sect:#{@chapter.number}.#{@section}.#{@subsection}.#{@subsubsection}.#{@subsubsubsection}">) unless @secttags.nil?
|
230
|
-
if
|
237
|
+
if @book.config["secnolevel"] >= 5
|
231
238
|
if @chapter.number.blank? or @chapter.on_POSTDEF?
|
232
239
|
prefix = ""
|
233
240
|
else
|
@@ -239,7 +246,7 @@ module ReVIEW
|
|
239
246
|
raise "caption level too deep or unsupported: #{level}"
|
240
247
|
end
|
241
248
|
|
242
|
-
prefix = "" if (level.to_i >
|
249
|
+
prefix = "" if (level.to_i > @book.config["secnolevel"])
|
243
250
|
label = label.nil? ? "" : " id=\"#{label}\""
|
244
251
|
toccaption = escape_html(compile_inline(caption.gsub(/@<fn>\{.+?\}/, '')).gsub(/<[^>]+>/, ''))
|
245
252
|
puts %Q(<title#{label} aid:pstyle="h#{level}">#{prefix}#{compile_inline(caption)}</title><?dtp level="#{level}" section="#{prefix}#{toccaption}"?>)
|
@@ -336,14 +343,31 @@ module ReVIEW
|
|
336
343
|
end
|
337
344
|
|
338
345
|
def read(lines)
|
339
|
-
if
|
346
|
+
if @book.config["deprecated-blocklines"].nil?
|
340
347
|
puts %Q[<lead>#{split_paragraph(lines).join}</lead>]
|
341
348
|
else
|
342
349
|
puts %Q[<p aid:pstyle="lead">#{lines.join}</p>]
|
343
350
|
end
|
344
351
|
end
|
345
352
|
|
346
|
-
|
353
|
+
alias_method :lead, :read
|
354
|
+
|
355
|
+
def column_label(id)
|
356
|
+
num = @chapter.column(id).number
|
357
|
+
"column-#{num}"
|
358
|
+
end
|
359
|
+
private :column_label
|
360
|
+
|
361
|
+
def inline_column(id)
|
362
|
+
if @book.config["chapterlink"]
|
363
|
+
%Q(<link href="#{column_label(id)}">#{escape_html(@chapter.column(id).caption)}</link>)
|
364
|
+
else
|
365
|
+
escape_html(@chapter.column(id).caption)
|
366
|
+
end
|
367
|
+
rescue KeyError
|
368
|
+
error "unknown column: #{id}"
|
369
|
+
nofunc_text("[UnknownColumn:#{id}]")
|
370
|
+
end
|
347
371
|
|
348
372
|
def inline_list(id)
|
349
373
|
chapter, id = extract_chapter_id(id)
|
@@ -366,7 +390,7 @@ module ReVIEW
|
|
366
390
|
def codelines_body(lines)
|
367
391
|
no = 1
|
368
392
|
lines.each do |line|
|
369
|
-
unless
|
393
|
+
unless @book.config["listinfo"].nil?
|
370
394
|
print "<listinfo line=\"#{no}\""
|
371
395
|
print " begin=\"1\"" if no == 1
|
372
396
|
print " end=\"#{no}\"" if no == lines.size
|
@@ -374,7 +398,7 @@ module ReVIEW
|
|
374
398
|
end
|
375
399
|
print detab(line)
|
376
400
|
print "\n"
|
377
|
-
print "</listinfo>" unless
|
401
|
+
print "</listinfo>" unless @book.config["listinfo"].nil?
|
378
402
|
no += 1
|
379
403
|
end
|
380
404
|
end
|
@@ -401,7 +425,7 @@ module ReVIEW
|
|
401
425
|
print %Q(<pre>)
|
402
426
|
no = 1
|
403
427
|
lines.each_with_index do |line, i|
|
404
|
-
unless
|
428
|
+
unless @book.config["listinfo"].nil?
|
405
429
|
print "<listinfo line=\"#{no}\""
|
406
430
|
print " begin=\"1\"" if no == 1
|
407
431
|
print " end=\"#{no}\"" if no == lines.size
|
@@ -409,7 +433,7 @@ module ReVIEW
|
|
409
433
|
end
|
410
434
|
print detab("<span type='lineno'>" + (i + 1).to_s.rjust(2) + ": </span>" + line)
|
411
435
|
print "\n"
|
412
|
-
print "</listinfo>" unless
|
436
|
+
print "</listinfo>" unless @book.config["listinfo"].nil?
|
413
437
|
no += 1
|
414
438
|
end
|
415
439
|
puts "</pre></codelist>"
|
@@ -425,7 +449,7 @@ module ReVIEW
|
|
425
449
|
print %Q[<pre>]
|
426
450
|
no = 1
|
427
451
|
lines.each do |line|
|
428
|
-
unless
|
452
|
+
unless @book.config["listinfo"].nil?
|
429
453
|
print "<listinfo line=\"#{no}\""
|
430
454
|
print " begin=\"1\"" if no == 1
|
431
455
|
print " end=\"#{no}\"" if no == lines.size
|
@@ -433,7 +457,7 @@ module ReVIEW
|
|
433
457
|
end
|
434
458
|
print detab(line)
|
435
459
|
print "\n"
|
436
|
-
print "</listinfo>" unless
|
460
|
+
print "</listinfo>" unless @book.config["listinfo"].nil?
|
437
461
|
no += 1
|
438
462
|
end
|
439
463
|
puts '</pre></list>'
|
@@ -441,7 +465,7 @@ module ReVIEW
|
|
441
465
|
private :quotedlist
|
442
466
|
|
443
467
|
def quote(lines)
|
444
|
-
if
|
468
|
+
if @book.config["deprecated-blocklines"].nil?
|
445
469
|
blocked_lines = split_paragraph(lines)
|
446
470
|
puts "<quote>#{blocked_lines.join("")}</quote>"
|
447
471
|
else
|
@@ -466,12 +490,12 @@ module ReVIEW
|
|
466
490
|
"<span type='image'>#{I18n.t("image")}#{I18n.t("format_number", [get_chap(chapter), chapter.image(id).number])}</span>"
|
467
491
|
end
|
468
492
|
end
|
469
|
-
|
493
|
+
|
470
494
|
def handle_metric(str)
|
471
495
|
k, v = str.split('=', 2)
|
472
496
|
return %Q|#{k}=\"#{v.sub(/\A["']/, '').sub(/["']\Z/, '')}\"|
|
473
497
|
end
|
474
|
-
|
498
|
+
|
475
499
|
def result_metric(array)
|
476
500
|
" #{array.join(' ')}"
|
477
501
|
end
|
@@ -516,8 +540,8 @@ module ReVIEW
|
|
516
540
|
def table(lines, id = nil, caption = nil)
|
517
541
|
tablewidth = nil
|
518
542
|
col = 0
|
519
|
-
unless
|
520
|
-
tablewidth =
|
543
|
+
unless @book.config["tableopt"].nil?
|
544
|
+
tablewidth = @book.config["tableopt"].split(",")[0].to_f / 0.351 # mm -> pt
|
521
545
|
end
|
522
546
|
puts "<table>"
|
523
547
|
rows = []
|
@@ -628,7 +652,7 @@ module ReVIEW
|
|
628
652
|
def td(str)
|
629
653
|
str
|
630
654
|
end
|
631
|
-
|
655
|
+
|
632
656
|
def table_end
|
633
657
|
print "<?dtp tablerow last?>"
|
634
658
|
end
|
@@ -681,7 +705,7 @@ module ReVIEW
|
|
681
705
|
end
|
682
706
|
|
683
707
|
def inline_hint(str)
|
684
|
-
if
|
708
|
+
if @book.config["nolf"].nil?
|
685
709
|
%Q[\n<hint>#{escape_html(str)}</hint>]
|
686
710
|
else
|
687
711
|
%Q[<hint>#{escape_html(str)}</hint>]
|
@@ -737,7 +761,7 @@ module ReVIEW
|
|
737
761
|
%Q(<tt style='bold'>#{escape_html(str)}</tt><index value='#{index}' />)
|
738
762
|
end
|
739
763
|
|
740
|
-
|
764
|
+
alias_method :inline_ttbold, :inline_ttb
|
741
765
|
|
742
766
|
def inline_tti(str)
|
743
767
|
%Q(<tt style='italic'>#{escape_html(str)}</tt>)
|
@@ -768,7 +792,7 @@ module ReVIEW
|
|
768
792
|
%Q[<ref idref='#{escape_html(idref)}'>「●● #{escape_html(idref)}」</ref>] # FIXME:節名とタイトルも込みで要出力
|
769
793
|
end
|
770
794
|
|
771
|
-
|
795
|
+
alias_method :inline_ref, :inline_labelref
|
772
796
|
|
773
797
|
def inline_pageref(idref)
|
774
798
|
%Q[<pageref idref='#{escape_html(idref)}'>●●</pageref>] # ページ番号を参照
|
@@ -815,7 +839,9 @@ module ReVIEW
|
|
815
839
|
end
|
816
840
|
|
817
841
|
def common_column_begin(type, caption)
|
818
|
-
|
842
|
+
@column += 1
|
843
|
+
a_id = %Q[id="column-#{@column}"]
|
844
|
+
print "<#{type}column #{a_id}>"
|
819
845
|
puts %Q[<title aid:pstyle="#{type}column-title">#{compile_inline(caption)}</title>]
|
820
846
|
end
|
821
847
|
|
@@ -896,7 +922,7 @@ module ReVIEW
|
|
896
922
|
end
|
897
923
|
|
898
924
|
def flushright(lines)
|
899
|
-
if
|
925
|
+
if @book.config["deprecated-blocklines"].nil?
|
900
926
|
puts split_paragraph(lines).join.gsub("<p>", "<p align='right'>")
|
901
927
|
else
|
902
928
|
puts "<p align='right'>#{lines.join("\n")}</p>"
|
@@ -911,7 +937,7 @@ module ReVIEW
|
|
911
937
|
print "<#{type}>"
|
912
938
|
style = specialstyle.nil? ? "#{type}-title" : specialstyle
|
913
939
|
puts "<title aid:pstyle='#{style}'>#{compile_inline(caption)}</title>" unless caption.nil?
|
914
|
-
if
|
940
|
+
if @book.config["deprecated-blocklines"].nil?
|
915
941
|
blocked_lines = split_paragraph(lines)
|
916
942
|
puts "#{blocked_lines.join}</#{type}>"
|
917
943
|
else
|
@@ -994,7 +1020,7 @@ module ReVIEW
|
|
994
1020
|
def practice(lines)
|
995
1021
|
captionblock("practice", lines, nil)
|
996
1022
|
end
|
997
|
-
|
1023
|
+
|
998
1024
|
def expert(lines)
|
999
1025
|
captionblock("expert", lines, nil)
|
1000
1026
|
end
|
@@ -1013,7 +1039,7 @@ module ReVIEW
|
|
1013
1039
|
end
|
1014
1040
|
no = 1
|
1015
1041
|
lines.each do |line|
|
1016
|
-
unless
|
1042
|
+
unless @book.config["listinfo"].nil?
|
1017
1043
|
print %Q[<listinfo line="#{no}"]
|
1018
1044
|
print %Q[ begin="1"] if no == 1
|
1019
1045
|
print %Q[ end="#{no}"] if no == lines.size
|
@@ -1021,7 +1047,7 @@ module ReVIEW
|
|
1021
1047
|
end
|
1022
1048
|
print detab(line)
|
1023
1049
|
print "\n"
|
1024
|
-
print "</listinfo>" unless
|
1050
|
+
print "</listinfo>" unless @book.config["listinfo"].nil?
|
1025
1051
|
no += 1
|
1026
1052
|
end
|
1027
1053
|
puts "</#{type}>"
|
@@ -1047,7 +1073,7 @@ module ReVIEW
|
|
1047
1073
|
puts "</img>"
|
1048
1074
|
end
|
1049
1075
|
|
1050
|
-
|
1076
|
+
alias_method :numberlessimage, :indepimage
|
1051
1077
|
|
1052
1078
|
def label(id)
|
1053
1079
|
# FIXME
|
@@ -1097,9 +1123,9 @@ module ReVIEW
|
|
1097
1123
|
|
1098
1124
|
def inline_chapref(id)
|
1099
1125
|
chs = ["", "「", "」"]
|
1100
|
-
unless
|
1101
|
-
_chs = convert_inencoding(
|
1102
|
-
|
1126
|
+
unless @book.config["chapref"].nil?
|
1127
|
+
_chs = convert_inencoding(@book.config["chapref"],
|
1128
|
+
@book.config["inencoding"]).split(",")
|
1103
1129
|
if _chs.size != 3
|
1104
1130
|
error "--chapsplitter must have exactly 3 parameters with comma."
|
1105
1131
|
else
|
@@ -1108,7 +1134,7 @@ module ReVIEW
|
|
1108
1134
|
else
|
1109
1135
|
end
|
1110
1136
|
s = "#{chs[0]}#{@chapter.env.chapter_index.number(id)}#{chs[1]}#{@chapter.env.chapter_index.title(id)}#{chs[2]}"
|
1111
|
-
if
|
1137
|
+
if @book.config["chapterlink"]
|
1112
1138
|
%Q(<link href="#{id}">#{s}</link>)
|
1113
1139
|
else
|
1114
1140
|
s
|
@@ -1119,7 +1145,7 @@ module ReVIEW
|
|
1119
1145
|
end
|
1120
1146
|
|
1121
1147
|
def inline_chap(id)
|
1122
|
-
if
|
1148
|
+
if @book.config["chapterlink"]
|
1123
1149
|
%Q(<link href="#{id}">#{@chapter.env.chapter_index.number(id)}</link>)
|
1124
1150
|
else
|
1125
1151
|
@chapter.env.chapter_index.number(id)
|
@@ -1130,7 +1156,7 @@ module ReVIEW
|
|
1130
1156
|
end
|
1131
1157
|
|
1132
1158
|
def inline_title(id)
|
1133
|
-
if
|
1159
|
+
if @book.config["chapterlink"]
|
1134
1160
|
%Q(<link href="#{id}">#{@chapter.env.chapter_index.title(id)}</link>)
|
1135
1161
|
else
|
1136
1162
|
@chapter.env.chapter_index.title(id)
|
@@ -1175,7 +1201,7 @@ module ReVIEW
|
|
1175
1201
|
def inline_hd_chap(chap, id)
|
1176
1202
|
if chap.number
|
1177
1203
|
n = chap.headline_index.number(id)
|
1178
|
-
if
|
1204
|
+
if @book.config["secnolevel"] >= n.split('.').size
|
1179
1205
|
return "「#{n} #{compile_inline(chap.headline(id).caption)}」"
|
1180
1206
|
end
|
1181
1207
|
end
|