review 0.9.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/.travis.yml +9 -0
  2. data/ChangeLog +326 -0
  3. data/Rakefile +3 -5
  4. data/VERSION +1 -1
  5. data/bin/review-compile +50 -50
  6. data/bin/review-epubmaker +62 -75
  7. data/bin/review-epubmaker-ng +185 -0
  8. data/bin/review-index +2 -1
  9. data/bin/review-pdfmaker +158 -101
  10. data/bin/review-vol +6 -2
  11. data/doc/format.rdoc +111 -46
  12. data/doc/libepubmaker/sample.yaml +90 -0
  13. data/doc/quickstart.rdoc +188 -0
  14. data/doc/sample.yaml +8 -0
  15. data/lib/epubmaker.rb +28 -0
  16. data/lib/epubmaker/content.rb +82 -0
  17. data/lib/epubmaker/epubv2.rb +419 -0
  18. data/lib/epubmaker/epubv3.rb +249 -0
  19. data/lib/epubmaker/producer.rb +204 -0
  20. data/lib/epubmaker/resource.rb +66 -0
  21. data/lib/review.rb +1 -1
  22. data/lib/review/book.rb +27 -4
  23. data/lib/review/builder.rb +153 -20
  24. data/lib/review/compiler.rb +61 -10
  25. data/lib/review/ewbbuilder.rb +3 -2
  26. data/lib/review/htmlbuilder.rb +174 -67
  27. data/lib/review/i18n.rb +30 -0
  28. data/lib/review/i18n.yaml +23 -0
  29. data/lib/review/idgxmlbuilder.rb +110 -63
  30. data/lib/review/index.rb +34 -12
  31. data/lib/review/latexbuilder.rb +128 -33
  32. data/lib/review/latexutils.rb +18 -1
  33. data/lib/review/textbuilder.rb +17 -0
  34. data/lib/review/tocparser.rb +3 -1
  35. data/lib/review/tocprinter.rb +1 -0
  36. data/lib/review/topbuilder.rb +397 -198
  37. data/review.gemspec +101 -100
  38. data/test/test_book.rb +27 -0
  39. data/test/test_epubmaker.rb +507 -0
  40. data/test/test_helper.rb +8 -0
  41. data/test/test_htmlbuilder.rb +295 -10
  42. data/test/test_i18n.rb +64 -0
  43. data/test/test_idgxmlbuilder.rb +268 -10
  44. data/test/test_latexbuilder.rb +316 -20
  45. data/test/test_preprocessor.rb +23 -0
  46. data/test/test_topbuilder.rb +246 -0
  47. metadata +46 -53
  48. data/doc/format.re +0 -505
  49. data/test/test_index.rb +0 -15
@@ -21,7 +21,7 @@ module ReVIEW
21
21
  include LaTeXUtils
22
22
  include TextUtils
23
23
 
24
- [:icon, :dtp, :hd_chap].each {|e|
24
+ [:dtp, :hd_chap].each {|e|
25
25
  Compiler.definline(e)
26
26
  }
27
27
 
@@ -73,11 +73,14 @@ module ReVIEW
73
73
 
74
74
  def headline(level, label, caption)
75
75
  prefix = ""
76
- if level > ReVIEW.book.param["secnolevel"]
76
+ if level > ReVIEW.book.param["secnolevel"] || (@chapter.number.to_s.empty? && level > 1)
77
77
  prefix = "*"
78
78
  end
79
79
  blank unless @output.pos == 0
80
80
  puts macro(HEADLINE[level]+prefix, compile_inline(caption))
81
+ if level == 1
82
+ puts macro('label', chapter_label)
83
+ end
81
84
  end
82
85
 
83
86
  def nonum_begin(level, label, caption)
@@ -90,7 +93,7 @@ module ReVIEW
90
93
 
91
94
  def column_begin(level, label, caption)
92
95
  blank
93
- ## puts '\vspace{2zw}'
96
+ ## puts '\vspace{2zw}'
94
97
  ## puts '\begin{center}'
95
98
  ## puts '\begin{minipage}{1.0\linewidth}'
96
99
  ## puts '\begin{framed}'
@@ -112,19 +115,22 @@ module ReVIEW
112
115
  blank
113
116
  end
114
117
 
115
- def minicolumn(type, lines, caption)
118
+ def captionblock(type, lines, caption)
116
119
  puts "\\begin{reviewminicolumn}\n"
117
120
  unless caption.nil?
118
121
  puts "\\reviewminicolumntitle{#{compile_inline(caption)}}\n"
119
122
  end
120
- lines.each {|l|
121
- puts l
122
- }
123
- puts "\\end{reviewminicolumn}\n"
124
- end
125
123
 
126
- def memo(lines, caption = nil)
127
- minicolumn("memo", lines, caption)
124
+ if ReVIEW.book.param["deprecated-blocklines"].nil?
125
+ blocked_lines = split_paragraph(lines)
126
+ puts blocked_lines.join("\n\n")
127
+ else
128
+ lines.each do |line|
129
+ puts line
130
+ end
131
+ end
132
+
133
+ puts "\\end{reviewminicolumn}\n"
128
134
  end
129
135
 
130
136
  def ul_begin
@@ -133,7 +139,7 @@ module ReVIEW
133
139
  end
134
140
 
135
141
  def ul_item(lines)
136
- puts '\item ' + lines.join("\n")
142
+ puts '\item ' + lines.join
137
143
  end
138
144
 
139
145
  def ul_end
@@ -147,7 +153,7 @@ module ReVIEW
147
153
  end
148
154
 
149
155
  def ol_item(lines, num)
150
- puts '\item ' + lines.join("\n")
156
+ puts '\item ' + lines.join
151
157
  end
152
158
 
153
159
  def ol_end
@@ -165,9 +171,7 @@ module ReVIEW
165
171
  end
166
172
 
167
173
  def dd(lines)
168
- lines.each do |line|
169
- puts line
170
- end
174
+ puts lines.join
171
175
  end
172
176
 
173
177
  def dl_end
@@ -193,8 +197,11 @@ module ReVIEW
193
197
 
194
198
  alias lead read
195
199
 
196
- def emlist(lines)
200
+ def emlist(lines, caption = nil)
197
201
  blank
202
+ if caption
203
+ puts macro('reviewemlistcaption', "#{compile_inline(caption)}")
204
+ end
198
205
  puts '\begin{reviewemlist}'
199
206
  puts '\begin{alltt}'
200
207
  lines.each do |line|
@@ -205,8 +212,11 @@ module ReVIEW
205
212
  blank
206
213
  end
207
214
 
208
- def emlistnum(lines)
215
+ def emlistnum(lines, caption = nil)
209
216
  blank
217
+ if caption
218
+ puts macro('reviewemlistcaption', "#{compile_inline(caption)}")
219
+ end
210
220
  puts '\begin{reviewemlist}'
211
221
  puts '\begin{alltt}'
212
222
  lines.each_with_index do |line, i|
@@ -225,12 +235,15 @@ module ReVIEW
225
235
  end
226
236
  puts '\end{alltt}'
227
237
  puts '\end{reviewlist}'
228
- puts
238
+ blank
229
239
 
230
240
  end
231
241
 
232
- def cmd(lines)
242
+ def cmd(lines, caption = nil)
233
243
  blank
244
+ if caption
245
+ puts macro('reviewcmdcaption', "#{compile_inline(caption)}")
246
+ end
234
247
  puts '\begin{reviewcmd}'
235
248
  puts '\begin{alltt}'
236
249
  lines.each do |line|
@@ -242,7 +255,7 @@ module ReVIEW
242
255
  end
243
256
 
244
257
  def list_header(id, caption)
245
- puts macro('reviewlistcaption', "リスト#{@chapter.number}.#{@chapter.list(id).number}: #{compile_inline(caption)}")
258
+ puts macro('reviewlistcaption', "#{I18n.t("list")}#{I18n.t("format_number_header", [@chapter.number, @chapter.list(id).number])} #{compile_inline(caption)}")
246
259
  end
247
260
 
248
261
  def list_body(lines)
@@ -280,13 +293,18 @@ module ReVIEW
280
293
  def image_header(id, caption)
281
294
  end
282
295
 
296
+ def result_metric(array)
297
+ "#{array.join(',')}"
298
+ end
299
+
283
300
  def image_image(id, caption, metric)
301
+ metrics = parse_metric("latex", metric)
284
302
  # image is always bound here
285
303
  puts '\begin{reviewimage}'
286
- if metric
287
- puts "\\includegraphics[#{metric}]{#{@chapter.image(id).path}}"
304
+ if !metrics.empty?
305
+ puts "\\includegraphics[#{metrics}]{#{@chapter.image(id).path}}"
288
306
  else
289
- puts macro('includegraphics', @chapter.image(id).path)
307
+ puts "\\includegraphics[width=\\maxwidth]{#{@chapter.image(id).path}}"
290
308
  end
291
309
  puts macro('label', image_label(id))
292
310
  if !caption.empty?
@@ -319,12 +337,18 @@ module ReVIEW
319
337
  end
320
338
  private :image_label
321
339
 
340
+ def chapter_label()
341
+ "chap:#{@chapter.id}"
342
+ end
343
+ private :chapter_label
344
+
322
345
  def indepimage(id, caption=nil, metric=nil)
346
+ metrics = parse_metric("latex", metric)
323
347
  puts '\begin{reviewimage}'
324
- if metric
325
- puts "\\includegraphics[#{metric}]{#{@chapter.image(id).path}}"
348
+ if !metrics.empty?
349
+ puts "\\includegraphics[#{metrics}]{#{@chapter.image(id).path}}"
326
350
  else
327
- puts macro('includegraphics', @chapter.image(id).path)
351
+ puts "\\includegraphics[width=\\maxwidth]{#{@chapter.image(id).path}}"
328
352
  end
329
353
  if !caption.nil? && !caption.empty?
330
354
  puts macro('caption', compile_inline(caption))
@@ -439,7 +463,9 @@ module ReVIEW
439
463
  end
440
464
 
441
465
  def comment(str)
442
- puts "% #{str}"
466
+ if ReVIEW.book.param["draft"]
467
+ puts macro('pdfcomment', escape(str))
468
+ end
443
469
  end
444
470
 
445
471
  def label(id)
@@ -455,9 +481,43 @@ module ReVIEW
455
481
  end
456
482
 
457
483
  def noindent
458
- puts '\noindent'
484
+ print '\noindent'
485
+ end
486
+
487
+ def inline_chapref(id)
488
+ if ReVIEW.book.param["chapterlink"]
489
+ "\\hyperref[chap:#{id}]{#{@chapter.env.chapter_index.display_string(id)}}"
490
+ else
491
+ @chapter.env.chapter_index.display_string(id)
492
+ end
493
+ rescue KeyError
494
+ error "unknown chapter: #{id}"
495
+ nofunc_text("[UnknownChapter:#{id}]")
459
496
  end
460
497
 
498
+ def inline_chap(id)
499
+ if ReVIEW.book.param["chapterlink"]
500
+ "\\hyperref[chap:#{id}]{#{@chapter.env.chapter_index.number(id)}}"
501
+ else
502
+ @chapter.env.chapter_index.number(id)
503
+ end
504
+ rescue KeyError
505
+ error "unknown chapter: #{id}"
506
+ nofunc_text("[UnknownChapter:#{id}]")
507
+ end
508
+
509
+ def inline_title(id)
510
+ if ReVIEW.book.param["chapterlink"]
511
+ "\\hyperref[chap:#{id}]{#{@chapter.env.chapter_index.title(id)}}"
512
+ else
513
+ @chapter.env.chapter_index.title(id)
514
+ end
515
+ rescue KeyError
516
+ error "unknown chapter: #{id}"
517
+ nofunc_text("[UnknownChapter:#{id}]")
518
+ end
519
+
520
+
461
521
  # FIXME: use TeX native label/ref.
462
522
  def inline_list(id)
463
523
  chapter, id = extract_chapter_id(id)
@@ -475,10 +535,18 @@ module ReVIEW
475
535
  end
476
536
 
477
537
  def footnote(id, content)
538
+ if ReVIEW.book.param["footnotetext"]
539
+ puts macro("footnotetext[#{@chapter.footnote(id).number}]",
540
+ compile_inline(content.strip))
541
+ end
478
542
  end
479
543
 
480
544
  def inline_fn(id)
481
- macro('footnote', compile_inline(@chapter.footnote(id).content.strip))
545
+ if ReVIEW.book.param["footnotetext"]
546
+ macro("footnotemark[#{@chapter.footnote(id).number}]", "")
547
+ else
548
+ macro('footnote', compile_inline(@chapter.footnote(id).content.strip))
549
+ end
482
550
  end
483
551
 
484
552
  BOUTEN = "・"
@@ -554,12 +622,16 @@ module ReVIEW
554
622
  macro('texttt', macro('textbf', escape(str)))
555
623
  end
556
624
 
625
+ def inline_bib(id)
626
+ "[#{@chapter.bibpaper(id).number}]"
627
+ end
628
+
557
629
  def inline_hd_chap(chap, id)
558
630
  "「#{chap.headline_index.number(id)} #{chap.headline(id).caption}」"
559
631
  end
560
632
 
561
633
  def inline_raw(str)
562
- escape(str)
634
+ super(str)
563
635
  end
564
636
 
565
637
  def inline_sub(str)
@@ -591,6 +663,22 @@ module ReVIEW
591
663
  macro('UTF', escape(str))
592
664
  end
593
665
 
666
+ def inline_comment(str)
667
+ if ReVIEW.book.param["draft"]
668
+ macro('pdfcomment', escape(str))
669
+ end
670
+ end
671
+
672
+ def bibpaper_header(id, caption)
673
+ puts "[#{@chapter.bibpaper(id).number}] #{compile_inline(caption)}"
674
+ end
675
+
676
+ def bibpaper_bibpaper(id, caption, lines)
677
+ lines.each do |line|
678
+ puts detab(line)
679
+ end
680
+ end
681
+
594
682
  def index(str)
595
683
  str.sub!(/\(\)/, '')
596
684
  decl = ''
@@ -618,9 +706,12 @@ module ReVIEW
618
706
  end
619
707
 
620
708
  def compile_href(url, label)
621
- label ||= url
622
709
  if /\A[a-z]+:\/\// =~ url
623
- macro("href", url, escape(label))
710
+ if label
711
+ macro("href", escape_url(url), escape(label))
712
+ else
713
+ macro("url", escape_url(url))
714
+ end
624
715
  else
625
716
  macro("ref", url)
626
717
  end
@@ -634,6 +725,10 @@ module ReVIEW
634
725
  @latex_tsize = str
635
726
  end
636
727
 
728
+ def image_ext
729
+ "svg"
730
+ end
731
+
637
732
  end
638
733
 
639
734
  end
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  #
2
3
  # $Id: latexutils.rb 2204 2006-03-18 06:10:26Z aamine $
3
4
  #
@@ -26,7 +27,19 @@ module ReVIEW
26
27
  '|' => '\textbar{}',
27
28
  '<' => '\textless{}',
28
29
  '>' => '\textgreater{}',
29
- "\\" => '\reviewbackslash{}'
30
+ "\\" => '\reviewbackslash{}',
31
+
32
+ '⓪' => '\UTF{24EA}',
33
+ '①' => '\UTF{2460}',
34
+ '②' => '\UTF{2461}',
35
+ '③' => '\UTF{2462}',
36
+ '④' => '\UTF{2463}',
37
+ '⑤' => '\UTF{2464}',
38
+ '⑥' => '\UTF{2465}',
39
+ '⑦' => '\UTF{2466}',
40
+ '⑧' => '\UTF{2467}',
41
+ '⑨' => '\UTF{2468}',
42
+ '⑩' => '\UTF{2469}',
30
43
  }
31
44
 
32
45
  METACHARS_RE = /[#{Regexp.escape(MATACHARS.keys.join(''))}]/
@@ -52,6 +65,10 @@ module ReVIEW
52
65
  str.gsub(/[@!|"]/) {|s| '"' + s }
53
66
  end
54
67
 
68
+ def escape_url(str)
69
+ str.gsub(/[\#%]/) {|s| '\\'+s }
70
+ end
71
+
55
72
  def macro(name, *args)
56
73
  "\\#{name}" + args.map {|a| "{#{a}}" }.join('')
57
74
  end
@@ -0,0 +1,17 @@
1
+ # textbuilder.rb
2
+ #
3
+ # Copyright (c) 2010 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
+
10
+ require 'review/topbuilder'
11
+
12
+ module ReVIEW
13
+
14
+ class TEXTBuilder < TOPBuilder
15
+ end
16
+
17
+ end # module ReVIEW
@@ -34,6 +34,7 @@ module ReVIEW
34
34
  path = []
35
35
 
36
36
  while line = f.gets
37
+ line.sub!(/\A\xEF\xBB\xBF/, '') # remove BOM
37
38
  case line
38
39
  when /\A\s*\z/
39
40
  ;
@@ -45,6 +46,7 @@ module ReVIEW
45
46
  path.push Chapter.new(get_label(line), id, filename)
46
47
  roots.push path.first
47
48
  end
49
+ next if get_label(line) =~ /\A\[\// # ex) "[/column]"
48
50
  new = Section.new(lev, get_label(line))
49
51
  until path.last.level < new.level
50
52
  path.pop
@@ -324,7 +326,7 @@ module ReVIEW
324
326
  def toc
325
327
  @toc ||= TOCParser.parse(self)
326
328
  unless @toc.size == 1
327
- $stderr.puts "warning: chapter #{title} contains more than 1 chapter"
329
+ $stderr.puts "warning: chapter #{@toc.join} contains more than 1 chapter"
328
330
  end
329
331
  @toc.first
330
332
  end
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  #
2
3
  # $Id: tocprinter.rb 4309 2009-07-19 04:15:02Z aamine $
3
4
  #
@@ -1,7 +1,7 @@
1
- # $Id: topbuilder.rb 4304 2009-07-01 12:03:39Z kmuto $
1
+ # encoding: utf-8
2
2
  #
3
3
  # Copyright (c) 2002-2006 Minero Aoki
4
- # 2008-2009 Minero Aoki, Kenshi Muto
4
+ # 2008-2010 Minero Aoki, Kenshi Muto
5
5
  #
6
6
  # This program is free software.
7
7
  # You can distribute or modify this program under the terms of
@@ -17,18 +17,12 @@ module ReVIEW
17
17
 
18
18
  include TextUtils
19
19
 
20
- [:i, :tt, :ttbold, :tti, :idx, :hidx, :dtp, :sup, :sub, :hint, :raw, :maru, :keytop, :labelref, :ref, :pageref, :u, :icon, :balloon].each {|e|
20
+ [:ttbold, :hint, :maru, :keytop, :labelref, :ref, :pageref, :balloon].each {|e|
21
21
  Compiler.definline(e)
22
22
  }
23
23
  Compiler.defsingle(:dtp, 1)
24
- Compiler.defsingle(:raw, 1)
25
- Compiler.defsingle(:indepimage, 1)
26
- Compiler.defsingle(:label, 1)
27
- Compiler.defsingle(:tsize, 1)
28
24
 
29
25
  Compiler.defblock(:insn, 1)
30
- Compiler.defblock(:flushright, 0)
31
- Compiler.defblock(:note, 0..1)
32
26
  Compiler.defblock(:memo, 0..1)
33
27
  Compiler.defblock(:tip, 0..1)
34
28
  Compiler.defblock(:info, 0..1)
@@ -43,12 +37,67 @@ module ReVIEW
43
37
  Compiler.defblock(:term, 0)
44
38
  Compiler.defblock(:practice, 0)
45
39
  Compiler.defblock(:expert, 0)
46
- Compiler.defblock(:lead, 0)
40
+
41
+ def pre_paragraph
42
+ ''
43
+ end
44
+
45
+ def post_paragraph
46
+ ''
47
+ end
48
+
49
+ def extname
50
+ '.txt'
51
+ end
47
52
 
48
53
  def builder_init_file
49
54
  @section = 0
55
+ @subsection = 0
56
+ @subsubsection = 0
57
+ @subsubsubsection = 0
50
58
  @blank_seen = true
51
- @choice = nil
59
+
60
+ @titles = {
61
+ "emlist" => "インラインリスト",
62
+ "cmd" => "コマンド",
63
+ "quote" => "引用",
64
+ "flushright" => "右寄せ",
65
+ "note" => "ノート",
66
+ "memo" => "メモ",
67
+ "important" => "重要",
68
+ "info" => "情報",
69
+ "planning" => "プランニング",
70
+ "shoot" => "トラブルシュート",
71
+ "term" => "用語解説",
72
+ "notice" => "注意",
73
+ "caution" => "警告",
74
+ "point" => "ここがポイント",
75
+ "reference" => "参考",
76
+ "link" => "リンク",
77
+ "best" => "ベストプラクティス",
78
+ "practice" => "練習問題",
79
+ "security" => "セキュリティ",
80
+ "expert" => "エキスパートに訊け",
81
+ "tip" => "TIP",
82
+ "box" => "書式",
83
+ "insn" => "書式",
84
+ "column" => "コラム",
85
+ "xcolumn" => "コラムパターン2",
86
+ "world" => "Worldコラム",
87
+ "hood" => "Under The Hoodコラム",
88
+ "edition" => "Editionコラム",
89
+ "insideout" => "InSideOutコラム",
90
+ "ref" => "参照",
91
+ "sup" => "補足",
92
+ "read" => "リード",
93
+ "lead" => "リード",
94
+ "list" => "リスト",
95
+ "image" => "図",
96
+ "texequation" => "TeX式",
97
+ "table" => "表",
98
+ "bpo" => "bpo",
99
+ "source" => "ソースコードリスト",
100
+ }
52
101
  end
53
102
  private :builder_init_file
54
103
 
@@ -87,33 +136,42 @@ module ReVIEW
87
136
  end
88
137
 
89
138
  def headline(level, label, caption)
90
- # FIXME: handling label
139
+ prefix = ""
91
140
  blank
92
141
  case level
93
142
  when 1
94
- puts "■H1■第#{@chapter.number}章 #{caption}"
143
+ if @chapter.number.to_s =~ /\A\d+\Z/
144
+ prefix = "第#{@chapter.number}章 "
145
+ elsif !@chapter.number.nil? && !@chapter.number.to_s.empty?
146
+ prefix = "#{@chapter.number} "
147
+ end
148
+ @section = 0
149
+ @subsection = 0
150
+ @subsubsection = 0
151
+ @subsubsubsection = 0
95
152
  when 2
96
- puts "■H2■#{@chapter.number}.#{@section += 1} #{caption}"
153
+ @section += 1
154
+ prefix = (!@chapter.number.nil? && !@chapter.number.to_s.empty?) ? "#{@chapter.number}.#{@section} " : ""
155
+ @subsection = 0
156
+ @subsubsection = 0
157
+ @subsubsubsection = 0
97
158
  when 3
98
- puts "■H3■#{caption}"
159
+ @subsection += 1
160
+ prefix = (!@chapter.number.nil? && !@chapter.number.to_s.empty?) ? "#{@chapter.number}.#{@section}.#{@subsection} " : ""
161
+ @subsubsection = 0
162
+ @subsubsubsection = 0
99
163
  when 4
100
- puts "■H4■#{caption}"
164
+ @subsubsection += 1
165
+ prefix = (!@chapter.number.nil? && !@chapter.number.to_s.empty?) ? "#{@chapter.number}.#{@section}.#{@subsection}.#{@subsubsection} " : ""
166
+ @subsubsubsection = 0
101
167
  when 5
102
- puts "■H5■#{caption}"
168
+ @subsubsubsection += 1
169
+ prefix = (!@chapter.number.nil? && !@chapter.number.to_s.empty?) ? "#{@chapter.number}.#{@section}.#{@subsection}.#{@subsubsection}.#{@subsubsubsection} " : ""
103
170
  else
104
171
  raise "caption level too deep or unsupported: #{level}"
105
172
  end
106
- end
107
-
108
- def column_begin(level, label, caption)
109
- blank
110
- puts "◆→開始:コラム←◆"
111
- puts "■#{caption}"
112
- end
113
-
114
- def column_end(level)
115
- puts "◆→終了:コラム←◆"
116
- blank
173
+ prefix = "" if (level.to_i > ReVIEW.book.param["secnolevel"])
174
+ puts "■H#{level}■#{prefix}#{compile_inline(caption)}"
117
175
  end
118
176
 
119
177
  def ul_begin
@@ -121,42 +179,20 @@ module ReVIEW
121
179
  end
122
180
 
123
181
  def ul_item(lines)
124
- print @choice.nil? ? "●" : @choice
125
- puts "\t#{lines.join('')}"
182
+ puts "●\t#{lines.join}"
126
183
  end
127
184
 
128
185
  def ul_end
129
186
  blank
130
187
  end
131
188
 
132
- def choice_single_begin
133
- @choice = "○"
134
- blank
135
- end
136
-
137
- def choice_single_end
138
- @choice = nil
139
- blank
140
- end
141
-
142
- def choice_multi_begin
143
- @choice = "□"
144
- blank
145
- end
146
-
147
- def choice_multi_end
148
- @choice = nil
149
- blank
150
- end
151
-
152
189
  def ol_begin
153
190
  blank
154
191
  @olitem = 0
155
192
  end
156
193
 
157
194
  def ol_item(lines, num)
158
- #puts "#{@olitem += 1}\t#{lines.join('')}"
159
- puts "#{num}\t#{lines.join('')}"
195
+ puts "#{num}\t#{lines.join}"
160
196
  end
161
197
 
162
198
  def ol_end
@@ -178,74 +214,128 @@ module ReVIEW
178
214
  end
179
215
  end
180
216
 
181
- def split_paragraph(lines)
182
- lines.map {|line| line.strip }.join("\n").strip.split("\n\n")
183
- end
184
-
185
217
  def dl_end
186
218
  blank
187
219
  end
188
220
 
189
221
  def paragraph(lines)
190
- puts lines.join('')
222
+ puts lines.join
191
223
  end
192
224
 
193
225
  def read(lines)
194
- puts "◆→開始:リード←◆"
195
- paragraph(lines)
196
- puts "◆→終了:リード←◆"
226
+ puts "◆→開始:#{@titles["lead"]}←◆"
227
+ puts split_paragraph(lines).join("\n")
228
+ puts "◆→終了:#{@titles["lead"]}←◆"
229
+ blank
197
230
  end
198
231
 
199
- alias lead read
232
+ alias :lead read
200
233
 
201
234
  def inline_list(id)
202
- "リスト#{@chapter.number}.#{@chapter.list(id).number}"
235
+ chapter, id = extract_chapter_id(id)
236
+ if get_chap(chapter).nil?
237
+ puts %Q[#{I18n.t("list")}#{I18n.t("format_number_without_chapter", [@chapter.list(id).number])}]
238
+ else
239
+ puts %Q[#{I18n.t("list")}#{I18n.t("format_number", [get_chap(chapter), @chapter.list(id).number])}]
240
+ end
241
+
203
242
  end
204
243
 
205
244
  def list_header(id, caption)
206
245
  blank
207
- puts "◆→開始:リスト←◆"
208
- puts "リスト#{@chapter.number}.#{@chapter.list(id).number} #{caption}"
246
+ puts "◆→開始:#{@titles["list"]}←◆"
247
+ if get_chap.nil?
248
+ puts %Q[#{I18n.t("list")}#{I18n.t("format_number_without_chapter", [@chapter.list(id).number])} #{compile_inline(caption)}]
249
+ else
250
+ puts %Q[#{I18n.t("list")}#{I18n.t("format_number", [get_chap, @chapter.list(id).number])} #{compile_inline(caption)}]
251
+ end
209
252
  blank
210
253
  end
211
254
 
212
255
  def list_body(lines)
213
256
  lines.each do |line|
214
- puts line
257
+ puts detab(line)
215
258
  end
216
- puts "◆→終了:リスト←◆"
259
+ puts "◆→終了:#{@titles["list"]}←◆"
217
260
  blank
218
261
  end
219
262
 
220
263
  def base_block(type, lines, caption = nil)
221
264
  blank
222
- puts "◆→開始:#{type}←◆"
223
- puts "■#{caption}" unless caption.nil?
265
+ puts "◆→開始:#{@titles[type]}←◆"
266
+ puts "■#{compile_inline(caption)}" unless caption.nil?
224
267
  puts lines.join("\n")
225
- puts "◆→終了:#{type}←◆"
268
+ puts "◆→終了:#{@titles[type]}←◆"
269
+ blank
270
+ end
271
+
272
+ def base_parablock(type, lines, caption = nil)
273
+ blank
274
+ puts "◆→開始:#{@titles[type]}←◆"
275
+ puts "■#{compile_inline(caption)}" unless caption.nil?
276
+ puts split_paragraph(lines).join("\n")
277
+ puts "◆→終了:#{@titles[type]}←◆"
226
278
  blank
227
279
  end
228
280
 
229
281
  def emlist(lines, caption = nil)
230
- base_block "インラインリスト", lines, caption
282
+ base_block "emlist", lines, caption
283
+ end
284
+
285
+ def emlistnum(lines, caption = nil)
286
+ blank
287
+ puts "◆→開始:#{@titles["emlist"]}←◆"
288
+ puts "■#{compile_inline(caption)}" unless caption.nil?
289
+ _lines = []
290
+ lines.each_with_index do |line, i|
291
+ puts (i + 1).to_s.rjust(2) + ": #{line}"
292
+ end
293
+ puts "◆→終了:#{@titles["emlist"]}←◆"
294
+ blank
295
+ end
296
+
297
+ def listnum_body(lines)
298
+ lines.each_with_index do |line, i|
299
+ puts (i + 1).to_s.rjust(2) + ": #{line}"
300
+ end
301
+ puts "◆→終了:#{@titles["list"]}←◆"
302
+ blank
231
303
  end
232
304
 
233
305
  def cmd(lines, caption = nil)
234
- base_block "コマンド", lines, caption
306
+ base_block "cmd", lines, caption
235
307
  end
236
308
 
237
309
  def quote(lines)
238
- base_block "引用", lines, nil
310
+ base_parablock "quote", lines, nil
311
+ end
312
+
313
+ def inline_table(id)
314
+ chapter, id = extract_chapter_id(id)
315
+ if get_chap(chapter).nil?
316
+ "#{I18n.t("table")}#{I18n.t("format_number_without_chapter", [chapter.table(id).number])}"
317
+ else
318
+ "#{I18n.t("table")}#{I18n.t("format_number", [get_chap(chapter), chapter.table(id).number])}"
319
+ end
239
320
  end
240
321
 
241
322
  def inline_img(id)
242
- "図#{@chapter.number}.#{@chapter.image(id).number}"
323
+ chapter, id = extract_chapter_id(id)
324
+ if get_chap(chapter).nil?
325
+ "#{I18n.t("image")}#{I18n.t("format_number_without_chapter", [chapter.image(id).number])}"
326
+ else
327
+ "#{I18n.t("image")}#{I18n.t("format_number", [get_chap(chapter), chapter.image(id).number])}"
328
+ end
243
329
  end
244
330
 
245
- def image(lines, id, caption)
331
+ def image(lines, id, caption, metric=nil)
246
332
  blank
247
- puts "◆→開始:図←◆"
248
- puts "図#{@chapter.number}.#{@chapter.image(id).number} #{caption}"
333
+ puts "◆→開始:#{@titles["image"]}←◆"
334
+ if get_chap.nil?
335
+ puts "#{I18n.t("image")}#{I18n.t("format_number_without_chapter", [@chapter.image(id).number])} #{compile_inline(caption)}"
336
+ else
337
+ puts "#{I18n.t("image")}#{I18n.t("format_number", [get_chap, @chapter.image(id).number])} #{compile_inline(caption)}"
338
+ end
249
339
  blank
250
340
  if @chapter.image(id).bound?
251
341
  puts "◆→#{@chapter.image(id).path}←◆"
@@ -254,18 +344,25 @@ module ReVIEW
254
344
  puts line
255
345
  end
256
346
  end
257
- puts "◆→終了:図←◆"
347
+ puts "◆→終了:#{@titles["image"]}←◆"
258
348
  blank
259
349
  end
260
350
 
261
- def inline_table(id)
262
- "表#{@chapter.number}.#{@chapter.table(id).number}"
351
+ def texequation(lines)
352
+ puts "◆→開始:#{@titles["texequation"]}←◆"
353
+ puts "#{lines.join("\n")}"
354
+ puts "◆→終了:#{@titles["texequation"]}←◆"
355
+ blank
263
356
  end
264
357
 
265
358
  def table_header(id, caption)
266
359
  blank
267
- puts "◆→開始:表←◆"
268
- puts "表#{@chapter.number}.#{@chapter.table(id).number} #{caption}"
360
+ puts "◆→開始:#{@titles["table"]}←◆"
361
+ if get_chap.nil?
362
+ puts "#{I18n.t("table")}#{I18n.t("format_number_without_chapter", [@chapter.table(id).number])} #{compile_inline(caption)}"
363
+ else
364
+ puts "#{I18n.t("table")}#{I18n.t("format_number", [get_chap, @chapter.table(id).number])} #{compile_inline(caption)}"
365
+ end
269
366
  blank
270
367
  end
271
368
 
@@ -285,44 +382,74 @@ module ReVIEW
285
382
  end
286
383
 
287
384
  def table_end
288
- puts "◆→終了:表←◆"
385
+ puts "◆→終了:#{@titles["table"]}←◆"
289
386
  blank
290
387
  end
291
388
 
292
389
  def comment(str)
293
- puts "◆→DTP担当:#{str}←◆"
390
+ puts "◆→DTP連絡:#{str}←◆"
294
391
  end
295
392
 
296
- def inline_fn(id)
393
+ def footnote(id, str)
394
+ puts "【注#{@chapter.footnote(id).number}】#{compile_inline(str)}"
395
+ end
396
+
397
+ def inline_fn(id)
297
398
  "【注#{@chapter.footnote(id).number}】"
298
399
  end
299
400
 
300
- def footnote(id, str)
301
- puts "【注#{@chapter.footnote(id).number}】#{compile_inline(str)}"
401
+ def compile_ruby(base, ruby)
402
+ "#{base}◆→DTP連絡:「#{base}」に「#{ruby}」とルビ←◆"
302
403
  end
303
404
 
304
405
  def compile_kw(word, alt)
305
406
  if alt
306
- then "★#{word}☆(#{alt.sub(/\A\s+/,"")})"
407
+ then "★#{word}☆(#{alt.strip})"
307
408
  else "★#{word}☆"
308
409
  end
309
410
  end
310
411
 
311
- def inline_chap(id)
312
- #"「第#{super}章 #{inline_title(id)}」"
313
- # "第#{super}章"
314
- super
412
+ def compile_href(url, label)
413
+ if label.nil?
414
+ %Q[△#{url}☆]
415
+ else
416
+ %Q[#{label}(△#{url}☆)]
417
+ end
315
418
  end
316
419
 
317
- def compile_ruby(base, ruby)
318
- "#{base}◆→DTP担当:「#{base}」に「#{ruby}」とルビ←◆"
420
+ def inline_sup(str)
421
+ "#{str}◆→DTP連絡:「#{str}」は上付き←◆"
319
422
  end
320
423
 
321
- def inline_bou(str)
322
- "#{str}◆→DTP担当:「#{str}」に傍点←◆"
424
+ def inline_sub(str)
425
+ "#{str}◆→DTP連絡:「#{str}」は下付き←◆"
323
426
  end
324
427
 
325
- def inline_i(str)
428
+ def inline_raw(str)
429
+ %Q[#{super(str).gsub("\\n", "\n")}]
430
+ end
431
+
432
+ def inline_hint(str)
433
+ "◆→ヒントスタイルここから←◆#{str}◆→ヒントスタイルここまで←◆"
434
+ end
435
+
436
+ def inline_maru(str)
437
+ "#{str}◆→丸数字#{str}←◆"
438
+ end
439
+
440
+ def inline_idx(str)
441
+ "#{str}◆→索引項目:#{str}←◆"
442
+ end
443
+
444
+ def inline_hidx(str)
445
+ "◆→索引項目:#{str}←◆"
446
+ end
447
+
448
+ def inline_ami(str)
449
+ "#{str}◆→DTP連絡:「#{str}」に網カケ←◆"
450
+ end
451
+
452
+ def inline_i(str)
326
453
  "▲#{str}☆"
327
454
  end
328
455
 
@@ -334,169 +461,227 @@ module ReVIEW
334
461
  "△#{str}☆"
335
462
  end
336
463
 
337
- def inline_ttbold(str)
464
+ def inline_ttb(str)
338
465
  "★#{str}☆◆→等幅フォント太字←◆"
339
466
  end
340
467
 
468
+ alias :inline_ttbold inline_ttb
469
+
341
470
  def inline_tti(str)
342
471
  "▲#{str}☆◆→等幅フォントイタ←◆"
343
472
  end
344
473
 
345
- def inline_ttibold(str)
346
- "▲#{str}☆◆→等幅フォント太字イタ←◆"
347
- end
348
-
349
474
  def inline_u(str)
350
475
  "@#{str}@◆→@〜@部分に下線←◆"
351
476
  end
352
477
 
353
- def inline_icon(id)
354
- "◆→画像 #{@chapter.id}-#{id}.eps←◆"
478
+ def inline_icon(id)
479
+ begin
480
+ return "◆→画像 #{@chapter.image(id).path.sub(/\A\.\//, "")}←◆"
481
+ rescue
482
+ warn "no such icon image: #{id}"
483
+ return "◆→画像 #{id}←◆"
484
+ end
355
485
  end
356
486
 
357
- def inline_ami(str)
358
- "#{str}◆→DTP担当:「#{str}」に網カケ←◆"
487
+ def inline_bou(str)
488
+ "#{str}◆→DTP連絡:「#{str}」に傍点←◆"
359
489
  end
360
490
 
361
- def inline_sup(str)
362
- "#{str}◆→DTP担当:「#{str}」は上付き←◆"
491
+ def inline_keytop(str)
492
+ "#{str}◆→キートップ#{str}←◆"
363
493
  end
364
494
 
365
- def inline_sub(str)
366
- "#{str}◆→DTP担当:「#{str}」は下付き←◆"
495
+ def inline_balloon(str)
496
+ %Q(\t←#{str.gsub(/@maru\[(\d+)\]/, inline_maru('\1'))})
367
497
  end
368
498
 
369
- def inline_raw(str)
370
- # FIXME
371
- str
499
+ def inline_uchar(str)
500
+ [str.to_i(16)].pack("U")
372
501
  end
373
502
 
374
- def inline_hint(str)
375
- "◆→ヒントスタイル←◆#{str}"
503
+ def inline_m(str)
504
+ %Q[◆→TeX式ここから←◆#{str}◆→TeX式ここまで←◆]
376
505
  end
377
506
 
378
- def inline_maru(str)
379
- "#{str}◆→丸数字#{str}←◆"
507
+ def noindent
508
+ puts "◆→DTP連絡:次の1行インデントなし←◆"
380
509
  end
381
510
 
382
- def inline_idx(str)
383
- "#{str}◆→索引項目:#{str}←◆"
511
+ def nonum_begin(level, label, caption)
512
+ puts "■H#{level}■#{compile_inline(caption)}"
384
513
  end
385
514
 
386
- def inline_hidx(str)
387
- "◆→索引項目:#{str}←◆"
515
+ def nonum_end(level)
388
516
  end
389
517
 
390
- def inline_keytop(str)
391
- "#{str}◆→キートップ#{str}←◆"
518
+ def common_column_begin(type, caption)
519
+ blank
520
+ puts "◆→開始:#{@titles["type"]}←◆"
521
+ puts %Q[■#{compile_inline(caption)}]
392
522
  end
393
523
 
394
- def inline_labelref(idref)
395
- %Q(「◆→#{idref}←◆」) # 節、項を参照
524
+ def common_column_end(type)
525
+ puts %Q[◆→終了:#{@titles["type"]}←◆]
526
+ blank
396
527
  end
397
528
 
398
- alias inline_ref inline_labelref
529
+ def column_begin(level, label, caption)
530
+ common_column_begin("column", caption)
531
+ end
399
532
 
400
- def inline_pageref(idref)
401
- %Q(●ページ◆→#{idref}←◆) # ページ番号を参照
533
+ def column_end(level)
534
+ common_column_end("column")
402
535
  end
403
536
 
404
- def inline_balloon(str)
405
- %Q(\t←#{str.gsub(/@maru\[(\d+)\]/, inline_maru('\1'))})
537
+ def xcolumn_begin(level, label, caption)
538
+ common_column_begin("xcolumn", caption)
406
539
  end
407
540
 
408
- def noindent
409
- %Q(◆→インデントなし←◆)
541
+ def xcolumn_end(level)
542
+ common_column_end("xcolumn")
410
543
  end
411
544
 
412
- def nonum_begin(level, label, caption)
413
- puts "■H#{level}■#{caption}"
545
+ def world_begin(level, label, caption)
546
+ common_column_begin("world", caption)
414
547
  end
415
548
 
416
- def nonum_end(level)
549
+ def world_end(level)
550
+ common_column_end("world")
417
551
  end
418
552
 
419
- def circle_begin(level, label, caption)
420
- puts "・\t#{caption}"
553
+ def hood_begin(level, label, caption)
554
+ common_column_begin("hood", caption)
421
555
  end
422
556
 
423
- def circle_end(level)
557
+ def hood_end(level)
558
+ common_column_end("hood")
559
+ end
560
+
561
+ def edition_begin(level, label, caption)
562
+ common_column_begin("edition", caption)
563
+ end
564
+
565
+ def edition_end(level)
566
+ common_column_end("edition")
567
+ end
568
+
569
+ def insideout_begin(level, label, caption)
570
+ common_column_begin("insideout", caption)
571
+ end
572
+
573
+ def insideout_end(level)
574
+ common_column_end("insideout")
575
+ end
576
+
577
+ def ref_begin(level, label, caption)
578
+ common_column_begin("ref", caption)
579
+ end
580
+
581
+ def ref_end(level)
582
+ common_column_end("ref")
583
+ end
584
+
585
+ def sup_begin(level, label, caption)
586
+ common_column_begin("sup", caption)
587
+ end
588
+
589
+ def sup_end(level)
590
+ common_column_end("sup")
424
591
  end
425
592
 
426
593
  def flushright(lines)
427
- base_block "右寄せ", lines, nil
594
+ base_parablock "flushright", lines, nil
428
595
  end
429
596
 
430
597
  def note(lines, caption = nil)
431
- base_block "ノート", lines, caption
598
+ base_parablock "note", lines, caption
432
599
  end
433
600
 
434
601
  def memo(lines, caption = nil)
435
- base_block "メモ", lines, caption
602
+ base_parablock "memo", lines, caption
436
603
  end
437
604
 
438
605
  def tip(lines, caption = nil)
439
- base_block "TIP", lines, caption
606
+ base_parablock "tip", lines, caption
440
607
  end
441
608
 
442
609
  def info(lines, caption = nil)
443
- base_block "情報", lines, caption
610
+ base_parablock "info", lines, caption
444
611
  end
445
612
 
446
613
  def planning(lines, caption = nil)
447
- base_block "プランニング", lines, caption
614
+ base_parablock "planning", lines, caption
448
615
  end
449
616
 
450
617
  def best(lines, caption = nil)
451
- base_block "ベストプラクティス", lines, caption
618
+ base_parablock "best", lines, caption
452
619
  end
453
620
 
454
621
  def important(lines, caption = nil)
455
- base_block "重要", lines, caption
622
+ base_parablock "important", lines, caption
456
623
  end
457
624
 
458
625
  def security(lines, caption = nil)
459
- base_block "セキュリティ", lines, caption
626
+ base_parablock "security", lines, caption
460
627
  end
461
628
 
462
629
  def caution(lines, caption = nil)
463
- base_block "警告", lines, caption
630
+ base_parablock "caution", lines, caption
464
631
  end
465
632
 
466
633
  def term(lines)
467
- base_block "用語解説", lines, nil
634
+ base_parablock "term", lines, nil
635
+ end
636
+
637
+ def link(lines, caption = nil)
638
+ base_parablock "link", lines, caption
468
639
  end
469
640
 
470
641
  def notice(lines, caption = nil)
471
- base_block "注意", lines, caption
642
+ base_parablock "notice", lines, caption
472
643
  end
473
644
 
474
645
  def point(lines, caption = nil)
475
- base_block "ここがポイント", lines, caption
646
+ base_parablock "point", lines, caption
647
+ end
648
+
649
+ def shoot(lines, caption = nil)
650
+ base_parablock "shoot", lines, caption
476
651
  end
477
652
 
478
653
  def reference(lines)
479
- base_block "参考", lines, nil
654
+ base_parablock "reference", lines, nil
480
655
  end
481
656
 
482
657
  def practice(lines)
483
- base_block "練習問題", lines, nil
658
+ base_parablock "practice", lines, nil
484
659
  end
485
660
 
486
661
  def expert(lines)
487
- base_block "エキスパートに訊け", lines, nil
662
+ base_parablock "expert", lines, nil
488
663
  end
489
664
 
490
665
  def insn(lines, caption = nil)
491
- base_block "書式", lines, caption
666
+ base_block "insn", lines, caption
492
667
  end
493
668
 
494
- alias box insn
669
+ alias :box insn
495
670
 
496
- def indepimage(id)
497
- puts "◆→画像 #{@chapter.id}-#{id}.eps←◆"
671
+ def indepimage(id, caption=nil, metric=nil)
672
+ blank
673
+ begin
674
+ puts "◆→画像 #{@chapter.image(id).path.sub(/\A\.\//, "")} #{metric.join(" ")}←◆"
675
+ rescue
676
+ warn "no such image: #{id}"
677
+ puts "◆→画像 #{id}←◆"
678
+ end
679
+ puts "図 #{compile_inline(caption)}" if !caption.nil? && !caption.empty?
680
+ blank
498
681
  end
499
682
 
683
+ alias :numberlessimage indepimage
684
+
500
685
  def label(id)
501
686
  # FIXME
502
687
  ""
@@ -511,61 +696,75 @@ module ReVIEW
511
696
  # FIXME
512
697
  end
513
698
 
699
+ def bpo(lines)
700
+ base_block "bpo", lines, nil
701
+ end
702
+
514
703
  def inline_dtp(str)
515
704
  # FIXME
516
705
  ""
517
706
  end
518
707
 
708
+ def inline_code(str)
709
+ %Q[△#{str}☆]
710
+ end
711
+
519
712
  def inline_br(str)
520
713
  %Q(\n)
521
714
  end
522
715
 
523
- def raw(str)
524
- if str =~ /\A<\/(.+)>$/
525
- case $1
526
- when "emlist": puts "◆→終了:インラインリスト←◆"
527
- when "cmd": puts "◆→終了:コマンド←◆"
528
- when "quote": puts "◆→終了:引用←◆"
529
- when "flushright": puts "◆→終了:右寄せ←◆"
530
- when "note": puts "◆→終了:ノート←◆"
531
- when "important": puts "◆→終了:重要←◆"
532
- when "term": puts "◆→終了:用語解説←◆"
533
- when "notice": puts "◆→終了:注意←◆"
534
- when "point": puts "◆→終了:ここがポイント←◆"
535
- when "reference": puts "◆→終了:参考←◆"
536
- when "practice": puts "◆→終了:練習問題←◆"
537
- when "expert": puts "◆→終了:エキスパートに訊け←◆"
538
- when "box": puts "◆→終了:書式←◆"
539
- when "insn": puts "◆→終了:書式←◆"
540
- end
541
- elsif str =~ /\A<([^\/].+)>(?:<title[^>]>(.+)<\/title>)?(.*)/
542
- case $1
543
- when "emlist": puts "◆→開始:インラインリスト←◆"
544
- when "cmd": puts "◆→開始:コマンド←◆"
545
- when "quote": puts "◆→開始:引用←◆"
546
- when "flushright": puts "◆→開始:右寄せ←◆"
547
- when "note": puts "◆→開始:ノート←◆"
548
- when "important": puts "◆→開始:重要←◆"
549
- when "term": puts "◆→開始:用語解説←◆"
550
- when "notice": puts "◆→開始:注意←◆"
551
- when "point": puts "◆→開始:ここがポイント←◆"
552
- when "reference": puts "◆→開始:参考←◆"
553
- when "practice": puts "◆→開始:練習問題←◆"
554
- when "expert": puts "◆→開始:エキスパートに訊け←◆"
555
- when "box": puts "◆→開始:書式←◆"
556
- when "insn": puts "◆→開始:書式←◆"
716
+ def text(str)
717
+ str
718
+ end
719
+
720
+ def inline_chap(id)
721
+ #"「第#{super}章 #{inline_title(id)}」"
722
+ # "第#{super}章"
723
+ super
724
+ end
725
+
726
+ def inline_chapref(id)
727
+ chs = ["", "「", ""]
728
+ unless ReVIEW.book.param["chapref"].nil?
729
+ _chs = NKF.nkf("-w", ReVIEW.book.param["chapref"]).split(",")
730
+ if _chs.size != 3
731
+ error "--chapsplitter must have exactly 3 parameters with comma."
732
+ else
733
+ chs = _chs
557
734
  end
558
- puts "■#{$2}" unless $2.nil?
559
- print $3
560
735
  else
561
- puts str
562
736
  end
737
+ "#{chs[0]}#{@chapter.env.chapter_index.number(id)}#{chs[1]}#{@chapter.env.chapter_index.title(id)}#{chs[2]}"
738
+ rescue KeyError
739
+ error "unknown chapter: #{id}"
740
+ nofunc_text("[UnknownChapter:#{id}]")
563
741
  end
564
-
565
- def text(str)
566
- str
742
+
743
+ def source(lines, caption = nil)
744
+ base_block "source", lines, caption
567
745
  end
568
-
746
+
747
+ def inline_ttibold(str)
748
+ "▲#{str}☆◆→等幅フォント太字イタ←◆"
749
+ end
750
+
751
+ def inline_labelref(idref)
752
+ %Q(「◆→#{idref}←◆」) # 節、項を参照
753
+ end
754
+
755
+ alias inline_ref inline_labelref
756
+
757
+ def inline_pageref(idref)
758
+ %Q(●ページ◆→#{idref}←◆) # ページ番号を参照
759
+ end
760
+
761
+ def circle_begin(level, label, caption)
762
+ puts "・\t#{caption}"
763
+ end
764
+
765
+ def circle_end(level)
766
+ end
767
+
569
768
  def nofunc_text(str)
570
769
  str
571
770
  end