deplate 0.7.3 → 0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS.TXT +3 -0
- data/CHANGES.TXT +248 -175
- data/LICENSE.TXT +0 -0
- data/NEWS.TXT +28 -24
- data/README.TXT +0 -0
- data/TODO.TXT +174 -88
- data/VERSION.TXT +1 -1
- data/bin/deplate +0 -0
- data/bin/deplate.bat +0 -0
- data/etc/deplate.ini +91 -3
- data/lib/action_view/helpers/deplate.rb +45 -0
- data/lib/deplate.rb +6 -1
- data/lib/deplate/abstract-class.rb +0 -0
- data/lib/deplate/bib.rb +576 -0
- data/lib/deplate/builtin.rb +0 -0
- data/lib/deplate/cache.rb +55 -5
- data/lib/deplate/commands.rb +346 -183
- data/lib/deplate/common.rb +209 -48
- data/lib/deplate/converter.rb +12 -6
- data/lib/deplate/core.rb +777 -378
- data/lib/deplate/counters.rb +254 -0
- data/lib/deplate/css/article.css +4 -3
- data/lib/deplate/css/deplate.css +121 -5
- data/lib/deplate/css/heading-navbar.css +0 -0
- data/lib/deplate/css/layout-deplate-print.css +0 -0
- data/lib/deplate/css/layout-deplate.css +0 -0
- data/lib/deplate/css/sans-serif.css +0 -0
- data/lib/deplate/css/serif-e.css +0 -0
- data/lib/deplate/css/serif-rel.css +0 -0
- data/lib/deplate/css/serif.css +9 -3
- data/lib/deplate/css/slides.css +0 -0
- data/lib/deplate/css/tabbar-left.css +0 -0
- data/lib/deplate/css/tabbar-right-ie.css +3 -9
- data/lib/deplate/css/tabbar-right.css +51 -18
- data/lib/deplate/css/tabbar-top.css +7 -1
- data/lib/deplate/css/tabbar.css +0 -0
- data/lib/deplate/css/text-sans-serif.css +0 -0
- data/lib/deplate/css/text-serif.css +0 -0
- data/lib/deplate/define.rb +183 -177
- data/lib/deplate/deplate-string.rb +82 -0
- data/lib/deplate/docbook.rb +236 -128
- data/lib/deplate/elements.rb +584 -417
- data/lib/deplate/etc.rb +163 -101
- data/lib/deplate/external.rb +42 -11
- data/lib/deplate/fmt/dbk-article-4.1.2.rb +0 -0
- data/lib/deplate/fmt/dbk-article.rb +0 -0
- data/lib/deplate/fmt/dbk-book.rb +0 -0
- data/lib/deplate/fmt/dbk-ref.rb +3 -3
- data/lib/deplate/fmt/dbk-slides.rb +0 -0
- data/lib/deplate/fmt/dbk-snippet.rb +0 -0
- data/lib/deplate/fmt/html-snippet.rb +0 -0
- data/lib/deplate/fmt/html.rb +783 -550
- data/lib/deplate/fmt/htmlsite.rb +192 -199
- data/lib/deplate/fmt/htmlslides.rb +0 -0
- data/lib/deplate/fmt/htmlwebsite.rb +3 -3
- data/lib/deplate/fmt/latex-snippet.rb +0 -0
- data/lib/deplate/fmt/latex.rb +242 -83
- data/lib/deplate/fmt/null.rb +32 -0
- data/lib/deplate/fmt/php.rb +4 -4
- data/lib/deplate/fmt/phpsite.rb +6 -5
- data/lib/deplate/fmt/plain.rb +160 -106
- data/lib/deplate/fmt/template.rb +0 -0
- data/lib/deplate/fmt/xhtml10t.rb +0 -0
- data/lib/deplate/formatter-snippet.rb +0 -0
- data/lib/deplate/formatter.rb +613 -301
- data/lib/deplate/input.rb +202 -142
- data/lib/deplate/input/deplate-headings.rb +4 -6
- data/lib/deplate/input/deplate-restricted.rb +15 -9
- data/lib/deplate/input/deplate.rb +2 -4
- data/lib/deplate/input/rdoc.rb +39 -38
- data/lib/deplate/input/template.rb +0 -0
- data/lib/deplate/lib/Makefile.config +29 -0
- data/lib/deplate/lib/latex/deplate.sty +54 -0
- data/lib/deplate/lib/latex/highlight-extra.sty +0 -0
- data/lib/deplate/lib/latex/highlight-typical.sty +0 -0
- data/lib/deplate/lib/php/page-comment.inc.php +216 -0
- data/lib/deplate/lib/tabmenu.js +0 -0
- data/lib/deplate/locale/de.latin1 +155 -17
- data/lib/deplate/locale/ru.koi8-r +0 -0
- data/lib/deplate/locale/zh_cn.gb2312 +0 -0
- data/lib/deplate/macros.rb +133 -82
- data/lib/deplate/messages.rb +6 -4
- data/lib/deplate/metadata.rb +0 -0
- data/lib/deplate/metadata/marshal.rb +0 -0
- data/lib/deplate/metadata/xml.rb +0 -0
- data/lib/deplate/metadata/yaml.rb +0 -0
- data/lib/deplate/mod/anyword.rb +3 -3
- data/lib/deplate/mod/babelfish.rb +4 -4
- data/lib/deplate/mod/code-gvim.rb +8 -4
- data/lib/deplate/mod/code-highlight.rb +3 -3
- data/lib/deplate/mod/colored-log.rb +0 -0
- data/lib/deplate/mod/de.rb +2 -2
- data/lib/deplate/mod/en.rb +0 -0
- data/lib/deplate/mod/endnotes.rb +0 -0
- data/lib/deplate/mod/fr.rb +0 -0
- data/lib/deplate/mod/html-asciimath.rb +0 -0
- data/lib/deplate/mod/html-deplate-button.rb +0 -0
- data/lib/deplate/mod/html-headings-navbar.rb +5 -13
- data/lib/deplate/mod/html-jsmath.rb +39 -0
- data/lib/deplate/mod/html-obfuscate-email.rb +3 -3
- data/lib/deplate/mod/html-sidebar.rb +0 -0
- data/lib/deplate/mod/htmlslides-navbar-fh.rb +3 -3
- data/lib/deplate/mod/iconv.rb +0 -0
- data/lib/deplate/mod/imgurl.rb +4 -4
- data/lib/deplate/mod/inlatex-compound.rb +7 -10
- data/lib/deplate/mod/koma.rb +0 -0
- data/lib/deplate/mod/latex-emph-table-head.rb +0 -0
- data/lib/deplate/mod/latex-styles.rb +7 -4
- data/lib/deplate/mod/latex-verbatim-small.rb +0 -0
- data/lib/deplate/mod/makefile.rb +23 -7
- data/lib/deplate/mod/mark-external-urls.rb +3 -3
- data/lib/deplate/mod/markup-1-warn.rb +10 -10
- data/lib/deplate/mod/markup-1.rb +0 -0
- data/lib/deplate/mod/navbar-png.rb +24 -8
- data/lib/deplate/mod/noindent.rb +0 -0
- data/lib/deplate/mod/numpara.rb +0 -0
- data/lib/deplate/mod/particle-math.rb +4 -4
- data/lib/deplate/mod/php-extra.rb +46 -6
- data/lib/deplate/mod/pstoedit.rb +0 -0
- data/lib/deplate/mod/recode.rb +0 -0
- data/lib/deplate/mod/ru_koi8-r.rb +0 -0
- data/lib/deplate/mod/smart-dash.rb +26 -0
- data/lib/deplate/mod/smiley.rb +69 -7
- data/lib/deplate/mod/soffice.rb +0 -0
- data/lib/deplate/mod/symbols-latin1.rb +14 -23
- data/lib/deplate/mod/symbols-od-utf-8.rb +5 -3
- data/lib/deplate/mod/symbols-plain.rb +5 -35
- data/lib/deplate/mod/symbols-sgml.rb +8 -9
- data/lib/deplate/mod/symbols-utf-8.rb +8 -9
- data/lib/deplate/mod/symbols-xml.rb +5 -9
- data/lib/deplate/mod/syntax-region-alt.rb +5 -5
- data/lib/deplate/mod/utf8.rb +0 -0
- data/lib/deplate/mod/validate-html.rb +0 -0
- data/lib/deplate/mod/xmlrpc.rb +0 -0
- data/lib/deplate/mod/zh-cn-autospace.rb +18 -20
- data/lib/deplate/mod/zh-cn.rb +4 -6
- data/lib/deplate/nukumi2.rb +71 -0
- data/lib/deplate/once-method.rb +0 -0
- data/lib/deplate/output.rb +19 -21
- data/lib/deplate/particles.rb +178 -116
- data/lib/deplate/regions.rb +99 -58
- data/lib/deplate/skeletons.rb +122 -0
- data/lib/deplate/structured.rb +164 -106
- data/lib/deplate/template.rb +67 -43
- data/lib/deplate/templates/html-doc.html +0 -0
- data/lib/deplate/templates/html-left-tabbar-js.html +0 -0
- data/lib/deplate/templates/html-left-tabbar.html +0 -0
- data/lib/deplate/templates/html-tabbar-right-pcomments.php +22 -0
- data/lib/deplate/templates/html-tabbar-right-step.html +24 -0
- data/lib/deplate/templates/html-tabbar-right-table.html +0 -0
- data/lib/deplate/templates/html-tabbar-right.html +2 -4
- data/lib/deplate/templates/html-tabbar-top.html +0 -9
- data/lib/deplate/templates/html-tabbar.html +0 -0
- data/lib/deplate/variables.rb +127 -0
- data/lib/deplate/wiki-markup.rb +99 -33
- data/lib/deplate/xml.rb +18 -18
- data/lib/deplate/zh-cn.rb +0 -0
- data/lib/ps2ppm.rb +0 -0
- data/man/man1/deplate.1 +564 -474
- metadata +201 -186
data/lib/deplate/structured.rb
CHANGED
@@ -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:
|
7
|
-
# @Revision: 0.
|
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,
|
52
|
-
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 "
|
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
|
-
|
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
|
-
|
71
|
-
|
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 "
|
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
|
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
|
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(
|
156
|
-
capAbove = !(caption && caption.args && caption.args.include?(
|
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
|
171
|
-
|
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
|
-
|
292
|
-
|
293
|
-
|
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
|
-
|
381
|
-
|
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(
|
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(
|
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(
|
401
|
-
dest
|
402
|
-
|
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.
|
421
|
-
|
422
|
-
lab
|
423
|
-
|
424
|
-
|
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
|
-
|
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
|
-
|
445
|
-
|
446
|
-
f =
|
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([
|
450
|
-
ref =
|
479
|
+
log(['Undefined label', text], :error)
|
480
|
+
ref = '??'
|
451
481
|
end
|
452
|
-
|
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[
|
468
|
-
p = args[
|
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(
|
475
|
-
yr = if yr then yr[1] else
|
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(
|
516
|
+
nm = cc.assoc('author') || cc.assoc('editor')
|
486
517
|
if nm
|
487
|
-
nm = nm[1].gsub(/\s+/,
|
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 = [
|
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[
|
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
|
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,
|
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
|
-
#
|
648
|
-
#
|
649
|
-
#
|
650
|
-
|
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.
|
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
|
661
|
-
get_list_of_figures(invoker.args, @deplate.
|
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,
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
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[
|
781
|
+
t = @deplate.variables['refButton']
|
723
782
|
else
|
724
|
-
t =
|
783
|
+
t = 'I'
|
725
784
|
end
|
726
785
|
else
|
727
|
-
t = @deplate.file_with_suffix(f,
|
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
|
-
|
760
|
-
@label_mode = :after
|
761
|
-
end
|
819
|
+
self.label_mode = :after
|
762
820
|
end
|
763
821
|
|