deplate 0.7.3 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. data/AUTHORS.TXT +3 -0
  2. data/CHANGES.TXT +248 -175
  3. data/LICENSE.TXT +0 -0
  4. data/NEWS.TXT +28 -24
  5. data/README.TXT +0 -0
  6. data/TODO.TXT +174 -88
  7. data/VERSION.TXT +1 -1
  8. data/bin/deplate +0 -0
  9. data/bin/deplate.bat +0 -0
  10. data/etc/deplate.ini +91 -3
  11. data/lib/action_view/helpers/deplate.rb +45 -0
  12. data/lib/deplate.rb +6 -1
  13. data/lib/deplate/abstract-class.rb +0 -0
  14. data/lib/deplate/bib.rb +576 -0
  15. data/lib/deplate/builtin.rb +0 -0
  16. data/lib/deplate/cache.rb +55 -5
  17. data/lib/deplate/commands.rb +346 -183
  18. data/lib/deplate/common.rb +209 -48
  19. data/lib/deplate/converter.rb +12 -6
  20. data/lib/deplate/core.rb +777 -378
  21. data/lib/deplate/counters.rb +254 -0
  22. data/lib/deplate/css/article.css +4 -3
  23. data/lib/deplate/css/deplate.css +121 -5
  24. data/lib/deplate/css/heading-navbar.css +0 -0
  25. data/lib/deplate/css/layout-deplate-print.css +0 -0
  26. data/lib/deplate/css/layout-deplate.css +0 -0
  27. data/lib/deplate/css/sans-serif.css +0 -0
  28. data/lib/deplate/css/serif-e.css +0 -0
  29. data/lib/deplate/css/serif-rel.css +0 -0
  30. data/lib/deplate/css/serif.css +9 -3
  31. data/lib/deplate/css/slides.css +0 -0
  32. data/lib/deplate/css/tabbar-left.css +0 -0
  33. data/lib/deplate/css/tabbar-right-ie.css +3 -9
  34. data/lib/deplate/css/tabbar-right.css +51 -18
  35. data/lib/deplate/css/tabbar-top.css +7 -1
  36. data/lib/deplate/css/tabbar.css +0 -0
  37. data/lib/deplate/css/text-sans-serif.css +0 -0
  38. data/lib/deplate/css/text-serif.css +0 -0
  39. data/lib/deplate/define.rb +183 -177
  40. data/lib/deplate/deplate-string.rb +82 -0
  41. data/lib/deplate/docbook.rb +236 -128
  42. data/lib/deplate/elements.rb +584 -417
  43. data/lib/deplate/etc.rb +163 -101
  44. data/lib/deplate/external.rb +42 -11
  45. data/lib/deplate/fmt/dbk-article-4.1.2.rb +0 -0
  46. data/lib/deplate/fmt/dbk-article.rb +0 -0
  47. data/lib/deplate/fmt/dbk-book.rb +0 -0
  48. data/lib/deplate/fmt/dbk-ref.rb +3 -3
  49. data/lib/deplate/fmt/dbk-slides.rb +0 -0
  50. data/lib/deplate/fmt/dbk-snippet.rb +0 -0
  51. data/lib/deplate/fmt/html-snippet.rb +0 -0
  52. data/lib/deplate/fmt/html.rb +783 -550
  53. data/lib/deplate/fmt/htmlsite.rb +192 -199
  54. data/lib/deplate/fmt/htmlslides.rb +0 -0
  55. data/lib/deplate/fmt/htmlwebsite.rb +3 -3
  56. data/lib/deplate/fmt/latex-snippet.rb +0 -0
  57. data/lib/deplate/fmt/latex.rb +242 -83
  58. data/lib/deplate/fmt/null.rb +32 -0
  59. data/lib/deplate/fmt/php.rb +4 -4
  60. data/lib/deplate/fmt/phpsite.rb +6 -5
  61. data/lib/deplate/fmt/plain.rb +160 -106
  62. data/lib/deplate/fmt/template.rb +0 -0
  63. data/lib/deplate/fmt/xhtml10t.rb +0 -0
  64. data/lib/deplate/formatter-snippet.rb +0 -0
  65. data/lib/deplate/formatter.rb +613 -301
  66. data/lib/deplate/input.rb +202 -142
  67. data/lib/deplate/input/deplate-headings.rb +4 -6
  68. data/lib/deplate/input/deplate-restricted.rb +15 -9
  69. data/lib/deplate/input/deplate.rb +2 -4
  70. data/lib/deplate/input/rdoc.rb +39 -38
  71. data/lib/deplate/input/template.rb +0 -0
  72. data/lib/deplate/lib/Makefile.config +29 -0
  73. data/lib/deplate/lib/latex/deplate.sty +54 -0
  74. data/lib/deplate/lib/latex/highlight-extra.sty +0 -0
  75. data/lib/deplate/lib/latex/highlight-typical.sty +0 -0
  76. data/lib/deplate/lib/php/page-comment.inc.php +216 -0
  77. data/lib/deplate/lib/tabmenu.js +0 -0
  78. data/lib/deplate/locale/de.latin1 +155 -17
  79. data/lib/deplate/locale/ru.koi8-r +0 -0
  80. data/lib/deplate/locale/zh_cn.gb2312 +0 -0
  81. data/lib/deplate/macros.rb +133 -82
  82. data/lib/deplate/messages.rb +6 -4
  83. data/lib/deplate/metadata.rb +0 -0
  84. data/lib/deplate/metadata/marshal.rb +0 -0
  85. data/lib/deplate/metadata/xml.rb +0 -0
  86. data/lib/deplate/metadata/yaml.rb +0 -0
  87. data/lib/deplate/mod/anyword.rb +3 -3
  88. data/lib/deplate/mod/babelfish.rb +4 -4
  89. data/lib/deplate/mod/code-gvim.rb +8 -4
  90. data/lib/deplate/mod/code-highlight.rb +3 -3
  91. data/lib/deplate/mod/colored-log.rb +0 -0
  92. data/lib/deplate/mod/de.rb +2 -2
  93. data/lib/deplate/mod/en.rb +0 -0
  94. data/lib/deplate/mod/endnotes.rb +0 -0
  95. data/lib/deplate/mod/fr.rb +0 -0
  96. data/lib/deplate/mod/html-asciimath.rb +0 -0
  97. data/lib/deplate/mod/html-deplate-button.rb +0 -0
  98. data/lib/deplate/mod/html-headings-navbar.rb +5 -13
  99. data/lib/deplate/mod/html-jsmath.rb +39 -0
  100. data/lib/deplate/mod/html-obfuscate-email.rb +3 -3
  101. data/lib/deplate/mod/html-sidebar.rb +0 -0
  102. data/lib/deplate/mod/htmlslides-navbar-fh.rb +3 -3
  103. data/lib/deplate/mod/iconv.rb +0 -0
  104. data/lib/deplate/mod/imgurl.rb +4 -4
  105. data/lib/deplate/mod/inlatex-compound.rb +7 -10
  106. data/lib/deplate/mod/koma.rb +0 -0
  107. data/lib/deplate/mod/latex-emph-table-head.rb +0 -0
  108. data/lib/deplate/mod/latex-styles.rb +7 -4
  109. data/lib/deplate/mod/latex-verbatim-small.rb +0 -0
  110. data/lib/deplate/mod/makefile.rb +23 -7
  111. data/lib/deplate/mod/mark-external-urls.rb +3 -3
  112. data/lib/deplate/mod/markup-1-warn.rb +10 -10
  113. data/lib/deplate/mod/markup-1.rb +0 -0
  114. data/lib/deplate/mod/navbar-png.rb +24 -8
  115. data/lib/deplate/mod/noindent.rb +0 -0
  116. data/lib/deplate/mod/numpara.rb +0 -0
  117. data/lib/deplate/mod/particle-math.rb +4 -4
  118. data/lib/deplate/mod/php-extra.rb +46 -6
  119. data/lib/deplate/mod/pstoedit.rb +0 -0
  120. data/lib/deplate/mod/recode.rb +0 -0
  121. data/lib/deplate/mod/ru_koi8-r.rb +0 -0
  122. data/lib/deplate/mod/smart-dash.rb +26 -0
  123. data/lib/deplate/mod/smiley.rb +69 -7
  124. data/lib/deplate/mod/soffice.rb +0 -0
  125. data/lib/deplate/mod/symbols-latin1.rb +14 -23
  126. data/lib/deplate/mod/symbols-od-utf-8.rb +5 -3
  127. data/lib/deplate/mod/symbols-plain.rb +5 -35
  128. data/lib/deplate/mod/symbols-sgml.rb +8 -9
  129. data/lib/deplate/mod/symbols-utf-8.rb +8 -9
  130. data/lib/deplate/mod/symbols-xml.rb +5 -9
  131. data/lib/deplate/mod/syntax-region-alt.rb +5 -5
  132. data/lib/deplate/mod/utf8.rb +0 -0
  133. data/lib/deplate/mod/validate-html.rb +0 -0
  134. data/lib/deplate/mod/xmlrpc.rb +0 -0
  135. data/lib/deplate/mod/zh-cn-autospace.rb +18 -20
  136. data/lib/deplate/mod/zh-cn.rb +4 -6
  137. data/lib/deplate/nukumi2.rb +71 -0
  138. data/lib/deplate/once-method.rb +0 -0
  139. data/lib/deplate/output.rb +19 -21
  140. data/lib/deplate/particles.rb +178 -116
  141. data/lib/deplate/regions.rb +99 -58
  142. data/lib/deplate/skeletons.rb +122 -0
  143. data/lib/deplate/structured.rb +164 -106
  144. data/lib/deplate/template.rb +67 -43
  145. data/lib/deplate/templates/html-doc.html +0 -0
  146. data/lib/deplate/templates/html-left-tabbar-js.html +0 -0
  147. data/lib/deplate/templates/html-left-tabbar.html +0 -0
  148. data/lib/deplate/templates/html-tabbar-right-pcomments.php +22 -0
  149. data/lib/deplate/templates/html-tabbar-right-step.html +24 -0
  150. data/lib/deplate/templates/html-tabbar-right-table.html +0 -0
  151. data/lib/deplate/templates/html-tabbar-right.html +2 -4
  152. data/lib/deplate/templates/html-tabbar-top.html +0 -9
  153. data/lib/deplate/templates/html-tabbar.html +0 -0
  154. data/lib/deplate/variables.rb +127 -0
  155. data/lib/deplate/wiki-markup.rb +99 -33
  156. data/lib/deplate/xml.rb +18 -18
  157. data/lib/deplate/zh-cn.rb +0 -0
  158. data/lib/ps2ppm.rb +0 -0
  159. data/man/man1/deplate.1 +564 -474
  160. metadata +201 -186
@@ -3,8 +3,8 @@
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 17-M�r-2004.
6
- # @Last Change: 28-Okt-2005.
7
- # @Revision: 0.2590
6
+ # @Last Change: 05-Jun-2006.
7
+ # @Revision: 0.2707
8
8
  #
9
9
  # TODO:
10
10
  # - am Ende des Dokuments muss ein Stapel mit offenen tags abgearbeitet werden
@@ -18,13 +18,13 @@ class Deplate::Formatter::Structured < Deplate::Formatter
18
18
  @@bibentries = {}
19
19
  @@openLabels = []
20
20
 
21
- label_delegate = [
21
+ self.label_delegate = [
22
22
  # :format_heading,
23
23
  :format_LIST,
24
24
  :format_anchor,
25
25
  ]
26
26
 
27
- label_once = [
27
+ self.label_once = [
28
28
  :format_list_env,
29
29
  :format_table,
30
30
  :format_IMG,
@@ -41,18 +41,19 @@ class Deplate::Formatter::Structured < Deplate::Formatter
41
41
  def output_at(type, slot, text)
42
42
  ind = @deplate.options.indentation_level.last
43
43
  if ind > 0
44
- text = indent_text(text, ind)
44
+ text = indent_text(text, :mult => ind)
45
45
  end
46
46
  super(type, slot, text)
47
47
  end
48
48
 
49
49
 
50
50
  ################################################ Lists {{{1
51
- def format_list_item(invoker, type, level, item, explicit=false)
52
- args = invoker.args
51
+ def format_list_item(invoker, type, level, item, args={})
52
+ args = invoker.args
53
+ explicit = args[:explicit]
53
54
  # $stderr << "Item #{type}: #{item.body}\n" if $DEBUG
54
55
  case type
55
- when "Numbered"
56
+ when "Ordered"
56
57
  open = get_item_numbered_open(args, item.item, item.body)
57
58
  close = get_item_numbered_close(args)
58
59
  when "Itemize"
@@ -61,14 +62,29 @@ class Deplate::Formatter::Structured < Deplate::Formatter
61
62
  when "Description"
62
63
  open = get_item_description_open(args, item.item, item.body)
63
64
  close = get_item_description_close(args)
65
+ when 'Task'
66
+ open = get_item_task_open(args, item.item, item.body, item.opts)
67
+ close = get_item_task_close(args)
64
68
  when "Paragraph"
65
69
  open = get_item_paragraph(args, item.item, item.body)
66
70
  close = nil
71
+ when 'Container'
72
+ open = item.body
73
+ close = nil
67
74
  else
68
- raise "Unknown list type: #{item.inspect}"
75
+ f = item.preformatted
76
+ if f
77
+ open, close = f
78
+ else
79
+ raise "Unknown list type: #{item.inspect}"
80
+ end
69
81
  end
70
- open = indent_text(open, level, true)
71
- close = indent_text(close, level, true)
82
+ if type != 'Container'
83
+ # open = indent_text(open, level, :shift => true)
84
+ open = indent_text(open, :mult => level)
85
+ end
86
+ # close = indent_text(close, level, :shift => true)
87
+ close = indent_text(close, :mult => level)
72
88
  return open, close
73
89
  end
74
90
 
@@ -77,7 +93,7 @@ class Deplate::Formatter::Structured < Deplate::Formatter
77
93
  def format_list_env(invoker, type, level, what, subtype=nil)
78
94
  args = invoker.args
79
95
  case type
80
- when "Numbered"
96
+ when "Ordered"
81
97
  if what == :open
82
98
  tag = get_list_numbered_open(args, subtype)
83
99
  elsif what == :close
@@ -89,16 +105,25 @@ class Deplate::Formatter::Structured < Deplate::Formatter
89
105
  elsif what == :close
90
106
  tag = get_list_itemize_close(args)
91
107
  end
108
+ when 'Task'
109
+ if what == :open
110
+ tag = get_list_task_open(args)
111
+ elsif what == :close
112
+ tag = get_list_task_close(args)
113
+ end
92
114
  when "Description"
93
115
  if what == :open
94
116
  tag = get_list_description_open(args)
95
117
  elsif what == :close
96
118
  tag = get_list_description_close(args)
97
119
  end
120
+ when nil
121
+ invoker.log('List type is nil', :debug)
98
122
  else
99
123
  raise "Unknown list type: #{type}"
100
124
  end
101
- return indent_text(tag, level, true)
125
+ # return indent_text(tag, level, :shift => true)
126
+ return indent_text(tag, :mult => level)
102
127
  end
103
128
 
104
129
  def_abstract :get_list_numbered_open, :get_list_numbered_close
@@ -127,7 +152,7 @@ class Deplate::Formatter::Structured < Deplate::Formatter
127
152
  end
128
153
  when :once
129
154
  for l in label
130
- text = if block_given? then yield(l) else "" end
155
+ text = if block_given? then yield(l) else '' end
131
156
  acc << get_label(args, l, mode, text)
132
157
  end
133
158
  when :closeOpen
@@ -137,7 +162,7 @@ class Deplate::Formatter::Structured < Deplate::Formatter
137
162
  end
138
163
  else
139
164
  for l in label.uniq
140
- text = if block_given? then yield(l) else "" end
165
+ text = if block_given? then yield(l) else '' end
141
166
  acc << get_label(args, l, mode, text)
142
167
  end
143
168
  end
@@ -149,31 +174,26 @@ class Deplate::Formatter::Structured < Deplate::Formatter
149
174
  elt ||= invoker.elt
150
175
  args = invoker.args
151
176
  if inline
152
- include_image(elt, args, inline)
177
+ include_image(invoker, elt, args, inline)
153
178
  else
154
179
  caption = invoker.caption
155
- fig = @deplate.msg("Figure")
156
- capAbove = !(caption && caption.args && caption.args.include?("below"))
180
+ fig = @deplate.msg('Figure')
181
+ capAbove = !(caption && caption.args && caption.args.include?('below'))
157
182
  if caption
158
183
  ti = %{#{fig} #{invoker.level_as_string}}
159
184
  cap = get_figure_caption(args, ti, caption.elt, capAbove)
160
185
  else
161
186
  cap = nil
162
187
  end
163
- get_figure(args, cap, include_image(elt, args))
188
+ get_figure(args, cap, include_image(invoker, elt, args))
164
189
  end
165
190
  end
166
191
 
167
192
  def_abstract :get_figure_caption, :get_figure
168
193
 
169
- def include_image(file, args, inline=false)
170
- f = file[0..-(File.extname(file).size + 1)]
171
- for sfx in image_suffixes
172
- ff = f + sfx
173
- if File.exist?(File.join(@deplate.options.dir || "", ff))
174
- return get_image(args, ff, f, inline)
175
- end
176
- end
194
+ def include_image(invoker, file, args, inline=false)
195
+ f = File.basename(file, '*')
196
+ file = use_image_filename(file, args)
177
197
  return get_image(args, file, f, inline)
178
198
  end
179
199
 
@@ -288,14 +308,11 @@ class Deplate::Formatter::Structured < Deplate::Formatter
288
308
  def format_verbatim(invoker, text=nil)
289
309
  text = invoker.elt unless text
290
310
  args = invoker.args
291
- begin
292
- @deplate.options.indentation_level << 0
293
- # It's up to get_pre_format to deal with this.
294
- # text = plain_text(text, false, false)
295
- get_pre_format(args, text)
296
- ensure
297
- @deplate.options.indentation_level.pop
311
+ @deplate.options.indentation_level << 0
312
+ invoker.postponed_format << Proc.new do |container|
313
+ container.deplate.options.indentation_level.pop
298
314
  end
315
+ get_pre_format(args, text)
299
316
  end
300
317
 
301
318
  def format_abstract(invoker)
@@ -377,29 +394,38 @@ class Deplate::Formatter::Structured < Deplate::Formatter
377
394
 
378
395
 
379
396
  ################################################ Particles {{{1
380
- # Shouldn't this be an alias to get_emphasize?
381
- def format_emphasize(args, text)
397
+ def format_emphasize(invoker, text=nil)
398
+ text ||= invoker.elt || invoker.text
399
+ args = invoker.args
382
400
  get_emphasize(args, text)
383
401
  end
384
402
 
385
403
  def_abstract :get_emphasize
386
404
 
387
- def format_code(args, text)
405
+ def format_code(invoker, text=nil)
406
+ text ||= invoker.elt || invoker.text
407
+ args = invoker.args
388
408
  get_code(args, plain_text(text, true, false))
389
409
  end
390
410
 
391
411
  def_abstract :get_code
392
412
 
393
- def format_url(args, name, dest, anchor, literal=false)
413
+ def format_url(invoker, name, dest, anchor, literal=false)
394
414
  dest = Deplate::HyperLink.url_anchor(dest, anchor)
415
+ args = invoker.args
395
416
  get_url(args, name, dest, anchor)
396
417
  end
397
418
 
398
419
  def_abstract :get_url
399
420
 
400
- def format_wiki(args, name, dest, anchor)
401
- dest = Deplate::HyperLink.url_anchor(dest, anchor)
402
- get_wiki(args, name, dest, anchor)
421
+ def format_wiki(invoker, name, dest, anchor)
422
+ if dest.empty? and (name.empty? or name == anchor)
423
+ get_ref(invoker.args, '', anchor, invoker.top_heading.get_id)
424
+ else
425
+ dest = Deplate::HyperLink.url_anchor(dest, anchor)
426
+ args = invoker.args
427
+ get_wiki(args, name, dest, anchor)
428
+ end
403
429
  end
404
430
 
405
431
  def_abstract :get_wiki
@@ -417,19 +443,22 @@ class Deplate::Formatter::Structured < Deplate::Formatter
417
443
  def format_footnote(invoker)
418
444
  args = invoker.args
419
445
  elt = invoker.elt
420
- if elt and elt.elt and elt.elt.consumed
421
- fn = elt.elt
422
- lab = fn.label
423
- if @deplate.footnotes_used.include?(lab)
424
- return get_footnote_ref(args, lab, fn.body)
446
+ if elt and elt.elt and elt.fn_consumed
447
+ lab = elt.fn_label ||= elt.args['id']
448
+ if lab
449
+ body = elt.format_current
450
+ if @deplate.footnotes_used.include?(lab)
451
+ return get_footnote_ref(args, lab, body)
452
+ else
453
+ @deplate.footnotes_used << lab
454
+ @deplate.footnote_last_idx +=1
455
+ return get_footnote(args, lab, body)
456
+ end
425
457
  else
426
- @deplate.footnotes_used << lab
427
- @deplate.footnote_last_idx +=1
428
- return get_footnote(args, lab, fn.body)
458
+ invoker.log(['Internal error', 'No footnote label', body, elt ? elt : ''], :error)
429
459
  end
430
- else
431
- return ""
432
460
  end
461
+ return ''
433
462
  end
434
463
 
435
464
  def_abstract :get_footnote, :get_footnote_ref
@@ -441,15 +470,17 @@ class Deplate::Formatter::Structured < Deplate::Formatter
441
470
  o = @deplate.label_aliases[text]
442
471
  if o
443
472
  t = o.top_heading.get_id
444
- f0 = container.output_file_name
445
- f = container.output_file_name(:label => text)
446
- f = "" if f == f0
473
+ f = @deplate.get_filename_for_label(invoker, text)
474
+ # f0 = container.output_file_name
475
+ # f = container.output_file_name(:label => text)
476
+ # f = '' if f == f0
447
477
  ref = get_ref(args, f, text, t)
448
478
  else
449
- log(["Undefined label", text], :error)
450
- ref = "??"
479
+ log(['Undefined label', text], :error)
480
+ ref = '??'
451
481
  end
452
- return nonbreakingspace(nil) + ref
482
+ prefix = invoker.args['prefix'] || nonbreakingspace(nil)
483
+ return prefix + ref
453
484
  end
454
485
 
455
486
  def_abstract :get_ref
@@ -464,15 +495,15 @@ class Deplate::Formatter::Structured < Deplate::Formatter
464
495
  args = invoker.args
465
496
  elt = invoker.elt
466
497
  container = invoker.container
467
- n = args["n"]
468
- p = args["p"]
498
+ n = args['n']
499
+ p = args['p']
469
500
  acc = []
470
501
  for c in elt
471
502
  cc = bib_entry(c)
472
503
  if cc
473
504
  e = {}
474
- yr = cc.assoc("year")
475
- yr = if yr then yr[1] else "" end
505
+ yr = cc.assoc('year')
506
+ yr = if yr then yr[1] else '' end
476
507
  e[:year] = yr
477
508
  if n
478
509
  e[:note] = @deplate.parse_and_format(container, n)
@@ -482,9 +513,9 @@ class Deplate::Formatter::Structured < Deplate::Formatter
482
513
  p = @deplate.parse_and_format(container, "#{@deplate.msg("p.\\ ")}#{p}")
483
514
  e[:pages] = p
484
515
  end
485
- nm = cc.assoc("author") || cc.assoc("editor")
516
+ nm = cc.assoc('author') || cc.assoc('editor')
486
517
  if nm
487
- nm = nm[1].gsub(/\s+/, " ").split(" and ").collect do |a|
518
+ nm = nm[1].gsub(/\s+/, ' ').split(' and ').collect do |a|
488
519
  a.scan(/\w+$/)
489
520
  end
490
521
  e[:name] = nm
@@ -566,7 +597,7 @@ class Deplate::Formatter::Structured < Deplate::Formatter
566
597
  end
567
598
 
568
599
  alias :format_bib_entry_re_structured :format_bib_entry
569
- def format_bib_entry(invoker, bibdef)
600
+ def format_bib_entry(invoker, key, bibdef)
570
601
  args = invoker.args
571
602
  bib = Hash[*bibdef.flatten]
572
603
  be = ["author", "title", "pages"]
@@ -581,13 +612,13 @@ class Deplate::Formatter::Structured < Deplate::Formatter
581
612
  # end
582
613
  # end
583
614
  container = {}
584
- bc = ["editor", "year", "booktitle", "publisher", "journal", "volume", "number"]
615
+ bc = ['editor', 'year', 'booktitle', 'publisher', 'journal', 'volume', 'number']
585
616
  process_bib_entry_part(invoker, args, container, bib, bc)
586
617
  # for e in bc
587
618
  # ee = bib[e]
588
619
  # container[e] = self.send("get_bib_%s" % e, args, simple_latex_reformat(ee)) if ee
589
620
  # end
590
- return get_bib_relation(args, bib["type"], entry, container)
621
+ return get_bib_relation(args, bib['@type'], entry, container)
591
622
  end
592
623
 
593
624
  def process_bib_entry_part(invoker, args, accum, bibdef, parts)
@@ -595,7 +626,11 @@ class Deplate::Formatter::Structured < Deplate::Formatter
595
626
  ee = bibdef[e]
596
627
  if ee
597
628
  ee = simple_latex_reformat(ee)
598
- ee = @deplate.parse_and_format(invoker.container, ee)
629
+ ee = @deplate.parse_and_format(invoker, ee, false, [
630
+ Deplate::HyperLink::Extended,
631
+ Deplate::HyperLink::Simple,
632
+ Deplate::HyperLink::Url,
633
+ ])
599
634
  accum[e] = self.send("get_bib_#{e}", args, ee)
600
635
  end
601
636
  end
@@ -611,14 +646,21 @@ class Deplate::Formatter::Structured < Deplate::Formatter
611
646
  def format_heading_open(invoker)
612
647
  l = format_label(invoker)
613
648
  @deplate.options.indentation_level << invoker.level
649
+ invoker.postponed_format << Proc.new do |container|
650
+ container.deplate.options.indentation_level << (container.level + 1)
651
+ end
614
652
  get_heading_open(invoker.args, invoker.level, invoker.level_as_string, invoker.elt, l)
615
653
  end
616
654
 
617
655
  def format_heading_close(invoker)
618
656
  @deplate.options.indentation_level.pop
657
+ @deplate.options.indentation_level.pop
658
+ # invoker.postponed_format << Proc.new do |container|
659
+ # container.deplate.options.indentation_level.pop
660
+ # end
619
661
  get_heading_close(invoker.args, invoker.level)
620
662
  end
621
-
663
+
622
664
  def close_headings(level)
623
665
  hds = @deplate.options.headings
624
666
  if hds
@@ -626,7 +668,7 @@ class Deplate::Formatter::Structured < Deplate::Formatter
626
668
  loop do
627
669
  hd = hds.last
628
670
  if hd and level <= hd.level
629
- acc << format_heading_close(hd)
671
+ acc << indent_text(format_heading_close(hd), :mult => hd.level - level)
630
672
  hds.pop
631
673
  else
632
674
  break
@@ -639,26 +681,32 @@ class Deplate::Formatter::Structured < Deplate::Formatter
639
681
 
640
682
  ################################################ List of ... {{{1
641
683
  def format_list_of_contents(invoker)
642
- format_list_of(invoker, "Table of Contents", @deplate.table_of_contents, "hd", false)
684
+ format_list_of(invoker,
685
+ :title => 'Table of Contents',
686
+ :prefix => 'hd',
687
+ :listing => 'toc',
688
+ :flat => false)
643
689
  end
644
690
  alias :format_list_of_toc :format_list_of_contents
645
691
 
646
692
  def format_list_of_minitoc(invoker)
647
- # <+TBD+>
648
- # data = @deplate.table_of_contents.find_all {|e| e.level == 1}
649
- # format_list_of("Contents", data, "hd", false, deplate.variables["navGif"]) do |hd|
650
- # hd.args["shortcaption"] || hd.args["id"]
693
+ # data = @deplate.options.listings.get('toc').find_all {|e| e.level == 1}
694
+ # format_list_of(invoker, "Contents", "hd",
695
+ # :data => data, :flat => false,
696
+ # :img => @variables["navGif"],
697
+ # :html_class => "minitoc") do |hd|
698
+ # hd.args["shortcaption"] || hd.args["id"]
651
699
  # end
652
700
  end
653
701
 
654
702
  def format_list_of_tables(invoker)
655
- get_list_of_tables(invoker.args, @deplate.table_of_tables)
703
+ get_list_of_tables(invoker.args, @deplate.options.listings.get('lot'))
656
704
  end
657
705
 
658
706
  def_abstract :get_list_of_tables
659
707
 
660
- def format_list_of_figures(invoker)
661
- get_list_of_figures(invoker.args, @deplate.table_of_figures)
708
+ def format_list_of_lof(invoker)
709
+ get_list_of_figures(invoker.args, @deplate.options.listings.get('lof'))
662
710
  end
663
711
 
664
712
  def_abstract :get_list_of_figures
@@ -669,29 +717,40 @@ class Deplate::Formatter::Structured < Deplate::Formatter
669
717
 
670
718
  def_abstract :get_list_of_index
671
719
 
672
- def format_list_of(invoker, name, data, prefix, flat=false)
673
- args = invoker.args
674
- name = args["title"] || name
675
- acc = []
676
- acc << get_contents_open(args, prefix)
677
- ll = 1
678
- accData = []
679
- for hd in data
680
- unless hd.args["noList"]
681
- l = if flat then 1 else hd.level end
682
- f = hd.output_file_name(:relative => invoker)
683
- d = f + "#" + @deplate.elt_label(prefix, hd.level_as_string)
684
- v = if hd.caption then hd.caption.elt else v = hd.elt.dup end
685
- v = [hd.level_as_string, v].join(" ")
686
- b = format_url(invoker, v, d, nil, true)
687
- s = Deplate::ListItem.new(nil, b, "Itemize", "Itemize", l, 0, true)
688
- accData << s
689
- end
690
- end
691
- acc << get_contents_list(args, prefix, accData)
692
- acc << get_contents_close(args, prefix)
693
- join_blocks(acc)
694
- end
720
+ # def format_list_of(invoker, other_args)
721
+ # args = invoker.args
722
+ # name = other_args[:title]
723
+ # prefix = other_args[:prefix]
724
+ # data = other_args[:data]
725
+ # unless data
726
+ # list = other_args[:listing]
727
+ # data = invoker.deplate.options.listings.get(list)
728
+ # unless data
729
+ # invoker.log(['Unknown list', list], :error)
730
+ # end
731
+ # end
732
+ # flat = other_args[:flat] || false
733
+ # name = args["title"] || name
734
+ # acc = []
735
+ # acc << get_contents_open(args, prefix)
736
+ # ll = 1
737
+ # accData = []
738
+ # for hd in data
739
+ # unless hd.args["noList"]
740
+ # l = if flat then 1 else hd.level end
741
+ # f = hd.output_file_name(:relative => invoker)
742
+ # d = f + "#" + @deplate.elt_label(prefix, hd.level_as_string)
743
+ # v = if hd.caption then hd.caption.elt else v = hd.elt.dup end
744
+ # v = [hd.level_as_string, v].join(" ")
745
+ # b = format_url(invoker, v, d, nil, true)
746
+ # s = Deplate::ListItem.new(nil, b, "Itemize", "Itemize", l, 0, true)
747
+ # accData << s
748
+ # end
749
+ # end
750
+ # acc << get_contents_list(args, prefix, accData)
751
+ # acc << get_contents_close(args, prefix)
752
+ # join_blocks(acc)
753
+ # end
695
754
 
696
755
  # <+TBD+>
697
756
  def format_the_index(invoker, name, data, prefix="", flat=false)
@@ -719,12 +778,12 @@ class Deplate::Formatter::Structured < Deplate::Formatter
719
778
  if l and !l.empty?
720
779
  t = l
721
780
  elsif @deplate.options.multi_file_output
722
- t = @deplate.variables["refButton"]
781
+ t = @deplate.variables['refButton']
723
782
  else
724
- t = "I"
783
+ t = 'I'
725
784
  end
726
785
  else
727
- t = @deplate.file_with_suffix(f, "", true)
786
+ t = @deplate.file_with_suffix(f, '', true)
728
787
  end
729
788
  acc << format_url(invoker, t, f, i.label, true)
730
789
  end
@@ -755,9 +814,8 @@ class Deplate::Formatter::Structured < Deplate::Formatter
755
814
 
756
815
  end
757
816
 
817
+
758
818
  class Deplate::Element::Heading
759
- def hook_post_setup_structured
760
- @label_mode = :after
761
- end
819
+ self.label_mode = :after
762
820
  end
763
821