review-peg 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +36 -0
  3. data/.rubocop.yml +47 -0
  4. data/.rubocop_todo.yml +605 -0
  5. data/.travis.yml +18 -0
  6. data/COPYING +515 -0
  7. data/ChangeLog +2449 -0
  8. data/Dockerfile +22 -0
  9. data/Gemfile +6 -0
  10. data/README.rdoc +81 -0
  11. data/Rakefile +51 -0
  12. data/bin/review-catalog-converter-peg +129 -0
  13. data/bin/review-check-peg +169 -0
  14. data/bin/review-checkdep-peg +63 -0
  15. data/bin/review-compile-peg +202 -0
  16. data/bin/review-epubmaker-legacy-peg +1024 -0
  17. data/bin/review-epubmaker-peg +44 -0
  18. data/bin/review-index-peg +110 -0
  19. data/bin/review-init-peg +151 -0
  20. data/bin/review-pdfmaker-peg +18 -0
  21. data/bin/review-preproc-peg +131 -0
  22. data/bin/review-validate-peg +51 -0
  23. data/bin/review-vol-peg +100 -0
  24. data/debian/README.Debian +12 -0
  25. data/debian/README.source +5 -0
  26. data/debian/changelog +5 -0
  27. data/debian/compat +1 -0
  28. data/debian/control +22 -0
  29. data/debian/copyright +62 -0
  30. data/debian/docs +6 -0
  31. data/debian/manpage.1.ex +59 -0
  32. data/debian/patches/path.diff +91 -0
  33. data/debian/patches/series +1 -0
  34. data/debian/review.install +13 -0
  35. data/debian/review.links +4 -0
  36. data/debian/rules +13 -0
  37. data/debian/source/format +1 -0
  38. data/doc/NEWS.ja.md +350 -0
  39. data/doc/NEWS.md +354 -0
  40. data/doc/catalog.ja.md +53 -0
  41. data/doc/catalog.md +52 -0
  42. data/doc/format.ja.md +734 -0
  43. data/doc/format.md +746 -0
  44. data/doc/format_idg.ja.md +203 -0
  45. data/doc/quickstart.ja.md +222 -0
  46. data/doc/quickstart.md +252 -0
  47. data/doc/ruby-uuid/README +11 -0
  48. data/doc/ruby-uuid/README.ja +34 -0
  49. data/doc/sample.css +108 -0
  50. data/doc/sample.yml +238 -0
  51. data/lib/epubmaker.rb +24 -0
  52. data/lib/epubmaker/content.rb +93 -0
  53. data/lib/epubmaker/epubcommon.rb +424 -0
  54. data/lib/epubmaker/epubv2.rb +139 -0
  55. data/lib/epubmaker/epubv3.rb +222 -0
  56. data/lib/epubmaker/producer.rb +330 -0
  57. data/lib/lineinput.rb +107 -0
  58. data/lib/review.rb +3 -0
  59. data/lib/review/book.rb +43 -0
  60. data/lib/review/book/base.rb +401 -0
  61. data/lib/review/book/chapter.rb +100 -0
  62. data/lib/review/book/compilable.rb +184 -0
  63. data/lib/review/book/image_finder.rb +71 -0
  64. data/lib/review/book/index.rb +413 -0
  65. data/lib/review/book/page_metric.rb +47 -0
  66. data/lib/review/book/part.rb +54 -0
  67. data/lib/review/book/volume.rb +67 -0
  68. data/lib/review/builder.rb +452 -0
  69. data/lib/review/catalog.rb +52 -0
  70. data/lib/review/compiler.rb +5183 -0
  71. data/lib/review/compiler/literals_1_9.kpeg +22 -0
  72. data/lib/review/compiler/literals_1_9.rb +435 -0
  73. data/lib/review/configure.rb +64 -0
  74. data/lib/review/epubbuilder.rb +18 -0
  75. data/lib/review/epubmaker.rb +480 -0
  76. data/lib/review/ewbbuilder.rb +381 -0
  77. data/lib/review/exception.rb +21 -0
  78. data/lib/review/extentions.rb +4 -0
  79. data/lib/review/extentions/array.rb +25 -0
  80. data/lib/review/extentions/object.rb +9 -0
  81. data/lib/review/extentions/string.rb +33 -0
  82. data/lib/review/htmlbuilder.rb +1166 -0
  83. data/lib/review/htmllayout.rb +41 -0
  84. data/lib/review/htmltoc.rb +45 -0
  85. data/lib/review/htmlutils.rb +90 -0
  86. data/lib/review/i18n.rb +96 -0
  87. data/lib/review/i18n.yml +169 -0
  88. data/lib/review/idgxmlbuilder.rb +1233 -0
  89. data/lib/review/inaobuilder.rb +357 -0
  90. data/lib/review/latexbuilder.rb +941 -0
  91. data/lib/review/latexindex.rb +35 -0
  92. data/lib/review/latexutils.rb +95 -0
  93. data/lib/review/layout.tex.erb +340 -0
  94. data/lib/review/lineinput.rb +17 -0
  95. data/lib/review/location.rb +24 -0
  96. data/lib/review/makerhelper.rb +67 -0
  97. data/lib/review/markdownbuilder.rb +339 -0
  98. data/lib/review/node.rb +288 -0
  99. data/lib/review/pdfmaker.rb +332 -0
  100. data/lib/review/preprocessor.rb +530 -0
  101. data/lib/review/review.kpeg +745 -0
  102. data/lib/review/sec_counter.rb +69 -0
  103. data/lib/review/template.rb +21 -0
  104. data/lib/review/textbuilder.rb +17 -0
  105. data/lib/review/textutils.rb +16 -0
  106. data/lib/review/tocparser.rb +348 -0
  107. data/lib/review/tocprinter.rb +205 -0
  108. data/lib/review/topbuilder.rb +796 -0
  109. data/lib/review/unfold.rb +138 -0
  110. data/lib/review/version.rb +3 -0
  111. data/lib/uuid.rb +312 -0
  112. data/review.gemspec +32 -0
  113. data/templates/html/layout-html5.html.erb +17 -0
  114. data/templates/html/layout-xhtml1.html.erb +20 -0
  115. data/templates/ncx/epubv2.ncx.erb +11 -0
  116. data/templates/opf/epubv2.opf.erb +21 -0
  117. data/templates/opf/epubv3.opf.erb +18 -0
  118. data/templates/xml/container.xml.erb +6 -0
  119. data/test/CHAPS +2 -0
  120. data/test/assets/test.xml.erb +3 -0
  121. data/test/assets/test_template.tex +255 -0
  122. data/test/assets/test_template_backmatter.tex +32 -0
  123. data/test/bib.re +13 -0
  124. data/test/book_test_helper.rb +35 -0
  125. data/test/sample-book/README.md +7 -0
  126. data/test/sample-book/src/Rakefile +58 -0
  127. data/test/sample-book/src/_cover.html +3 -0
  128. data/test/sample-book/src/catalog.yml +10 -0
  129. data/test/sample-book/src/ch01.re +71 -0
  130. data/test/sample-book/src/ch02.re +3 -0
  131. data/test/sample-book/src/config.yml +186 -0
  132. data/test/sample-book/src/images/ch01-imgsample.jpg +0 -0
  133. data/test/sample-book/src/images/cover.jpg +0 -0
  134. data/test/sample-book/src/preface.re +15 -0
  135. data/test/sample-book/src/sty/jumoline.sty +310 -0
  136. data/test/sample-book/src/sty/reviewmacro.sty +39 -0
  137. data/test/sample-book/src/style.css +251 -0
  138. data/test/sample-book/src/vendor/jumoline/README +29 -0
  139. data/test/sample-book/src/vendor/jumoline/jumoline.dtx +2988 -0
  140. data/test/sample-book/src/vendor/jumoline/jumoline.ins +6 -0
  141. data/test/test.re +43 -0
  142. data/test/test_book.rb +556 -0
  143. data/test/test_book_chapter.rb +280 -0
  144. data/test/test_book_part.rb +54 -0
  145. data/test/test_builder.rb +80 -0
  146. data/test/test_catalog.rb +119 -0
  147. data/test/test_catalog_converter_cmd.rb +73 -0
  148. data/test/test_compiler.rb +92 -0
  149. data/test/test_configure.rb +50 -0
  150. data/test/test_epub3maker.rb +529 -0
  151. data/test/test_epubmaker.rb +569 -0
  152. data/test/test_epubmaker_cmd.rb +40 -0
  153. data/test/test_helper.rb +92 -0
  154. data/test/test_htmlbuilder.rb +1114 -0
  155. data/test/test_htmltoc.rb +32 -0
  156. data/test/test_htmlutils.rb +50 -0
  157. data/test/test_i18n.rb +180 -0
  158. data/test/test_idgxmlbuilder.rb +608 -0
  159. data/test/test_image_finder.rb +82 -0
  160. data/test/test_inaobuilder.rb +245 -0
  161. data/test/test_index.rb +174 -0
  162. data/test/test_latexbuilder.rb +732 -0
  163. data/test/test_lineinput.rb +182 -0
  164. data/test/test_makerhelper.rb +66 -0
  165. data/test/test_markdownbuilder.rb +125 -0
  166. data/test/test_pdfmaker.rb +171 -0
  167. data/test/test_pdfmaker_cmd.rb +40 -0
  168. data/test/test_preprocessor.rb +23 -0
  169. data/test/test_review_ext.rb +31 -0
  170. data/test/test_template.rb +26 -0
  171. data/test/test_textutils.rb +32 -0
  172. data/test/test_topbuilder.rb +291 -0
  173. data/test/test_uuid.rb +157 -0
  174. metadata +357 -0
@@ -0,0 +1,357 @@
1
+ # encoding: utf-8
2
+ #
3
+ # Copyright (c) 2012 Kenshi Muto
4
+ #
5
+ # This program is free software.
6
+ # You can distribute or modify this program under the terms of
7
+ # the GNU LGPL, Lesser General Public License version 2.1.
8
+ #
9
+ # INAO Style (experimental)
10
+
11
+ require 'review/builder'
12
+ require 'review/textutils'
13
+
14
+ module ReVIEW
15
+
16
+ class INAOBuilder < Builder
17
+
18
+ include TextUtils
19
+
20
+ def pre_paragraph
21
+ ''
22
+ end
23
+
24
+ def post_paragraph
25
+ ''
26
+ end
27
+
28
+ def extname
29
+ '.txt'
30
+ end
31
+
32
+ def builder_init_file
33
+ @noindent = nil
34
+
35
+ @titles = {
36
+ "emlist" => "list",
37
+ "list" => "list",
38
+ "cmd" => "list",
39
+ "source" => "list",
40
+ "quote" => "quote",
41
+ "column" => "column",
42
+ }
43
+ end
44
+ private :builder_init_file
45
+
46
+
47
+ def warn(msg)
48
+ $stderr.puts "#{@location.filename}:#{@location.lineno}: warning: #{msg}"
49
+ end
50
+
51
+ def error(msg)
52
+ $stderr.puts "#{@location.filename}:#{@location.lineno}: error: #{msg}"
53
+ end
54
+
55
+ def messages
56
+ error_messages() + warning_messages()
57
+ end
58
+
59
+ def base_parablock(type, lines, caption=nil)
60
+ buf = ""
61
+ buf << "◆#{@titles[type]}/◆\n"
62
+ buf << "■■■■■#{caption}\n" unless caption.nil?
63
+ buf << lines.join("")
64
+ buf << "◆/#{@titles[type]}◆\n"
65
+ buf << "\n"
66
+ buf
67
+ end
68
+
69
+ def headline(level, label, caption)
70
+ prefix = "■" * level
71
+ "#{prefix}#{caption}\n"
72
+ end
73
+
74
+ def paragraph(lines)
75
+ buf = ""
76
+ buf << " " if @noindent.nil?
77
+ @noindent = nil
78
+ buf << lines.join + "\n"
79
+ buf
80
+ end
81
+
82
+ def noindent
83
+ @noindent = true
84
+ end
85
+
86
+ def inline_b(str)
87
+ "◆b/◆#{str}◆/b◆"
88
+ end
89
+
90
+ def inline_i(str)
91
+ "◆i/◆#{str}◆/i◆"
92
+ end
93
+
94
+ def inline_tt(str)
95
+ "◆cmd/◆#{str}◆/cmd◆"
96
+ end
97
+
98
+ def inline_cmd(str)
99
+ inline_tt(str)
100
+ end
101
+
102
+ def footnote(id, str)
103
+ #
104
+ ""
105
+ end
106
+
107
+ def inline_fn(id)
108
+ "◆注/◆#{@chapter.footnote(id).content.strip}◆/注◆"
109
+ end
110
+
111
+ def inline_keytop(str)
112
+ "#{str}▲"
113
+ end
114
+
115
+ def inline_kbd(str)
116
+ inline_keytop(str)
117
+ end
118
+
119
+ # 「赤文字」はなし
120
+
121
+ def compile_ruby(base, ruby)
122
+ "◆ルビ/◆#{base}◆#{ruby}◆/ルビ◆"
123
+ end
124
+
125
+ def quote(lines)
126
+ lines_fixed = lines.map{|line| line.sub(/^ /,"")} ## インデントを消す
127
+ base_parablock "quote", lines_fixed, nil
128
+ end
129
+
130
+ def column_begin(level, label, caption)
131
+ buf = ""
132
+ buf << "◆column/◆\n"
133
+ buf << "■■■■#{caption}\n"
134
+ buf
135
+ end
136
+
137
+ def column_end(level)
138
+ "◆/column◆\n"
139
+ end
140
+
141
+ def ul_begin
142
+ ""
143
+ end
144
+
145
+ def ul_item(lines)
146
+ "・#{lines.join}\n"
147
+ end
148
+
149
+ def ul_end
150
+ ""
151
+ end
152
+
153
+ def ol_begin
154
+ @olitem = 0
155
+ ""
156
+ end
157
+
158
+ def ol_item(lines, num)
159
+ "(#{num})#{lines.join}\n"
160
+ end
161
+
162
+ def ol_end
163
+ @olitem = nil
164
+ ""
165
+ end
166
+
167
+ def inline_list(id)
168
+ chapter, id = extract_chapter_id(id)
169
+ if get_chap(chapter).nil?
170
+ %Q[リスト#{@chapter.list(id).number}]
171
+ else
172
+ %Q[リスト#{get_chap(chapter)}.#{@chapter.list(id).number}]
173
+ end
174
+ end
175
+
176
+ def list_header(id, caption, lang)
177
+ buf = "◆list/◆\n"
178
+ if get_chap.nil?
179
+ buf << %Q[●リスト#{@chapter.list(id).number} #{caption}\n]
180
+ else
181
+ buf << %Q[●リスト#{get_chap}.#{@chapter.list(id).number} #{caption}\n]
182
+ end
183
+ buf
184
+ end
185
+
186
+ def list_body(id, lines, lang)
187
+ buf = ""
188
+ lines.each do |line|
189
+ buf << detab(line) << "\n"
190
+ end
191
+ buf << "◆/list◆\n"
192
+ buf
193
+ end
194
+
195
+ def listnum_body(lines, lang)
196
+ buf = ""
197
+ lines.each_with_index do |line, i|
198
+ buf << detab((i+1).to_s.rjust(2) + " " + line) << "\n"
199
+ end
200
+ buf << "◆/list◆\n"
201
+ buf
202
+ end
203
+
204
+ def emlist(lines, caption = nil)
205
+ buf = ""
206
+ buf << "◆list/◆\n"
207
+ buf << %Q[●#{caption}\n] unless caption.nil?
208
+ lines.each do |line|
209
+ buf << detab(line) << "\n"
210
+ end
211
+ buf << "◆/list◆\n"
212
+ buf
213
+ end
214
+
215
+ # o1,o2のようなことはできない
216
+
217
+ def inline_balloon(str)
218
+ "◆comment/◆#{str}◆/comment◆"
219
+ end
220
+
221
+ def inline_comment(str)
222
+ inline_balloon(str)
223
+ end
224
+
225
+ # whiteリスト代用
226
+ def cmd(lines, caption = nil)
227
+ buf = "◆list-white/◆\n"
228
+ buf << %Q[●#{caption}\n] unless caption.nil?
229
+ lines.each do |line|
230
+ buf << detab(line) << "\n"
231
+ end
232
+ buf << "◆/list-white◆\n"
233
+ buf
234
+ end
235
+
236
+ def inline_img(id)
237
+ chapter, id = extract_chapter_id(id)
238
+ if get_chap(chapter).nil?
239
+ "図#{chapter.image(id).number}"
240
+ else
241
+ "図#{get_chap(chapter)}.#{chapter.image(id).number}"
242
+ end
243
+ end
244
+
245
+ def image(lines, id, caption, metric=nil)
246
+ buf = ""
247
+ if get_chap.nil?
248
+ buf << "●図#{@chapter.image(id).number} #{caption}\n"
249
+ else
250
+ buf << "●図#{get_chap}.#{@chapter.image(id).number} #{caption}\n"
251
+ end
252
+ if @chapter.image(id).bound?
253
+ buf << @chapter.image(id).path << "\n"
254
+ else
255
+ lines.each do |line|
256
+ buf << line + "\n"
257
+ end
258
+ end
259
+ buf
260
+ end
261
+
262
+ def inline_table(id)
263
+ chapter, id = extract_chapter_id(id)
264
+ if get_chap(chapter).nil?
265
+ "表#{chapter.table(id).number}"
266
+ else
267
+ "表#{get_chap(chapter)}.#{chapter.table(id).number}"
268
+ end
269
+ end
270
+
271
+ def table(lines, id = nil, caption = nil)
272
+ buf = ""
273
+ rows = []
274
+ sepidx = nil
275
+ lines.each_with_index do |line, idx|
276
+ if /\A[\=\-]{12}/ =~ line
277
+ # just ignore
278
+ #error "too many table separator" if sepidx
279
+ sepidx ||= idx
280
+ next
281
+ end
282
+ rows.push line.strip.split(/\t+/).map {|s| s.sub(/\A\./, '') }
283
+ end
284
+ rows = adjust_n_cols(rows)
285
+
286
+ buf << "◆table/◆\n"
287
+ begin
288
+ buf << table_header(id, caption) unless caption.nil?
289
+ rescue KeyError
290
+ error "no such table: #{id}"
291
+ end
292
+ return buf if rows.empty?
293
+ buf << table_begin(rows.first.size)
294
+ if sepidx
295
+ sepidx.times do
296
+ buf << "◆table-title◆"
297
+ buf << tr(rows.shift.map {|s| th(s) })
298
+ end
299
+ rows.each do |cols|
300
+ buf << tr(cols.map {|s| td(s) })
301
+ end
302
+ else
303
+ rows.each do |cols|
304
+ h, *cs = *cols
305
+ buf << tr([th(h)] + cs.map {|s| td(s) })
306
+ end
307
+ end
308
+ buf << table_end
309
+ buf
310
+ end
311
+
312
+ def table_header(id, caption)
313
+ if get_chap.nil?
314
+ "●表#{@chapter.table(id).number} #{caption}\n"
315
+ else
316
+ "●表#{get_chap}.#{@chapter.table(id).number} #{caption}\n"
317
+ end
318
+ end
319
+
320
+ def table_begin(ncols)
321
+ ""
322
+ end
323
+
324
+ def tr(rows)
325
+ rows.join("\t") + "\n"
326
+ end
327
+
328
+ def th(str)
329
+ str
330
+ end
331
+
332
+ def td(str)
333
+ str
334
+ end
335
+
336
+ def table_end
337
+ "◆/table◆\n"
338
+ end
339
+
340
+ def inline_raw(str)
341
+ %Q[#{super(str).gsub("\\n", "\n")}]
342
+ end
343
+
344
+ def inline_uchar(str)
345
+ [str.to_i(16)].pack("U")
346
+ end
347
+
348
+ def text(str)
349
+ str
350
+ end
351
+
352
+ def nofunc_text(str)
353
+ str
354
+ end
355
+ end
356
+
357
+ end # module ReVIEW
@@ -0,0 +1,941 @@
1
+ # encoding: utf-8
2
+ #
3
+ # Copyright (c) 2002-2007 Minero Aoki
4
+ # 2008-2009 Minero Aoki, Kenshi Muto
5
+ # 2010 Minero Aoki, Kenshi Muto, TAKAHASHI Masayoshi
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
+
13
+ require 'review/builder'
14
+ require 'review/latexutils'
15
+ require 'review/textutils'
16
+
17
+ module ReVIEW
18
+
19
+ class LATEXBuilder < Builder
20
+
21
+ include LaTeXUtils
22
+ include TextUtils
23
+
24
+ [:dtp, :hd_chap].each {|e|
25
+ Compiler.definline(e)
26
+ }
27
+
28
+ Compiler.defblock(:memo, 0..1)
29
+ Compiler.defsingle(:latextsize, 1)
30
+
31
+ def extname
32
+ '.tex'
33
+ end
34
+
35
+ def builder_init_file
36
+ @blank_needed = false
37
+ @latex_tsize = nil
38
+ @tsize = nil
39
+ @table_caption = nil
40
+ @ol_num = nil
41
+ @sec_counter = SecCounter.new(5, @chapter)
42
+ end
43
+ private :builder_init_file
44
+
45
+ def blank
46
+ @blank_needed = true
47
+ end
48
+ private :blank
49
+
50
+ def blank_reset
51
+ @blank_needed = false
52
+ end
53
+ private :blank_reset
54
+
55
+ HEADLINE = {
56
+ 1 => 'chapter',
57
+ 2 => 'section',
58
+ 3 => 'subsection',
59
+ 4 => 'subsubsection',
60
+ 5 => 'paragraph',
61
+ 6 => 'subparagraph'
62
+ }
63
+
64
+ def headline(level, label, caption)
65
+ buf = ""
66
+ _, anchor = headline_prefix(level)
67
+ headline_name = HEADLINE[level]
68
+ if @chapter.kind_of? ReVIEW::Book::Part
69
+ headline_name = "part"
70
+ end
71
+ prefix = ""
72
+ if level > @book.config["secnolevel"] || (@chapter.number.to_s.empty? && level > 1)
73
+ prefix = "*"
74
+ end
75
+ buf << macro(headline_name+prefix, caption) << "\n"
76
+ if prefix == "*" && level <= @book.config["toclevel"].to_i
77
+ buf << "\\addcontentsline{toc}{#{headline_name}}{#{caption}}\n"
78
+ end
79
+ if level == 1
80
+ buf << macro('label', chapter_label) << "\n"
81
+ else
82
+ buf << macro('label', sec_label(anchor)) << "\n"
83
+ end
84
+ buf
85
+ rescue
86
+ error "unknown level: #{level}"
87
+ end
88
+
89
+ def nonum_begin(level, label, caption)
90
+ "\n" + macro(HEADLINE[level]+"*", caption) + "\n"
91
+ end
92
+
93
+ def nonum_end(level)
94
+ end
95
+
96
+ def column_begin(level, label, caption)
97
+ buf = ""
98
+ blank
99
+ if @blank_needed
100
+ buf << "\n"
101
+ blank_reset
102
+ end
103
+ buf << "\\begin{reviewcolumn}\n"
104
+ if label
105
+ buf << "\\hypertarget{#{column_label(label)}}{}\n"
106
+ else
107
+ buf << "\\hypertarget{#{column_label(caption)}}{}\n"
108
+ end
109
+ buf << macro('reviewcolumnhead', nil, caption) << "\n"
110
+ if level <= @book.config["toclevel"].to_i
111
+ buf << "\\addcontentsline{toc}{#{HEADLINE[level]}}{#{caption}}" << "\n"
112
+ end
113
+ buf
114
+ end
115
+
116
+ def column_end(level)
117
+ buf = ""
118
+ buf << "\\end{reviewcolumn}\n"
119
+ blank
120
+ buf
121
+ end
122
+
123
+ def captionblock(type, lines, caption)
124
+ buf = ""
125
+ buf << "\\begin{reviewminicolumn}\n"
126
+ unless caption.nil?
127
+ buf << "\\reviewminicolumntitle{#{caption}}"
128
+ end
129
+
130
+ if @book.config["deprecated-blocklines"].nil?
131
+ buf << lines.join("")
132
+ else
133
+ error "deprecated-blocklines is obsoleted."
134
+ end
135
+
136
+ buf << "\\end{reviewminicolumn}\n"
137
+ buf
138
+ end
139
+
140
+ def box(lines, caption = nil)
141
+ buf = "\n"
142
+ if caption
143
+ buf << macro('reviewboxcaption', "#{caption}") << "\n"
144
+ end
145
+ buf << '\begin{reviewbox}' << "\n"
146
+ lines.each do |line|
147
+ buf << detab(line) << "\n"
148
+ end<
149
+ buf << '\end{reviewbox}' << "\n"
150
+ end
151
+
152
+ def ul_begin
153
+ buf = "\n"
154
+ buf << '\begin{itemize}' << "\n"
155
+ buf
156
+ end
157
+
158
+ def ul_item(lines)
159
+ str = lines.join
160
+ str.sub!(/\A(\[)/){'\lbrack{}'}
161
+ '\item ' + str + "\n"
162
+ end
163
+
164
+ def ul_end
165
+ '\end{itemize}' + "\n"
166
+ end
167
+
168
+ def ol_begin
169
+ buf = "\n"
170
+ buf << '\begin{enumerate}' << "\n"
171
+ if @ol_num
172
+ buf << "\\setcounter{enumi}{#{@ol_num - 1}}\n"
173
+ @ol_num = nil
174
+ end
175
+ buf
176
+ end
177
+
178
+ def ol_item(lines, num)
179
+ str = lines.join
180
+ str.sub!(/\A(\[)/){'\lbrack{}'}
181
+ '\item ' + str + "\n"
182
+ end
183
+
184
+ def ol_end
185
+ '\end{enumerate}' + "\n"
186
+ end
187
+
188
+ def dl_begin
189
+ "\n" + '\begin{description}' + "\n"
190
+ end
191
+
192
+ def dt(str)
193
+ str.sub!(/\[/){'\lbrack{}'}
194
+ str.sub!(/\]/){'\rbrack{}'}
195
+ '\item[' + str + '] \mbox{} \\\\' + "\n"
196
+ end
197
+
198
+ def dd(lines)
199
+ lines.join + "\n"
200
+ end
201
+
202
+ def dl_end
203
+ '\end{description}' + "\n"
204
+ end
205
+
206
+ def paragraph(lines)
207
+ buf = "\n"
208
+ lines.each do |line|
209
+ buf << line
210
+ end
211
+ buf << "\n"
212
+ buf
213
+ end
214
+
215
+ def parasep
216
+ '\\parasep' + "\n"
217
+ end
218
+
219
+ def read(lines)
220
+ latex_block 'quotation', lines
221
+ end
222
+
223
+ alias_method :lead, :read
224
+
225
+ def highlight_listings?
226
+ @book.config["highlight"] && @book.config["highlight"]["latex"] == "listings"
227
+ end
228
+ private :highlight_listings?
229
+
230
+ def emlist(lines, caption = nil, lang = nil)
231
+ buf = "\n"
232
+ if highlight_listings?
233
+ buf << common_code_block_lst(lines, 'reviewemlistlst', 'title', caption, lang)
234
+ else
235
+ buf << common_code_block(lines, 'reviewemlist', caption, lang) do |line, idx|
236
+ detab(line) + "\n"
237
+ end
238
+ end
239
+ buf
240
+ end
241
+
242
+ def emlistnum(lines, caption = nil, lang = nil)
243
+ buf = "\n"
244
+ if highlight_listings?
245
+ buf << common_code_block_lst(lines, 'reviewemlistnumlst', 'title', caption, lang)
246
+ else
247
+ buf << common_code_block(lines, 'reviewemlist', caption, lang) do |line, idx|
248
+ detab((idx+1).to_s.rjust(2)+": " + line) + "\n"
249
+ end
250
+ end
251
+ buf
252
+ end
253
+
254
+ ## override Builder#list
255
+ def list(lines, id, caption = nil, lang = nil)
256
+ buf = ""
257
+ if highlight_listings?
258
+ buf << common_code_block_lst(lines, 'reviewlistlst', 'caption', caption, lang)
259
+ else
260
+ begin
261
+ buf << macro('reviewlistcaption', "#{I18n.t("list")}#{I18n.t("format_number_header", [@chapter.number, @chapter.list(id).number])}#{I18n.t("caption_prefix")}#{caption}") + "\n"
262
+ rescue KeyError
263
+ error "no such list: #{id}"
264
+ end
265
+ buf << common_code_block(lines, 'reviewlist', nil, lang) do |line, idx|
266
+ detab(line) + "\n"
267
+ end
268
+ end
269
+ buf
270
+ end
271
+
272
+
273
+ ## override Builder#listnum
274
+ def listnum(lines, id, caption = nil, lang = nil)
275
+ buf = ""
276
+ if highlight_listings?
277
+ buf << common_code_block_lst(lines, 'reviewlistnumlst', 'caption', caption, lang)
278
+ else
279
+ begin
280
+ buf << macro('reviewlistcaption', "#{I18n.t("list")}#{I18n.t("format_number_header", [@chapter.number, @chapter.list(id).number])}#{I18n.t("caption_prefix")}#{caption}") + "\n"
281
+ rescue KeyError
282
+ error "no such list: #{id}"
283
+ end
284
+ buf << common_code_block(lines, 'reviewlist', caption, lang) do |line, idx|
285
+ detab((idx+1).to_s.rjust(2)+": " + line) + "\n"
286
+ end
287
+ end
288
+ buf
289
+ end
290
+
291
+ def cmd(lines, caption = nil, lang = nil)
292
+ buf = ""
293
+ if highlight_listings?
294
+ buf << common_code_block_lst(lines, 'reviewcmdlst', 'title', caption, lang)
295
+ else
296
+ buf << "\n"
297
+ buf << common_code_block(lines, 'reviewcmd', caption, lang) do |line, idx|
298
+ detab(line) + "\n"
299
+ end
300
+ end
301
+ buf
302
+ end
303
+
304
+ def common_code_block(lines, command, caption, lang)
305
+ buf = ""
306
+ if caption
307
+ buf << macro(command + 'caption', "#{caption}") + "\n"
308
+ end
309
+ body = ""
310
+ lines.each_with_index do |line, idx|
311
+ body.concat(yield(line, idx))
312
+ end
313
+ buf << macro('begin' ,command) + "\n"
314
+ buf << body
315
+ buf << macro('end' ,command) + "\n"
316
+ buf
317
+ end
318
+
319
+ def common_code_block_lst(lines, command, title, caption, lang)
320
+ buf = ""
321
+ caption_str = (caption || "")
322
+ if title == "title" && caption_str == ""
323
+ caption_str = "\\relax" ## dummy charactor to remove lstname
324
+ buf << "\\vspace{-1.5em}"
325
+ end
326
+ if @book.config["highlight"] && @book.config["highlight"]["lang"]
327
+ lexer = @book.config["highlight"]["lang"] # default setting
328
+ else
329
+ lexer = ""
330
+ end
331
+ lexer = lang if lang.present?
332
+ body = lines.inject(''){|i, j| i + detab(unescape_latex(j)) + "\n"}
333
+ buf << "\\begin{"+command+"}["+title+"={"+caption_str+"},language={"+ lexer+"}]" + "\n"
334
+ buf << body
335
+ buf << "\\end{"+ command + "}" + "\n"
336
+ buf
337
+ end
338
+
339
+ def source(lines, caption = nil, lang = nil)
340
+ if highlight_listings?
341
+ common_code_block_lst(lines, 'reviewlistlst', 'title', caption, lang)
342
+ else
343
+ buf = "\n"
344
+ buf << '\begin{reviewlist}' << "\n"
345
+ buf << source_header(caption)
346
+ buf << source_body(lines)
347
+ buf << '\end{reviewlist}' << "\n"
348
+ buf << "\n"
349
+ buf
350
+ end
351
+ end
352
+
353
+ def source_header(caption)
354
+ macro('reviewlistcaption', caption) + "\n"
355
+ end
356
+
357
+ def source_body(lines)
358
+ buf = ""
359
+ lines.each do |line|
360
+ buf << detab(line) << "\n"
361
+ end
362
+ buf
363
+ end
364
+
365
+
366
+ def image_header(id, caption)
367
+ end
368
+
369
+ def result_metric(array)
370
+ "#{array.join(',')}"
371
+ end
372
+
373
+ def image_image(id, caption, metric)
374
+ buf = ""
375
+ metrics = parse_metric("latex", metric)
376
+ # image is always bound here
377
+ buf << '\begin{reviewimage}' << "\n"
378
+ if metrics.present?
379
+ buf << "\\includegraphics[#{metrics}]{#{@chapter.image(id).path}}\n"
380
+ else
381
+ buf << "\\includegraphics[width=\\maxwidth]{#{@chapter.image(id).path}}\n"
382
+ end
383
+ if caption.present?
384
+ buf << macro('caption', caption) << "\n"
385
+ end
386
+ buf << macro('label', image_label(id)) << "\n"
387
+ buf << '\end{reviewimage}' << "\n"
388
+ buf
389
+ end
390
+
391
+ def image_dummy(id, caption, lines)
392
+ buf << '\begin{reviewdummyimage}' << "\n"
393
+ path = @chapter.image(id).path
394
+ buf << "--[[path = #{path} (#{existence(id)})]]--\n"
395
+ lines.each do |line|
396
+ buf << detab(line.rstrip) << "\n"
397
+ end
398
+ buf << macro('label', image_label(id)) << "\n"
399
+ buf << caption << "\n"
400
+ buf << '\end{reviewdummyimage}' << "\n"
401
+ buf
402
+ end
403
+
404
+ def existence(id)
405
+ @chapter.image(id).bound? ? 'exist' : 'not exist'
406
+ end
407
+ private :existence
408
+
409
+ def image_label(id, chapter=nil)
410
+ chapter ||= @chapter
411
+ "image:#{chapter.id}:#{id}"
412
+ end
413
+ private :image_label
414
+
415
+ def chapter_label
416
+ "chap:#{@chapter.id}"
417
+ end
418
+ private :chapter_label
419
+
420
+ def sec_label(sec_anchor)
421
+ "sec:#{sec_anchor}"
422
+ end
423
+ private :sec_label
424
+
425
+ def table_label(id, chapter=nil)
426
+ chapter ||= @chapter
427
+ "table:#{chapter.id}:#{id}"
428
+ end
429
+ private :table_label
430
+
431
+ def bib_label(id)
432
+ "bib:#{id}"
433
+ end
434
+ private :bib_label
435
+
436
+ def column_label(id)
437
+ filename = @chapter.id
438
+ num = @chapter.column(id).number
439
+ "column:#{filename}:#{num}"
440
+ end
441
+ private :column_label
442
+
443
+ def indepimage(id, caption=nil, metric=nil)
444
+ buf = ""
445
+ metrics = parse_metric("latex", metric)
446
+ buf << '\begin{reviewimage}' << "\n"
447
+ if metrics.present?
448
+ buf << "\\includegraphics[#{metrics}]{#{@chapter.image(id).path}}\n"
449
+ else
450
+ buf << "\\includegraphics[width=\\maxwidth]{#{@chapter.image(id).path}}\n"
451
+ end
452
+ if caption.present?
453
+ buf << macro('reviewindepimagecaption',
454
+ %Q[#{I18n.t("numberless_image")}#{I18n.t("caption_prefix")}#{caption}]) << "\n"
455
+ end
456
+ buf << '\end{reviewimage}' << "\n"
457
+ buf
458
+ end
459
+
460
+ alias_method :numberlessimage, :indepimage
461
+
462
+ def table(lines, id = nil, caption = nil)
463
+ buf = ""
464
+ rows = []
465
+ sepidx = nil
466
+ lines.each_with_index do |line, idx|
467
+ if /\A[\=\{\-\}]{12}/ =~ line
468
+ # just ignore
469
+ #error "too many table separator" if sepidx
470
+ sepidx ||= idx
471
+ next
472
+ end
473
+ rows.push line.strip.split(/\t+/).map {|s| s.sub(/\A\./, '') }
474
+ end
475
+ rows = adjust_n_cols(rows)
476
+
477
+ begin
478
+ buf << table_header(id, caption) unless caption.nil?
479
+ rescue KeyError
480
+ error "no such table: #{id}"
481
+ end
482
+ return buf if rows.empty?
483
+ buf << table_begin(rows.first.size)
484
+ if sepidx
485
+ sepidx.times do
486
+ buf << tr(rows.shift.map {|s| th(s) })
487
+ end
488
+ rows.each do |cols|
489
+ buf << tr(cols.map {|s| td(s) })
490
+ end
491
+ else
492
+ rows.each do |cols|
493
+ h, *cs = *cols
494
+ buf << tr([th(h)] + cs.map {|s| td(s) })
495
+ end
496
+ end
497
+ buf << table_end
498
+ buf
499
+ end
500
+
501
+ def table_header(id, caption)
502
+ buf = ""
503
+ if caption.present?
504
+ @table_caption = true
505
+ buf << '\begin{table}[h]' << "\n"
506
+ buf << macro('reviewtablecaption', caption) << "\n"
507
+ end
508
+ buf << macro('label', table_label(id)) << "\n"
509
+ buf
510
+ end
511
+
512
+ def table_begin(ncols)
513
+ buf = ""
514
+ if @latex_tsize
515
+ buf << macro('begin', 'reviewtable', @latex_tsize) << "\n"
516
+ elsif @tsize
517
+ cellwidth = @tsize.split(/\s*,\s*/)
518
+ buf << macro('begin', 'reviewtable', '|'+(cellwidth.collect{|i| "p{#{i}mm}"}.join('|'))+'|') << "\n"
519
+ else
520
+ buf << macro('begin', 'reviewtable', (['|'] * (ncols + 1)).join('l')) << "\n"
521
+ end
522
+ buf << '\hline' << "\n"
523
+ @tsize = nil
524
+ @latex_tsize = nil
525
+ buf
526
+ end
527
+
528
+ def table_separator
529
+ #puts '\hline'
530
+ end
531
+
532
+ def th(s)
533
+ ## use shortstack for @<br>
534
+ if /\\\\/i =~ s
535
+ macro('reviewth', macro('shortstack[l]', s))
536
+ else
537
+ macro('reviewth', s)
538
+ end
539
+ end
540
+
541
+ def td(s)
542
+ ## use shortstack for @<br>
543
+ if /\\\\/ =~ s
544
+ macro('shortstack[l]', s)
545
+ else
546
+ s
547
+ end
548
+ end
549
+
550
+ def tr(rows)
551
+ buf = ""
552
+ buf << rows.join(' & ') << "\n"
553
+ buf << ' \\\\ \hline' << "\n"
554
+ buf
555
+ end
556
+
557
+ def table_end
558
+ buf = ""
559
+ buf << macro('end', 'reviewtable') << "\n"
560
+ if @table_caption
561
+ buf << '\end{table}' << "\n"
562
+ end
563
+ @table_caption = nil
564
+ buf << "\n"
565
+ buf
566
+ end
567
+
568
+ def quote(lines)
569
+ latex_block 'quote', lines
570
+ end
571
+
572
+ def center(lines)
573
+ latex_block 'center', lines
574
+ end
575
+
576
+ alias_method :centering, :center
577
+
578
+ def flushright(lines)
579
+ latex_block 'flushright', lines
580
+ end
581
+
582
+ def texequation(lines)
583
+ buf = "\n"
584
+ buf << macro('begin','equation*') << "\n"
585
+ lines.each do |line|
586
+ buf << unescape_latex(line) << "\n"
587
+ end
588
+ buf << macro('end', 'equation*') << "\n"
589
+ buf << "\n"
590
+ buf
591
+ end
592
+
593
+ def latex_block(type, lines)
594
+ buf = "\n"
595
+ buf << macro('begin', type)
596
+ if @book.config["deprecated-blocklines"].nil?
597
+ buf << lines.join("")
598
+ else
599
+ error "deprecated-blocklines is obsoleted."
600
+ end
601
+ buf << macro('end', type) << "\n"
602
+ buf
603
+ end
604
+ private :latex_block
605
+
606
+ def direct(lines, fmt)
607
+ buf = ""
608
+ return buf unless fmt == 'latex'
609
+ lines.each do |line|
610
+ buf << line << "\n"
611
+ end
612
+ buf
613
+ end
614
+
615
+ def comment(lines, comment = nil)
616
+ buf = ""
617
+ lines ||= []
618
+ lines.unshift comment unless comment.blank?
619
+ if @book.config["draft"]
620
+ str = lines.join("")
621
+ buf << macro('pdfcomment', str) << "\n"
622
+ end
623
+ buf
624
+ end
625
+
626
+ def hr
627
+ '\hrule' + "\n"
628
+ end
629
+
630
+ def label(id)
631
+ macro('label', id) + "\n"
632
+ end
633
+
634
+ def node_label(node)
635
+ id = node.args[0].to_raw
636
+ macro('label', id) + "\n"
637
+ end
638
+
639
+ def pagebreak
640
+ '\pagebreak' + "\n"
641
+ end
642
+
643
+ def linebreak
644
+ '\\\\' + "\n"
645
+ end
646
+
647
+ def noindent
648
+ '\noindent'
649
+ end
650
+
651
+ def inline_chapref(id)
652
+ title = super
653
+ if @book.config["chapterlink"]
654
+ "\\hyperref[chap:#{id}]{#{title}}"
655
+ else
656
+ title
657
+ end
658
+ rescue KeyError
659
+ error "unknown chapter: #{id}"
660
+ nofunc_text("[UnknownChapter:#{id}]")
661
+ end
662
+
663
+ def inline_chap(id)
664
+ if @book.config["chapterlink"]
665
+ "\\hyperref[chap:#{id}]{#{@book.chapter_index.number(id)}}"
666
+ else
667
+ @book.chapter_index.number(id)
668
+ end
669
+ rescue KeyError
670
+ error "unknown chapter: #{id}"
671
+ nofunc_text("[UnknownChapter:#{id}]")
672
+ end
673
+
674
+ def inline_title(id)
675
+ title = super
676
+ if @book.config["chapterlink"]
677
+ "\\hyperref[chap:#{id}]{#{title}}"
678
+ else
679
+ title
680
+ end
681
+ rescue KeyError
682
+ error "unknown chapter: #{id}"
683
+ nofunc_text("[UnknownChapter:#{id}]")
684
+ end
685
+
686
+
687
+ # FIXME: use TeX native label/ref.
688
+ def node_inline_list(node)
689
+ id = node[0].to_raw
690
+ chapter, id = extract_chapter_id(id)
691
+ macro('reviewlistref', "#{chapter.number}.#{chapter.list(id).number}")
692
+ end
693
+
694
+ def inline_table(id)
695
+ chapter, id = extract_chapter_id(id)
696
+ macro('reviewtableref', "#{chapter.number}.#{chapter.table(id).number}", table_label(id, chapter))
697
+ end
698
+
699
+ def inline_img(id)
700
+ chapter, id = extract_chapter_id(id)
701
+ macro('reviewimageref', "#{chapter.number}.#{chapter.image(id).number}", image_label(id, chapter))
702
+ end
703
+
704
+ def footnote(id, content)
705
+ if @book.config["footnotetext"]
706
+ macro("footnotetext[#{@chapter.footnote(id).number}]",
707
+ content.strip) + "\n"
708
+ end
709
+ end
710
+
711
+ def node_inline_fn(node)
712
+ id = node[0].to_raw
713
+ if @book.config["footnotetext"]
714
+ macro("footnotemark[#{@chapter.footnote(id).number}]", "")
715
+ else
716
+ macro('footnote', escape(@chapter.footnote(id).content.strip))
717
+ end
718
+ end
719
+
720
+ BOUTEN = "・"
721
+
722
+ def inline_bou(str)
723
+ str.split(//).map {|c| macro('ruby', escape(c), macro('textgt', BOUTEN)) }.join('\allowbreak')
724
+ end
725
+
726
+ def compile_ruby(base, ruby)
727
+ macro('ruby', base, ruby)
728
+ end
729
+
730
+ # math
731
+ # def inline_m(str)
732
+ # " $#{str}$ "
733
+ # end
734
+
735
+ def node_inline_m(node)
736
+ " $#{node[0].to_raw}$ "
737
+ end
738
+
739
+ # hidden index
740
+ def inline_hi(str)
741
+ index(str)
742
+ end
743
+
744
+ # index -> italic
745
+ def inline_i(str)
746
+ macro('textit', str)
747
+ end
748
+
749
+ # index
750
+ def inline_idx(str)
751
+ escape(str) + index(str)
752
+ end
753
+
754
+ def node_inline_idx(nodelist)
755
+ content = nodelist[0].to_raw
756
+ escape(content) + index(content)
757
+ end
758
+
759
+ # hidden index??
760
+ def inline_hidx(str)
761
+ index(str)
762
+ end
763
+
764
+ def node_inline_hidx(nodelist)
765
+ content = nodelist[0].to_raw
766
+ index(content)
767
+ end
768
+
769
+ # bold
770
+ def inline_b(str)
771
+ macro('textbf', str)
772
+ end
773
+
774
+ # line break
775
+ def inline_br(str)
776
+ "\\\\\n"
777
+ end
778
+
779
+ def inline_dtp(str)
780
+ # ignore
781
+ ""
782
+ end
783
+
784
+ ## @<code> is same as @<tt>
785
+ def inline_code(str)
786
+ macro('texttt', str)
787
+ end
788
+
789
+ def nofunc_text(str)
790
+ escape(str)
791
+ end
792
+
793
+ def inline_tt(str)
794
+ macro('texttt', str)
795
+ end
796
+
797
+ def inline_del(str)
798
+ macro('reviewstrike', str)
799
+ end
800
+
801
+ def inline_tti(str)
802
+ macro('texttt', macro('textit', str))
803
+ end
804
+
805
+ def inline_ttb(str)
806
+ macro('texttt', macro('textbf', str))
807
+ end
808
+
809
+ def inline_bib(id)
810
+ macro('reviewbibref', "[#{@chapter.bibpaper(id).number}]", bib_label(id))
811
+ end
812
+
813
+ def inline_hd_chap(chap, id)
814
+ n = chap.headline_index.number(id)
815
+ if chap.number and @book.config["secnolevel"] >= n.split('.').size
816
+ str = I18n.t("chapter_quote", "#{chap.headline_index.number(id)} #{chap.headline(id).caption}")
817
+ else
818
+ str = I18n.t("chapter_quote", chap.headline(id).caption)
819
+ end
820
+ if @book.config["chapterlink"]
821
+ anchor = n.gsub(/\./, "-")
822
+ macro('reviewsecref', escape(str), sec_label(anchor))
823
+ else
824
+ escape(str)
825
+ end
826
+ end
827
+
828
+ def inline_column(id)
829
+ macro('reviewcolumnref', "#{@chapter.column(id).caption}", column_label(id))
830
+ end
831
+
832
+ def inline_raw(str)
833
+ super(str)
834
+ end
835
+
836
+ def inline_sub(str)
837
+ macro('textsubscript', str)
838
+ end
839
+
840
+ def inline_sup(str)
841
+ macro('textsuperscript', str)
842
+ end
843
+
844
+ def inline_em(str)
845
+ macro('reviewem', str)
846
+ end
847
+
848
+ def inline_strong(str)
849
+ macro('reviewstrong', str)
850
+ end
851
+
852
+ def inline_u(str)
853
+ macro('Underline', str)
854
+ end
855
+
856
+ def inline_ami(str)
857
+ macro('reviewami', str)
858
+ end
859
+
860
+ def inline_icon(id)
861
+ macro('includegraphics', @chapter.image(id).path)
862
+ end
863
+
864
+ def inline_uchar(str)
865
+ # with otf package
866
+ macro('UTF', str)
867
+ end
868
+
869
+ def inline_comment(str)
870
+ if @book.config["draft"]
871
+ macro('pdfcomment', escape(str))
872
+ else
873
+ ""
874
+ end
875
+ end
876
+
877
+ def bibpaper(lines, id, caption)
878
+ buf = ""
879
+ buf << bibpaper_header(id, caption)
880
+ if lines.empty?
881
+ buf << "\n"
882
+ else
883
+ buf << "\n"
884
+ buf << bibpaper_bibpaper(id, caption, lines)
885
+ end
886
+ buf << "\n"
887
+ buf
888
+ end
889
+
890
+ def bibpaper_header(id, caption)
891
+ "[#{@chapter.bibpaper(id).number}] #{caption}\n" +
892
+ macro('label', bib_label(id))
893
+ end
894
+
895
+ def bibpaper_bibpaper(id, caption, lines)
896
+ lines.join("")
897
+ end
898
+
899
+ def index(str)
900
+ "\\index{" + str + "}"
901
+ end
902
+
903
+ def compile_kw(word, alt)
904
+ if alt
905
+ macro('reviewkw', word) + "(#{alt.strip})"
906
+ else
907
+ macro('reviewkw', word)
908
+ end
909
+ end
910
+
911
+ def compile_href(url, label)
912
+ if /\A[a-z]+:/ =~ url
913
+ if label
914
+ macro("href", escape_url(url), label)
915
+ else
916
+ macro("url", escape_url(url))
917
+ end
918
+ else
919
+ macro("ref", url)
920
+ end
921
+ end
922
+
923
+ def tsize(str)
924
+ @tsize = str
925
+ end
926
+
927
+ def latextsize(str)
928
+ @latex_tsize = str
929
+ end
930
+
931
+ def image_ext
932
+ "pdf"
933
+ end
934
+
935
+ def olnum(num)
936
+ @ol_num = num.to_i
937
+ end
938
+
939
+ end
940
+
941
+ end