review 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.travis.yml +1 -0
  4. data/ChangeLog +87 -0
  5. data/bin/review-check +2 -2
  6. data/bin/review-compile +15 -30
  7. data/bin/review-index +1 -1
  8. data/bin/review-init +12 -7
  9. data/bin/review-vol +9 -1
  10. data/doc/catalog.ja.md +53 -0
  11. data/doc/catalog.md +52 -0
  12. data/doc/format.ja.md +734 -0
  13. data/doc/format.md +746 -0
  14. data/doc/format_idg.ja.md +203 -0
  15. data/doc/{quickstart.rdoc → quickstart.ja.md} +138 -104
  16. data/doc/quickstart.md +252 -0
  17. data/doc/sample.yml +216 -48
  18. data/lib/epubmaker.rb +0 -1
  19. data/lib/epubmaker/content.rb +2 -2
  20. data/lib/epubmaker/epubcommon.rb +440 -0
  21. data/lib/epubmaker/epubv2.rb +8 -418
  22. data/lib/epubmaker/epubv3.rb +67 -61
  23. data/lib/epubmaker/producer.rb +60 -19
  24. data/lib/review/book.rb +1 -3
  25. data/lib/review/book/base.rb +18 -11
  26. data/lib/review/book/chapter.rb +5 -24
  27. data/lib/review/book/compilable.rb +5 -1
  28. data/lib/review/book/index.rb +48 -17
  29. data/lib/review/book/page_metric.rb +17 -8
  30. data/lib/review/book/part.rb +12 -2
  31. data/lib/review/book/volume.rb +3 -2
  32. data/lib/review/builder.rb +30 -10
  33. data/lib/review/compiler.rb +6 -4
  34. data/lib/review/configure.rb +3 -3
  35. data/lib/review/epubmaker.rb +56 -26
  36. data/lib/review/htmlbuilder.rb +33 -42
  37. data/lib/review/htmlutils.rb +12 -7
  38. data/lib/review/i18n.rb +77 -17
  39. data/lib/review/i18n.yml +80 -4
  40. data/lib/review/idgxmlbuilder.rb +27 -57
  41. data/lib/review/inaobuilder.rb +3 -3
  42. data/lib/review/latexbuilder.rb +90 -67
  43. data/lib/review/layout.tex.erb +54 -7
  44. data/lib/review/markdownbuilder.rb +21 -3
  45. data/lib/review/pdfmaker.rb +67 -38
  46. data/lib/review/sec_counter.rb +1 -1
  47. data/lib/review/tocparser.rb +9 -5
  48. data/lib/review/topbuilder.rb +6 -6
  49. data/lib/review/version.rb +1 -1
  50. data/review.gemspec +3 -1
  51. data/test/book_test_helper.rb +1 -1
  52. data/test/sample-book/README.md +2 -0
  53. data/test/sample-book/src/Rakefile +31 -0
  54. data/test/sample-book/src/_cover.html +0 -0
  55. data/test/sample-book/src/catalog.yml +10 -0
  56. data/test/sample-book/src/ch01.re +0 -0
  57. data/test/sample-book/src/ch02.re +0 -0
  58. data/test/sample-book/src/config.yml +160 -32
  59. data/test/sample-book/src/images/ch01-imgsample.jpg +0 -0
  60. data/test/sample-book/src/images/cover.jpg +0 -0
  61. data/test/sample-book/src/preface.re +0 -0
  62. data/test/sample-book/src/sty/jumoline.sty +0 -0
  63. data/test/sample-book/src/sty/reviewmacro.sty +18 -0
  64. data/test/sample-book/src/style.css +0 -0
  65. data/test/test_book.rb +25 -27
  66. data/test/test_book_chapter.rb +4 -73
  67. data/test/test_book_part.rb +5 -4
  68. data/test/test_builder.rb +3 -3
  69. data/test/test_epub3maker.rb +527 -0
  70. data/test/test_epubmaker.rb +6 -6
  71. data/test/test_htmlbuilder.rb +143 -6
  72. data/test/test_i18n.rb +95 -10
  73. data/test/test_idgxmlbuilder.rb +28 -2
  74. data/test/test_index.rb +109 -1
  75. data/test/test_latexbuilder.rb +51 -0
  76. data/test/test_markdownbuilder.rb +54 -1
  77. data/test/test_pdfmaker.rb +7 -6
  78. data/test/test_review_ext.rb +31 -0
  79. data/test/test_topbuilder.rb +3 -1
  80. metadata +46 -13
  81. data/doc/catalog.rdoc +0 -49
  82. data/doc/format.rdoc +0 -618
  83. data/doc/format_idg.rdoc +0 -180
  84. data/doc/libepubmaker/config.yml +0 -207
  85. data/lib/epubmaker/resource.rb +0 -82
  86. data/test/sample-book/src/CHAPS +0 -2
  87. data/test/sample-book/src/PREDEF +0 -1
@@ -66,6 +66,7 @@ module ReVIEW
66
66
  @subsection = 0
67
67
  @subsubsection = 0
68
68
  @subsubsubsection = 0
69
+ @sec_counter = SecCounter.new(5, @chapter)
69
70
  @column = 0
70
71
  @noindent = nil
71
72
  @rootelement = "doc"
@@ -73,7 +74,6 @@ module ReVIEW
73
74
  @tsize = nil
74
75
  @texblockequation = 0
75
76
  @texinlineequation = 0
76
-
77
77
  print %Q(<?xml version="1.0" encoding="UTF-8"?>\n)
78
78
  print %Q(<#{@rootelement} xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/">)
79
79
  if @book.config["nolf"].present?
@@ -142,7 +142,6 @@ module ReVIEW
142
142
  end
143
143
 
144
144
  def headline(level, label, caption)
145
- prefix = ""
146
145
  case level
147
146
  when 1
148
147
  unless @secttags.nil?
@@ -154,19 +153,6 @@ module ReVIEW
154
153
 
155
154
  print %Q(<chapter id="chap:#{@chapter.number}">) unless @secttags.nil?
156
155
 
157
- if @chapter.number.blank?
158
- prefix = ""
159
- else
160
- placeholder = if @chapter.is_a? ReVIEW::Book::Part
161
- level = 0
162
- 'part'
163
- elsif @chapter.on_APPENDIX?
164
- 'appendix'
165
- else
166
- 'chapter'
167
- end
168
- prefix = "#{I18n.t(placeholder, @chapter.number)}#{I18n.t("chapter_postfix")}"
169
- end
170
156
  @section = 0
171
157
  @subsection = 0
172
158
  @subsubsection = 0
@@ -180,14 +166,7 @@ module ReVIEW
180
166
  end
181
167
  @section += 1
182
168
  print %Q(<sect id="sect:#{@chapter.number}.#{@section}">) unless @secttags.nil?
183
- if @book.config["secnolevel"] >= 2
184
- if @chapter.number.blank? or @chapter.on_APPENDIX?
185
- prefix = ""
186
- else
187
- prefix = "#{@chapter.number}.#{@section}#{I18n.t("chapter_postfix")}"
188
- end
189
- end
190
-
169
+
191
170
  @subsection = 0
192
171
  @subsubsection = 0
193
172
  @subsubsubsection = 0
@@ -200,13 +179,6 @@ module ReVIEW
200
179
 
201
180
  @subsection += 1
202
181
  print %Q(<sect2 id="sect:#{@chapter.number}.#{@section}.#{@subsection}">) unless @secttags.nil?
203
- if @book.config["secnolevel"] >= 3
204
- if @chapter.number.blank? or @chapter.on_APPENDIX?
205
- prefix = ""
206
- else
207
- prefix = "#{@chapter.number}.#{@section}.#{@subsection}#{I18n.t("chapter_postfix")}"
208
- end
209
- end
210
182
 
211
183
  @subsubsection = 0
212
184
  @subsubsubsection = 0
@@ -218,13 +190,6 @@ module ReVIEW
218
190
 
219
191
  @subsubsection += 1
220
192
  print %Q(<sect3 id="sect:#{@chapter.number}.#{@section}.#{@subsection}.#{@subsubsection}">) unless @secttags.nil?
221
- if @book.config["secnolevel"] >= 4
222
- if @chapter.number.blank? or @chapter.on_APPENDIX?
223
- prefix = ""
224
- else
225
- prefix = "#{@chapter.number}.#{@section}.#{@subsection}.#{@subsubsection}#{I18n.t("chapter_postfix")}"
226
- end
227
- end
228
193
 
229
194
  @subsubsubsection = 0
230
195
  when 5
@@ -234,19 +199,12 @@ module ReVIEW
234
199
 
235
200
  @subsubsubsection += 1
236
201
  print %Q(<sect4 id="sect:#{@chapter.number}.#{@section}.#{@subsection}.#{@subsubsection}.#{@subsubsubsection}">) unless @secttags.nil?
237
- if @book.config["secnolevel"] >= 5
238
- if @chapter.number.blank? or @chapter.on_APPENDIX?
239
- prefix = ""
240
- else
241
- prefix = "#{@chapter.number}.#{@section}.#{@subsection}.#{@subsubsection}.#{@subsubsubsection}#{I18n.t("chapter_postfix")}"
242
- end
243
- end
244
-
245
202
  else
246
203
  raise "caption level too deep or unsupported: #{level}"
247
204
  end
248
205
 
249
- prefix = "" if (level.to_i > @book.config["secnolevel"])
206
+ prefix, anchor = headline_prefix(level)
207
+
250
208
  label = label.nil? ? "" : " id=\"#{label}\""
251
209
  toccaption = escape_html(compile_inline(caption.gsub(/@<fn>\{.+?\}/, '')).gsub(/<[^>]+>/, ''))
252
210
  puts %Q(<title#{label} aid:pstyle="h#{level}">#{prefix}#{compile_inline(caption)}</title><?dtp level="#{level}" section="#{prefix}#{toccaption}"?>)
@@ -378,7 +336,7 @@ module ReVIEW
378
336
  end
379
337
  end
380
338
 
381
- def list_header(id, caption)
339
+ def list_header(id, caption, lang)
382
340
  puts %Q[<codelist>]
383
341
  if get_chap.nil?
384
342
  puts %Q[<caption>#{I18n.t("list")}#{I18n.t("format_number_without_chapter", [@chapter.list(id).number])}#{I18n.t("caption_prefix_idgxml")}#{compile_inline(caption)}</caption>]
@@ -403,17 +361,17 @@ module ReVIEW
403
361
  end
404
362
  end
405
363
 
406
- def list_body(id, lines)
364
+ def list_body(id, lines, lang)
407
365
  print %Q(<pre>)
408
366
  codelines_body(lines)
409
367
  puts "</pre></codelist>"
410
368
  end
411
369
 
412
- def emlist(lines, caption = nil)
370
+ def emlist(lines, caption = nil, lang = nil)
413
371
  quotedlist lines, 'emlist', caption
414
372
  end
415
373
 
416
- def emlistnum(lines, caption = nil)
374
+ def emlistnum(lines, caption = nil, lang = nil)
417
375
  _lines = []
418
376
  lines.each_with_index do |line, i|
419
377
  _lines << detab("<span type='lineno'>" + (i + 1).to_s.rjust(2) + ": </span>" + line)
@@ -421,7 +379,7 @@ module ReVIEW
421
379
  quotedlist _lines, 'emlistnum', caption
422
380
  end
423
381
 
424
- def listnum_body(lines)
382
+ def listnum_body(lines, lang)
425
383
  print %Q(<pre>)
426
384
  no = 1
427
385
  lines.each_with_index do |line, i|
@@ -491,6 +449,19 @@ module ReVIEW
491
449
  end
492
450
  end
493
451
 
452
+ def inline_imgref(id)
453
+ chapter, id = extract_chapter_id(id)
454
+ if chapter.image(id).caption.blank?
455
+ inline_img(id)
456
+ else
457
+ if get_chap(chapter).nil?
458
+ "<span type='image'>#{I18n.t("image")}#{I18n.t("format_number_without_chapter", [chapter.image(id).number])}#{I18n.t('image_quote', chapter.image(id).caption)}</span>"
459
+ else
460
+ "<span type='image'>#{I18n.t("image")}#{I18n.t("format_number", [get_chap(chapter), chapter.image(id).number])}#{I18n.t('image_quote', chapter.image(id).caption)}</span>"
461
+ end
462
+ end
463
+ end
464
+
494
465
  def handle_metric(str)
495
466
  k, v = str.split('=', 2)
496
467
  return %Q|#{k}=\"#{v.sub(/\A["']/, '').sub(/["']\Z/, '')}\"|
@@ -758,8 +729,7 @@ module ReVIEW
758
729
  end
759
730
 
760
731
  def inline_ttb(str)
761
- index = escape_html(str).gsub(/<.*?>/, "").gsub(/\*/, "ESCAPED_ASTERISK").gsub(/'/, "&#27;")
762
- %Q(<tt style='bold'>#{escape_html(str)}</tt><index value='#{index}' />)
732
+ %Q(<tt style='bold'>#{escape_html(str)}</tt>)
763
733
  end
764
734
 
765
735
  alias_method :inline_ttbold, :inline_ttb
@@ -790,7 +760,7 @@ module ReVIEW
790
760
  end
791
761
 
792
762
  def inline_labelref(idref)
793
- %Q[<ref idref='#{escape_html(idref)}'>「●● #{escape_html(idref)}」</ref>] # FIXME:節名とタイトルも込みで要出力
763
+ %Q[<ref idref='#{escape_html(idref)}'>「#{I18n.t("label_marker")}#{escape_html(idref)}」</ref>] # FIXME:節名とタイトルも込みで要出力
794
764
  end
795
765
 
796
766
  alias_method :inline_ref, :inline_labelref
@@ -1134,7 +1104,7 @@ module ReVIEW
1134
1104
  end
1135
1105
  else
1136
1106
  end
1137
- s = "#{chs[0]}#{@chapter.env.chapter_index.number(id)}#{chs[1]}#{@chapter.env.chapter_index.title(id)}#{chs[2]}"
1107
+ s = "#{chs[0]}#{@book.chapter_index.number(id)}#{chs[1]}#{@book.chapter_index.title(id)}#{chs[2]}"
1138
1108
  if @book.config["chapterlink"]
1139
1109
  %Q(<link href="#{id}">#{s}</link>)
1140
1110
  else
@@ -1147,9 +1117,9 @@ module ReVIEW
1147
1117
 
1148
1118
  def inline_chap(id)
1149
1119
  if @book.config["chapterlink"]
1150
- %Q(<link href="#{id}">#{@chapter.env.chapter_index.number(id)}</link>)
1120
+ %Q(<link href="#{id}">#{@book.chapter_index.number(id)}</link>)
1151
1121
  else
1152
- @chapter.env.chapter_index.number(id)
1122
+ @book.chapter_index.number(id)
1153
1123
  end
1154
1124
  rescue KeyError
1155
1125
  error "unknown chapter: #{id}"
@@ -184,7 +184,7 @@ module ReVIEW
184
184
  end
185
185
  end
186
186
 
187
- def list_header(id, caption)
187
+ def list_header(id, caption, lang)
188
188
  puts "◆list/◆"
189
189
  if get_chap.nil?
190
190
  puts %Q[●リスト#{@chapter.list(id).number} #{compile_inline(caption)}]
@@ -193,14 +193,14 @@ module ReVIEW
193
193
  end
194
194
  end
195
195
 
196
- def list_body(id, lines)
196
+ def list_body(id, lines, lang)
197
197
  lines.each do |line|
198
198
  puts detab(line)
199
199
  end
200
200
  puts "◆/list◆"
201
201
  end
202
202
 
203
- def listnum_body(lines)
203
+ def listnum_body(lines, lang)
204
204
  lines.each_with_index do |line, i|
205
205
  puts detab((i+1).to_s.rjust(2) + " " +line)
206
206
  end
@@ -13,7 +13,6 @@
13
13
  require 'review/builder'
14
14
  require 'review/latexutils'
15
15
  require 'review/textutils'
16
- require 'review/sec_counter'
17
16
 
18
17
  module ReVIEW
19
18
 
@@ -75,25 +74,20 @@ module ReVIEW
75
74
  6 => 'subparagraph'
76
75
  }
77
76
 
78
- def headline_prefix(level)
79
- @sec_counter.inc(level)
80
- anchor = @sec_counter.anchor(level)
81
- prefix = @sec_counter.prefix(level, @book.config["secnolevel"])
82
- [prefix, anchor]
83
- end
84
- private :headline_prefix
85
-
86
-
87
77
  def headline(level, label, caption)
88
78
  _, anchor = headline_prefix(level)
79
+ headline_name = HEADLINE[level]
80
+ if @chapter.kind_of? ReVIEW::Book::Part
81
+ headline_name = "part"
82
+ end
89
83
  prefix = ""
90
84
  if level > @book.config["secnolevel"] || (@chapter.number.to_s.empty? && level > 1)
91
85
  prefix = "*"
92
86
  end
93
87
  blank unless @output.pos == 0
94
- puts macro(HEADLINE[level]+prefix, compile_inline(caption))
88
+ puts macro(headline_name+prefix, compile_inline(caption))
95
89
  if prefix == "*" && level <= @book.config["toclevel"].to_i
96
- puts "\\addcontentsline{toc}{#{HEADLINE[level]}}{#{compile_inline(caption)}}"
90
+ puts "\\addcontentsline{toc}{#{headline_name}}{#{compile_inline(caption)}}"
97
91
  end
98
92
  if level == 1
99
93
  puts macro('label', chapter_label)
@@ -236,84 +230,112 @@ module ReVIEW
236
230
 
237
231
  alias_method :lead, :read
238
232
 
239
- def emlist(lines, caption = nil)
233
+ def highlight_listings?
234
+ @book.config["highlight"] && @book.config["highlight"]["latex"] == "listings"
235
+ end
236
+ private :highlight_listings?
237
+
238
+ def emlist(lines, caption = nil, lang = nil)
240
239
  blank
241
- if caption
242
- puts macro('reviewemlistcaption', "#{compile_inline(caption)}")
243
- end
244
- puts '\begin{reviewemlist}'
245
- lines.each do |line|
246
- puts detab(line)
240
+ if highlight_listings?
241
+ common_code_block_lst(lines, 'reviewemlistlst', 'title', caption, lang)
242
+ else
243
+ common_code_block(lines, 'reviewemlist', caption, lang) do |line, idx|
244
+ detab(line) + "\n"
245
+ end
247
246
  end
248
- puts '\end{reviewemlist}'
249
- blank
250
247
  end
251
248
 
252
- def emlistnum(lines, caption = nil)
249
+ def emlistnum(lines, caption = nil, lang = nil)
253
250
  blank
254
- if caption
255
- puts macro('reviewemlistcaption', "#{compile_inline(caption)}")
251
+ if highlight_listings?
252
+ common_code_block_lst(lines, 'reviewemlistnumlst', 'title', caption, lang)
253
+ else
254
+ common_code_block(lines, 'reviewemlist', caption, lang) do |line, idx|
255
+ detab((idx+1).to_s.rjust(2)+": " + line) + "\n"
256
+ end
256
257
  end
257
- puts '\begin{reviewemlist}'
258
- lines.each_with_index do |line, i|
259
- puts detab((i+1).to_s.rjust(2) + ": " + line)
258
+ end
259
+
260
+ ## override Builder#list
261
+ def list(lines, id, caption, lang = nil)
262
+ if highlight_listings?
263
+ common_code_block_lst(lines, 'reviewlistlst', 'caption', caption, lang)
264
+ else
265
+ begin
266
+ puts macro('reviewlistcaption', "#{I18n.t("list")}#{I18n.t("format_number_header", [@chapter.number, @chapter.list(id).number])}#{I18n.t("caption_prefix")}#{compile_inline(caption)}")
267
+ rescue KeyError
268
+ error "no such list: #{id}"
269
+ end
270
+ common_code_block(lines, 'reviewlist', nil, lang) do |line, idx|
271
+ detab(line) + "\n"
272
+ end
260
273
  end
261
- puts '\end{reviewemlist}'
262
- blank
263
274
  end
264
275
 
265
- def listnum_body(lines)
266
- puts '\begin{reviewlist}'
267
- lines.each_with_index do |line, i|
268
- puts detab((i+1).to_s.rjust(2) + ": " + line)
276
+ ## override Builder#listnum
277
+ def listnum(lines, id, caption, lang = nil)
278
+ if highlight_listings?
279
+ common_code_block_lst(lines, 'reviewlistnumlst', 'caption', caption, lang)
280
+ else
281
+ begin
282
+ puts macro('reviewlistcaption', "#{I18n.t("list")}#{I18n.t("format_number_header", [@chapter.number, @chapter.list(id).number])}#{I18n.t("caption_prefix")}#{compile_inline(caption)}")
283
+ rescue KeyError
284
+ error "no such list: #{id}"
285
+ end
286
+ common_code_block(lines, 'reviewlist', caption, lang) do |line, idx|
287
+ detab((idx+1).to_s.rjust(2)+": " + line) + "\n"
288
+ end
269
289
  end
270
- puts '\end{reviewlist}'
271
- blank
290
+ end
272
291
 
292
+ def cmd(lines, caption = nil, lang = nil)
293
+ if highlight_listings?
294
+ common_code_block_lst(lines, 'reviewcmdlst', 'title', caption, lang)
295
+ else
296
+ blank
297
+ common_code_block(lines, 'reviewcmd', caption, lang) do |line, idx|
298
+ detab(line) + "\n"
299
+ end
300
+ end
273
301
  end
274
302
 
275
- def cmd(lines, caption = nil)
276
- blank
303
+ def common_code_block(lines, command, caption, lang)
277
304
  if caption
278
- puts macro('reviewcmdcaption', "#{compile_inline(caption)}")
305
+ puts macro(command + 'caption', "#{compile_inline(caption)}")
279
306
  end
280
- puts '\begin{reviewcmd}'
281
- lines.each do |line|
282
- puts detab(line)
307
+ body = ""
308
+ lines.each_with_index do |line, idx|
309
+ body.concat(yield(line, idx))
283
310
  end
284
- puts '\end{reviewcmd}'
311
+ puts macro('begin' ,command)
312
+ print body
313
+ puts macro('end' ,command)
285
314
  blank
286
315
  end
287
316
 
288
- def list_header(id, caption)
289
- puts macro('reviewlistcaption', "#{I18n.t("list")}#{I18n.t("format_number_header", [@chapter.number, @chapter.list(id).number])}#{I18n.t("caption_prefix")}#{compile_inline(caption)}")
290
- end
291
-
292
- def list_body(id, lines)
293
- puts '\begin{reviewlist}'
294
- lines.each do |line|
295
- puts detab(line)
317
+ def common_code_block_lst(lines, command, title, caption, lang)
318
+ caption_str = compile_inline((caption || ""))
319
+ if title == "title" && caption_str == ""
320
+ caption_str = "\\relax" ## dummy charactor to remove lstname
321
+ print "\\vspace{-1.5em}"
296
322
  end
297
- puts '\end{reviewlist}'
298
- puts ""
323
+ lexer = lang || ""
324
+ body = lines.inject(''){|i, j| i + detab(unescape_latex(j)) + "\n"}
325
+ puts "\\begin{"+command+"}["+title+"={"+caption_str+"},language={"+ lexer+"}]"
326
+ print body
327
+ puts "\\end{"+ command + "}"
328
+ blank
299
329
  end
300
330
 
301
331
  def source(lines, caption)
302
332
  puts '\begin{reviewlist}'
303
- source_header caption
304
- source_body lines
305
- puts '\end{reviewlist}'
306
- puts ""
307
- end
308
-
309
- def source_header(caption)
310
333
  puts macro('reviewlistcaption', compile_inline(caption))
311
- end
312
-
313
- def source_body(lines)
314
334
  lines.each do |line|
315
335
  puts detab(line)
316
336
  end
337
+ puts '\end{reviewlist}'
338
+ puts ""
317
339
  end
318
340
 
319
341
 
@@ -373,8 +395,9 @@ module ReVIEW
373
395
  end
374
396
  private :sec_label
375
397
 
376
- def table_label(id)
377
- "table:#{@chapter.id}:#{id}"
398
+ def table_label(id, chapter=nil)
399
+ chapter ||= @chapter
400
+ "table:#{chapter.id}:#{id}"
378
401
  end
379
402
  private :table_label
380
403
 
@@ -593,9 +616,9 @@ module ReVIEW
593
616
 
594
617
  def inline_chap(id)
595
618
  if @book.config["chapterlink"]
596
- "\\hyperref[chap:#{id}]{#{@chapter.env.chapter_index.number(id)}}"
619
+ "\\hyperref[chap:#{id}]{#{@book.chapter_index.number(id)}}"
597
620
  else
598
- @chapter.env.chapter_index.number(id)
621
+ @book.chapter_index.number(id)
599
622
  end
600
623
  rescue KeyError
601
624
  error "unknown chapter: #{id}"
@@ -623,7 +646,7 @@ module ReVIEW
623
646
 
624
647
  def inline_table(id)
625
648
  chapter, id = extract_chapter_id(id)
626
- macro('reviewtableref', "#{chapter.number}.#{chapter.table(id).number}", table_label(id))
649
+ macro('reviewtableref', "#{chapter.number}.#{chapter.table(id).number}", table_label(id, chapter))
627
650
  end
628
651
 
629
652
  def inline_img(id)