review 0.6.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/ChangeLog +441 -0
  2. data/README.rdoc +25 -0
  3. data/Rakefile +13 -1
  4. data/VERSION +1 -1
  5. data/bin/review-check +1 -1
  6. data/bin/review-compile +19 -10
  7. data/bin/review-epubmaker +114 -17
  8. data/bin/review-index +8 -1
  9. data/bin/review-pdfmaker +378 -0
  10. data/bin/review-preproc +2 -3
  11. data/bin/review-vol +1 -2
  12. data/debian/README.Debian +12 -0
  13. data/debian/README.source +5 -0
  14. data/debian/changelog +5 -0
  15. data/debian/compat +1 -0
  16. data/debian/control +22 -0
  17. data/debian/copyright +60 -0
  18. data/debian/docs +5 -0
  19. data/debian/manpage.1.ex +59 -0
  20. data/debian/patches/path.diff +91 -0
  21. data/debian/patches/series +1 -0
  22. data/debian/review.install +13 -0
  23. data/debian/review.links +4 -0
  24. data/debian/rules +13 -0
  25. data/debian/source/format +1 -0
  26. data/doc/format.rdoc +477 -0
  27. data/doc/format.re +19 -0
  28. data/doc/format_idg.rdoc +180 -0
  29. data/doc/ruby-uuid/README +11 -0
  30. data/doc/ruby-uuid/README.ja +34 -0
  31. data/doc/sample.css +17 -0
  32. data/doc/sample.yaml +8 -4
  33. data/lib/lineinput.rb +1 -1
  34. data/lib/review/book.rb +43 -36
  35. data/lib/review/builder.rb +78 -33
  36. data/lib/review/compiler.rb +45 -48
  37. data/lib/review/epubbuilder.rb +1 -675
  38. data/lib/review/exception.rb +1 -1
  39. data/lib/review/htmlbuilder.rb +627 -49
  40. data/lib/review/htmlutils.rb +5 -0
  41. data/lib/review/idgxmlbuilder.rb +239 -250
  42. data/lib/review/index.rb +84 -7
  43. data/lib/review/latexbuilder.rb +261 -42
  44. data/lib/review/latexutils.rb +15 -6
  45. data/lib/review/preprocessor.rb +40 -6
  46. data/lib/review/textutils.rb +22 -0
  47. data/lib/review/topbuilder.rb +4 -1
  48. data/lib/uuid.rb +312 -0
  49. data/review.gemspec +44 -12
  50. data/test/CHAPS +2 -0
  51. data/test/bib.re +13 -0
  52. data/test/test.re +43 -0
  53. data/test/test_book.rb +1191 -0
  54. data/test/test_builder.rb +147 -0
  55. data/test/test_htmlbuilder.rb +191 -10
  56. data/test/test_htmlutils.rb +24 -0
  57. data/test/test_idgxmlbuilder.rb +310 -0
  58. data/test/test_index.rb +15 -0
  59. data/test/test_latexbuilder.rb +217 -6
  60. data/test/test_lineinput.rb +198 -0
  61. data/test/test_textutils.rb +68 -0
  62. data/test/test_uuid.rb +156 -0
  63. metadata +43 -10
  64. data/doc/format.txt +0 -434
  65. data/doc/format_idg.txt +0 -194
  66. data/doc/format_sjis.txt +0 -313
  67. data/setup.rb +0 -1587
  68. data/test/test_epubbuilder.rb +0 -73
@@ -317,6 +317,7 @@ RD や各種 Wiki の文法をとりいれて簡素化しています。
317
317
 
318
318
  リード文は //read{ 〜 //} で指定します。lead でなく read
319
319
  なのは、ASCII の EWB が「read」を使っていたからです。
320
+ //lead{ 〜 //} でも使えます。
320
321
 
321
322
  === [例]
322
323
 
@@ -327,6 +328,18 @@ RD や各種 Wiki の文法をとりいれて簡素化しています。
327
328
  //}
328
329
  //}
329
330
 
331
+ == TeX式
332
+
333
+ LaTeX の式を挿入するには、//texequation{ 〜 //} を使います。
334
+
335
+ === [例]
336
+
337
+ //emlist{
338
+ //texequation{
339
+ \sum_{i=1}^nf_n(x)
340
+ //}
341
+ //}
342
+
330
343
  == 空白制御
331
344
 
332
345
  : //noindent
@@ -398,6 +411,12 @@ ReVIEW は任意のブロックを追加可能なので、本によって専用
398
411
  : @<raw>{@<b>{どうしても\}}
399
412
  太字。
400
413
 
414
+ : @<raw>{@<br>{\}}
415
+ 段落中改行。
416
+
417
+ : @<raw>{@<m>{a + \alpha\}}
418
+ TeXインライン式。
419
+
401
420
  == 著者用タグ (プリプロセッサ命令)
402
421
 
403
422
  これまでに説明したタグはすべて最終段階まで残り、見ために
@@ -0,0 +1,180 @@
1
+ = ReVIEW フォーマット InDesign XML 形式拡張
2
+
3
+ ReVIEW フォーマットから、Adobe 社の DTP ソフトウェア「InDesign」
4
+ で読み込んで利用しやすい XML 形式に変換できます (通常の XML とほぼ同じ
5
+ ですが、文書構造ではなく見た目を指向した形態になっています)。
6
+ 現時点では idgxmlbuilder.rb と topbuilder.rb のみが拡張に対応しています。
7
+ 実際には出力された XML を InDesign のスタイルに割り当てるフィルタをさらに
8
+ 作成・適用する必要があります。
9
+
10
+ == 章・節・項・段
11
+
12
+ 従来の[column]のほかに、オプションを追加しています。
13
+
14
+ * [nonum] : これを指定している章・節・項・段には連番を振りません。
15
+ * [circle]: 「・」を先頭に付けた小さな見出し(連番なし)を作成します。
16
+ * [world]: Real Worldコラム。
17
+ * [hood]: Under the Hoodコラム。
18
+ * [edition]: Editionコラム。
19
+ * [insideout]: インサイドアウトコラム。
20
+
21
+ == 書式ブロック
22
+ //insn[タイトル]{ 〜 //} または //box[タイトル]{ 〜 //} で書式を指定し
23
+ ます。
24
+
25
+ == ノート
26
+ //note{ 〜 //} または //note[タイトル]{ 〜 //} で注意文章を指定します。
27
+
28
+ == メモ
29
+ //memo{ 〜 //} または //memo[タイトル]{ 〜 //} でメモ文章を指定します。
30
+
31
+ == ヒント
32
+ //tip{ 〜 //} または //tip[タイトル]{ 〜 //} でヒント(Tip)文章を指定します。
33
+
34
+ == 参照ブロック
35
+ //info{ 〜 //} または //info[タイトル]{ 〜 //} で参照文章を指定します。
36
+
37
+ == プランニング
38
+ //planning{ 〜 //} または //planning[タイトル]{ 〜 //} でプランニング文章を
39
+ 指定します。
40
+
41
+ == ベストプラクティス
42
+ //best{ 〜 //} または //best[タイトル]{ 〜 //} でベストプラクティス文章を
43
+ 指定します。
44
+
45
+ == ここが重要 (キーワード)
46
+ //important[タイトル]{ 〜 //} で重要項目を指定します。
47
+
48
+ == セキュリティ
49
+ //security{ 〜 //} または //security[タイトル]{ 〜 //} でセキュリティ文章を
50
+ 指定します。
51
+
52
+ == 警告
53
+ //caution{ 〜 //} または //caution[タイトル]{ 〜 //} で警告文章を指定します。
54
+
55
+ == エキスパートに訊く
56
+ //expert{ 〜 //} で「エキスパートに訊く」を指定します (rawで<expert>〜
57
+ </expert>を使うほうがよいかもしれません)。
58
+ QとAは@<b>{Q}:〜 と @<b>{A}:〜 で示します。
59
+
60
+ == 注意
61
+ //notice{ 〜 //} または //notice[タイトル]{ 〜 //} で注意を指定します。
62
+
63
+ == ワンポイント
64
+ //point{ 〜 //} または //point[タイトル]{ 〜 //} でワンポイントを指定します。
65
+
66
+ == トラブルシューティング
67
+ //shoot{ 〜 //} または //shoot[タイトル]{ 〜 //} でトラブルシューティングを
68
+ 指定します。
69
+
70
+ == 用語解説
71
+ //term{ 〜 //} で用語解説を指定します(ただし、ブロック指定ができないので
72
+ 実質的にはrawで<term>〜</term>を通常使うことになるでしょう)。
73
+
74
+ == リンク
75
+ //link{ 〜 //} または //link[タイトル]{ 〜 //} で他の章やファイルなどへの
76
+ 参照内容を指定します。
77
+
78
+ == 練習問題
79
+ //practice{ 〜 //} で練習問題を指定します。
80
+
81
+ == 参考
82
+ //reference{ 〜 //} で参考情報を指定します。
83
+
84
+ == 相互参照
85
+ //label[〜]でラベルを定義し、@<labelref>{〜}で参照します。
86
+ XMLとしては<label id='〜' />と<labelref idref='〜' />というタグに
87
+ 置き換えられます。
88
+ 実際にどのような相互参照関係にするかは、処理系に依存します。
89
+ 想定の用途では、章や節の番号およびタイトルを記憶し、labelrefの出現箇所
90
+ に"「節(あるいは章)番号 タイトル」"という文字列を配置します。
91
+
92
+ @<chapref>の展開形式を、--chapref="前装飾文字列,中間装飾文字列,後装飾文字列"
93
+ でコンパイル実行時に指定できます。デフォルトは",「,」"です。たとえば
94
+ "第2章「コンパイラ」" のように普通は展開されます。
95
+ "「, ,」"と指定すると、"「第2章 コンパイラ」" に展開されます。
96
+
97
+ == 丸数字
98
+ @<maru>{数値} で丸数字を出力します。
99
+
100
+ == キートップ
101
+ @<keytop>{キー文字} でキーボードマークを出力します。
102
+
103
+ == 吹き出し
104
+ @<balloon>{〜} でコード内などでの吹き出しを作成します。吹き出しは右に寄せ
105
+ られ、記入した箇所から吹き出しまで線が引かれます。
106
+ @<>オペレータは入れ子ができないため、丸数字を使いたいときには@maru[数値]
107
+ という特別な書式を代わりに使います。
108
+
109
+ == ロー指定
110
+ 現時点で ReVIEW はブロックの入れ子処理ができないため、ロー指定で XML
111
+ エレメントを指定しなければならないこともあります。
112
+
113
+ インラインの@<raw>{ 〜 }の他に、単一行の//raw[〜]、ブロック版の //rawblock{ 〜 //} でも、フォーマット処理をせずにそのままの文字列が出力できます。
114
+
115
+ == キャプションなし表
116
+ //table{ 〜 //} のように id もキャプションも付けないブロックを利用できます。
117
+ この場合、その表の連番付けを飛ばします。
118
+
119
+ == 表セル幅の指定
120
+ //tsize[1列目の幅,2列目の幅,...] で、続く //table の表の列幅を指定します
121
+ (単位mm)。これを利用するときには、review2idgxml を実行する際、オプション
122
+ --table=表幅 を付ける必要があります (表幅の単位は mm)。列幅指定の個数が
123
+ 実際の列数に満たない場合、残りの列は均等分割したものとなります。列幅の
124
+ 合計が表幅を超えるとエラーになります。
125
+
126
+ == DTP 命令指定
127
+ @<dtp>{ 〜 } で InDesign 向けに「<? dtp 〜 ?>」型の XML インストラクション
128
+ を埋め込みます。処理系に渡す任意の文字列を指定できますが、次のような文字列
129
+ を特殊文字指定できます。
130
+
131
+ * maru 番号リストの各段落先頭で使い、このリスト段落の番号は丸数字であることを示す
132
+ * return 改行記号文字
133
+
134
+ * autopagenumber 現ページ番号
135
+ * nextpageunmber 次ページ番号
136
+ * previouspagenumber 前ページ番号
137
+ * sectionmarker セクションマーカー
138
+ * bulletcharacter ビュレット (ナカグロ)
139
+ * copyrightsymbol 著作権記号
140
+ * degreesymbol 度記号
141
+ * ellipsischaracter 省略記号
142
+ * forcedlinebreak 強制改行
143
+ * discretionarylinebreak 任意の改行
144
+ * paragraphsymbol 段落記号
145
+ * registeredtrademark 登録商標記号
146
+ * sectionsymbol セクション記号
147
+ * trademarksymbol 商標記号
148
+ * rightindenttab 右インデントタブ
149
+ * indentheretab 「ここまでインデント」タブ
150
+ * zerowidthnonjoiner 結合なし
151
+ * emdash EMダッシュ
152
+ * endash ENダッシュ
153
+ * discretionaryhyphen 任意ハイフン
154
+ * nonbreakinghyphen 分散禁止ハイフン
155
+ * endnestedstyle 先頭文字スタイルの終了文字
156
+ * doubleleftquote 左二重引用符
157
+ * doublerightquote 右二重引用符
158
+ * singleleftquote 左用符
159
+ * singlerightquote 右引用符
160
+ * singlestraightquote 半角一重左用符
161
+ * doublestraightquote 半角二重引用符
162
+ * emspace EMスペース
163
+ * enspace ENスペース
164
+ * flushspace フラッシュスペース
165
+ * hairspace 極細スペース
166
+ * nonbreakingspace 分散禁止スペース
167
+ * fixedwidthnonbreakingspace 分散禁止スペース(固定幅)
168
+ * textvariable 全角スペース
169
+ * thinspace 細いスペース
170
+ * figurespace 数字の間隔
171
+ * punctuationspace 句読点等の間隔
172
+ * sixthspace 1/6スペース
173
+ * quarterspace 1/4スペース
174
+ * thirdspace 1/3スペース
175
+ * columnbreak 改段
176
+ * framebreak 改フレーム
177
+ * pagebreak 改ページ
178
+ * oddpagebreak 奇数改ページ
179
+ * evenpagebreak 偶数改ページ
180
+ * footnotesymbol 脚注記号
@@ -0,0 +1,11 @@
1
+ For GitHub users;
2
+
3
+ This is a pure-ruby implementation of RFC4122 that I wrote back in
4
+ 2005. I have touched its internals a few times (mainly bugfixes). I
5
+ know someone has already uploaded an old copy of it to GitHub, and
6
+ thats' 100% legal he has the right to do so, but I believe what I have
7
+ now is better than the older ones. So I upload this.
8
+
9
+ It's very tiny (<300 lines ruby code) and you can simply copy
10
+ lib/uuid.rb to your project. The gemspec file can help you maintain
11
+ your dependency though.
@@ -0,0 +1,34 @@
1
+ UUID: Pure-ruby RFC4122 Implementation
2
+
3
+ RFC4122をフルサポート(はず)のライブラリ。使いかたは
4
+
5
+ require 'uuid'
6
+ UUID.create # => instance
7
+
8
+ とか。
9
+
10
+ 基本的にUUIDってのは存在していることに意味があるオブジェクトなため、それ自身には
11
+ ほとんどインスタンスメソッドを持たない。以下はその数少ないメソッドたち
12
+
13
+ * UUID#==, UUID#<=>
14
+ 比較。RFC4122によるとなぜかUUIDは順序つきなんだそうだ。何に使うのか不明。RFCに準
15
+ 拠するためだけのメソッド。
16
+
17
+ * UUID#to_i, UUID#to_int
18
+ 128bit unsigned intとみなして整数化。
19
+
20
+ * UUID#to_s, UUID#to_uri, UUID#guid
21
+ 人間が読める文字列にする。to_uriはRFC4122が定めるURIとして変換。guidはよく
22
+ Windowsとかで見るあれ。
23
+
24
+ * UUID#raw_bytes
25
+ これも文字列を返すんだけど、基本的には読めない。128bit長のUUID値そのもの。
26
+
27
+
28
+ # Local Variables:
29
+ # mode: text
30
+ # indent-tabs-mode: t
31
+ # tab-width: 8
32
+ # fill-column: 79
33
+ # default-justification: full
34
+ # End:
@@ -89,3 +89,20 @@ div h5 {
89
89
  font-size: larger;
90
90
  border-bottom: solid 1px #000000;
91
91
  }
92
+
93
+ p {
94
+ text-indent: 1em;
95
+ }
96
+
97
+ p.caption {
98
+ font-weight: bold;
99
+ text-indent: 0em;
100
+ }
101
+
102
+ p.noindent {
103
+ text-indent: 0em;
104
+ }
105
+
106
+ p.flushright {
107
+ text-align: right;
108
+ }
@@ -28,19 +28,23 @@ aut: 吟遊詩人
28
28
  #
29
29
  # coverimage: カバー用画像。画像ディレクトリ内に置いてもディレクトリ名は不要(例: cover.jpg)
30
30
  #
31
- # 固有IDに使用するドメイン
32
- urnid: example.jp
31
+ # 固有IDに使用するドメイン。指定しない場合には、時刻に基づくランダムUUIDが入る
32
+ # urnid: urn:uid:http://example.com/some-book-title/1.0.2/
33
33
  # CSSファイル (yamlファイルおよびReVIEWファイルを置いたディレクトリにあること)
34
- stylesheet: sample.css
34
+ stylesheet: stylesheet.css
35
+ # LaTeX用のスタイルファイル(styディレクトリ以下に置くこと)
36
+ # texstyle: samplemacro
35
37
  # 目次として抽出するレベル
36
38
  toclevel: 3
37
39
  # セクション番号を表示するレベル
38
40
  secnolevel: 2
39
41
  # EPUB標準の目次以外に目次を作成するか
40
42
  # mytoc: nil
43
+ # 奥付を作成するか。デフォルトでは作成されない。trueを指定するとデフォルトの奥付、ファイル名を指定するとそれがcolophon.htmlとしてコピーされる
44
+ # colophon: true
41
45
  # XHTML生成後に実行するプログラム。$1:HTMLの生成されたディレクトリ $2:ReVIEWファイルのあるディレクトリ $3:起動時指定のyamlファイル名
42
46
  # posthook: hook.sh
43
47
  # review-compileに渡すパラメータ
44
48
  params: --stylesheet=sample.css
45
- # デバッグフラグ。nilのときには一時ファイルをカレントディレクトリに作成し、削除もしない
49
+ # デバッグフラグ。nilでないときには一時ファイルをカレントディレクトリに作成し、削除もしない
46
50
  # debug: nil
@@ -18,7 +18,7 @@ class LineInput
18
18
  end
19
19
 
20
20
  def inspect
21
- "\#<#{self.class} file=#{@f.inspect} line=#{lineno()}>"
21
+ "\#<#{self.class} file=#{@input.inspect} line=#{lineno()}>"
22
22
  end
23
23
 
24
24
  def eof?
@@ -27,9 +27,11 @@ module ReVIEW
27
27
 
28
28
  class Book
29
29
 
30
+ attr_accessor :param
31
+
30
32
  def Book.load_default
31
33
  %w( . .. ../.. ).each do |basedir|
32
- if File.file?("#{basedir}/PARAMS") or File.file?("#{basedir}/CHAPS")
34
+ if File.file?("#{basedir}/CHAPS")
33
35
  return load(basedir)
34
36
  end
35
37
  end
@@ -38,14 +40,7 @@ module ReVIEW
38
40
 
39
41
  def Book.load(dir)
40
42
  update_rubyenv dir
41
- if File.file?("#{dir}/PARAMS")
42
- then new(dir, Parameters.load("#{dir}/PARAMS"))
43
- else new(dir)
44
- end
45
- end
46
-
47
- def setParameter(param)
48
- @param = param
43
+ new(dir)
49
44
  end
50
45
 
51
46
  @basedir_seen = {}
@@ -73,9 +68,7 @@ module ReVIEW
73
68
  :chapter_file,
74
69
  :part_file,
75
70
  :bib_file,
76
- :index_file,
77
71
  :reject_file,
78
- :nocode_file,
79
72
  :predef_file,
80
73
  :postdef_file,
81
74
  :ext,
@@ -109,7 +102,6 @@ module ReVIEW
109
102
 
110
103
  def chapter_index
111
104
  @chapter_index ||= ChapterIndex.new(chapters())
112
- @chapter_index.setParameter(@param)
113
105
  @chapter_index
114
106
  end
115
107
 
@@ -278,10 +270,8 @@ module ReVIEW
278
270
  :chapter_file => const_get_safe(mod, :CHAPS_FILE),
279
271
  :part_file => const_get_safe(mod, :PART_FILE),
280
272
  :bib_file => const_get_safe(mod, :BIB_FILE),
281
- :index_file => const_get_safe(mod, :INDEX_FILE),
282
273
  :reject_file => const_get_safe(mod, :REJECT_FILE) ||
283
274
  const_get_safe(mod, :WORDS_FILE),
284
- :nocode_file => const_get_safe(mod, :NOCODE_FILE),
285
275
  :predef_file => const_get_safe(mod, :PREDEF_FILE),
286
276
  :postdef_file => const_get_safe(mod, :POSTDEF_FILE),
287
277
  :ext => const_get_safe(mod, :EXT),
@@ -313,16 +303,14 @@ module ReVIEW
313
303
  def initialize(params = {})
314
304
  @chapter_file = params[:chapter_file] || 'CHAPS'
315
305
  @part_file = params[:part_file] || 'CHAPS'
316
- @index_file = params[:index_file] || 'INDEX'
317
306
  @reject_file = params[:reject_file] || 'REJECT'
318
- @nocode_file = params[:nocode_file] || 'NOCODE'
319
307
  @predef_file = params[:predef_file] || 'PREDEF'
320
308
  @postdef_file = params[:postdef_file] || 'POSTDEF'
321
309
  @page_metric = params[:page_metric] || PageMetric.a5
322
310
  @ext = params[:ext] || '.re'
323
311
  @image_dir = params[:image_dir] || 'images'
324
312
  @image_types = unify_exts(params[:image_types] ||
325
- %w( eps tif tiff png bmp jpg jpeg gif svg ))
313
+ %w( eps ai tif tiff png bmp jpg jpeg gif svg ))
326
314
  @bib_file = params[:bib_file] || "bib#{@ext}"
327
315
  end
328
316
 
@@ -342,9 +330,7 @@ module ReVIEW
342
330
  path_param :chapter_file
343
331
  path_param :part_file
344
332
  path_param :bib_file
345
- path_param :index_file
346
333
  path_param :reject_file
347
- path_param :nocode_file
348
334
  path_param :predef_file
349
335
  path_param :postdef_file
350
336
  attr_reader :ext
@@ -438,10 +424,9 @@ module ReVIEW
438
424
  @table_index = nil
439
425
  @footnote_index = nil
440
426
  @image_index = nil
441
- end
442
-
443
- def setParameter(param)
444
- @param = param
427
+ @numberless_image_index = nil
428
+ @indepimage_index = nil
429
+ @headline_index = nil
445
430
  end
446
431
 
447
432
  def env
@@ -482,11 +467,11 @@ module ReVIEW
482
467
  end
483
468
  }
484
469
  }
485
- if @param["inencoding"] =~ /^EUC$/
470
+ if ReVIEW.book.param["inencoding"] =~ /^EUC$/
486
471
  @title = NKF.nkf("-E -w", @title)
487
- elsif @param["inencoding"] =~ /^SJIS$/
472
+ elsif ReVIEW.book.param["inencoding"] =~ /^SJIS$/
488
473
  @title = NKF.nkf("-S -w", @title)
489
- elsif @param["inencoding"] =~ /^JIS$/
474
+ elsif ReVIEW.book.param["inencoding"] =~ /^JIS$/
490
475
  @title = NKF.nkf("-J -w", @title)
491
476
  else
492
477
  @title = NKF.nkf("-w", @title)
@@ -507,11 +492,11 @@ module ReVIEW
507
492
  end
508
493
 
509
494
  def content
510
- if @param["inencoding"] =~ /^EUC$/i
495
+ if ReVIEW.book.param["inencoding"] =~ /^EUC$/i
511
496
  @content = NKF.nkf("-E -w", File.read(path()))
512
- elsif @param["inencoding"] =~ /^SJIS$/i
497
+ elsif ReVIEW.book.param["inencoding"] =~ /^SJIS$/i
513
498
  @content = NKF.nkf("-S -w", File.read(path()))
514
- elsif @param["inencoding"] =~ /^JIS$/i
499
+ elsif ReVIEW.book.param["inencoding"] =~ /^JIS$/i
515
500
  @content = NKF.nkf("-J -w", File.read(path()))
516
501
  else
517
502
  @content = NKF.nkf("-w", File.read(path())) # auto detect
@@ -529,7 +514,6 @@ module ReVIEW
529
514
 
530
515
  def list_index
531
516
  @list_index ||= ListIndex.parse(lines())
532
- @list_index.setParameter(@param)
533
517
  @list_index
534
518
  end
535
519
 
@@ -539,7 +523,6 @@ module ReVIEW
539
523
 
540
524
  def table_index
541
525
  @table_index ||= TableIndex.parse(lines())
542
- @table_index.setParameter(@param)
543
526
  @table_index
544
527
  end
545
528
 
@@ -549,22 +532,36 @@ module ReVIEW
549
532
 
550
533
  def footnote_index
551
534
  @footnote_index ||= FootnoteIndex.parse(lines())
552
- @footnote_index.setParameter(@param)
553
535
  @footnote_index
554
536
  end
555
537
 
556
538
  def image(id)
557
- image_index()[id]
539
+ return image_index()[id] if image_index().has_key?(id)
540
+ return numberless_image_index()[id] if numberless_image_index().has_key?(id)
541
+ indepimage_index()[id]
542
+ end
543
+
544
+ def numberless_image_index
545
+ @numberless_image_index ||=
546
+ NumberlessImageIndex.parse(lines(), id(),
547
+ "#{book.basedir}#{@book.image_dir}",
548
+ @book.image_types)
558
549
  end
559
550
 
560
551
  def image_index
561
552
  @image_index ||= ImageIndex.parse(lines(), id(),
562
553
  "#{book.basedir}#{@book.image_dir}",
563
554
  @book.image_types)
564
- @image_index.setParameter(@param)
565
555
  @image_index
566
556
  end
567
557
 
558
+ def indepimage_index
559
+ @indepimage_index ||=
560
+ IndepImageIndex.parse(lines(), id(),
561
+ "#{book.basedir}#{@book.image_dir}",
562
+ @book.image_types)
563
+ end
564
+
568
565
  def bibpaper(id)
569
566
  bibpaper_index()[id]
570
567
  end
@@ -572,9 +569,19 @@ module ReVIEW
572
569
  def bibpaper_index
573
570
  raise FileNotFound, "no such bib file: #{@book.bib_file}" unless @book.bib_exist?
574
571
  @bibpaper_index ||= BibpaperIndex.parse(@book.read_bib.lines.to_a)
575
- @bibpaper_index.setParameter(@param)
576
572
  @bibpaper_index
577
573
  end
578
- end
579
574
 
575
+ def headline(caption)
576
+ headline_index()[caption]
577
+ end
578
+
579
+ def headline_index
580
+ @headline_index ||= HeadlineIndex.parse(lines(), self)
581
+ end
582
+
583
+ def on_CHAPS?
584
+ @book.read_CHAPS().lines.map(&:strip).include?(id() + @book.ext())
585
+ end
586
+ end
580
587
  end