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/etc.rb
CHANGED
@@ -3,18 +3,38 @@
|
|
3
3
|
# @Website: http://deplate.sf.net/
|
4
4
|
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
5
5
|
# @Created: 16-Okt-2005.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 29-Apr-2006.
|
7
|
+
# @Revision: 0.308
|
8
8
|
|
9
9
|
require 'deplate/common'
|
10
10
|
|
11
|
+
|
12
|
+
module Deplate::Rx
|
13
|
+
# This function builds recursive regular expressions that are used
|
14
|
+
# for parsing macros and skeletons. The optional argument defines
|
15
|
+
# the depth of nested macros for which the regular expression is
|
16
|
+
# being built. The default is 5 which should be sufficient due to
|
17
|
+
# the primitivity of the macro language. The string "{#}" is
|
18
|
+
# replaced with the regexp itself.
|
19
|
+
def builder(rx_source, rx_opts=nil, depth=5, sol=true)
|
20
|
+
rxr = rx_source.gsub('\\', '\\\\\\\\')
|
21
|
+
for i in 1..depth
|
22
|
+
rx_source.gsub!(/\{#\}/, rxr)
|
23
|
+
end
|
24
|
+
rx_source.gsub!(/\{#\}/, '[^{}]+?')
|
25
|
+
rx_source = '^' + rx_source if sol
|
26
|
+
return Regexp.new(rx_source, rx_opts)
|
27
|
+
end
|
28
|
+
module_function :builder
|
29
|
+
end
|
30
|
+
|
11
31
|
class Deplate::PseudoContainer < Deplate::BaseElement
|
12
32
|
attr_accessor :registered_metadata
|
13
33
|
attr_reader :destination
|
14
34
|
|
15
35
|
def initialize(deplate, args)
|
16
36
|
super(deplate, args)
|
17
|
-
|
37
|
+
self.level_as_string = args[:level_as_string]
|
18
38
|
@top_heading = args[:top] || deplate.get_current_top
|
19
39
|
@registered_metadata = args[:metadata] || []
|
20
40
|
@accum = args[:accum] || []
|
@@ -38,14 +58,15 @@ end
|
|
38
58
|
|
39
59
|
|
40
60
|
class Deplate::NullTop < Deplate::PseudoContainer
|
41
|
-
attr_reader :args, :caption
|
61
|
+
attr_reader :args, :caption, :level_heading
|
42
62
|
attr_accessor :first_top, :last_top, :description
|
43
63
|
|
44
64
|
def initialize(deplate, args)
|
45
65
|
super
|
66
|
+
@level_heading = [0]
|
46
67
|
@destination = args[:destination]
|
47
|
-
@args = {:id =>
|
48
|
-
@caption = deplate.msg(
|
68
|
+
@args = {:id => 'deplateNullTop'}
|
69
|
+
@caption = Deplate::CaptionDef.new(deplate.msg('[Start]'), {}, nil)
|
49
70
|
@description = nil
|
50
71
|
@first_top = false
|
51
72
|
@last_top = false
|
@@ -55,6 +76,72 @@ class Deplate::NullTop < Deplate::PseudoContainer
|
|
55
76
|
end
|
56
77
|
|
57
78
|
|
79
|
+
module Deplate::Footnote
|
80
|
+
attr_reader :fnId
|
81
|
+
# Quack like Deplate::Region
|
82
|
+
attr_reader :accum, :regNote, :label, :level, :caption, :captionOptions
|
83
|
+
|
84
|
+
def footnote_setup(text)
|
85
|
+
if text
|
86
|
+
@fnId = @args['id']
|
87
|
+
if @fnId and text and !text.empty?
|
88
|
+
@regNote = @fnId
|
89
|
+
@accum = text
|
90
|
+
# @level = @container.level
|
91
|
+
fn = Deplate::Regions::Footnote.new(@deplate, @source, @regNote, {}, self)
|
92
|
+
fn.finish
|
93
|
+
else
|
94
|
+
@fnId ||= text
|
95
|
+
end
|
96
|
+
if @container.kind_of?(Deplate::Element::Table)
|
97
|
+
@container.contains_footnotes = true
|
98
|
+
end
|
99
|
+
else
|
100
|
+
log('No footnote ID', :error)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def footnote_process
|
105
|
+
fn = @deplate.footnotes[@fnId]
|
106
|
+
if fn
|
107
|
+
# fn.elt.consumed = true
|
108
|
+
fn.fn_consumed = true
|
109
|
+
@elt = fn
|
110
|
+
else
|
111
|
+
log(['Unknown footnote', @fnId, @deplate.footnotes.keys.inspect], :error)
|
112
|
+
@elt = nil
|
113
|
+
end
|
114
|
+
return format_particle(:format_footnote, self)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
class Deplate::IndexEntry
|
120
|
+
attr_accessor :container, :name, :synonymes, :label
|
121
|
+
attr_writer :file, :level_as_string
|
122
|
+
|
123
|
+
def initialize(container)
|
124
|
+
@container = container
|
125
|
+
unless container
|
126
|
+
# p "DBG IndexEntry: container = nil"
|
127
|
+
end
|
128
|
+
if block_given?
|
129
|
+
yield(self)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def file(invoker=nil)
|
134
|
+
# @file || (@container && @container.output_file_name(:relative => invoker))
|
135
|
+
@file
|
136
|
+
end
|
137
|
+
|
138
|
+
def level_as_string
|
139
|
+
# @level_as_string || (@container && @container.level_as_string)
|
140
|
+
@level_as_string
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
|
58
145
|
class Deplate::Source
|
59
146
|
attr_accessor :file, :begin, :end, :level_as_string, :stats
|
60
147
|
|
@@ -68,104 +155,12 @@ class Deplate::Source
|
|
68
155
|
end
|
69
156
|
|
70
157
|
|
71
|
-
module Deplate::Symbols
|
72
|
-
end
|
158
|
+
# module Deplate::Symbols
|
159
|
+
# end
|
73
160
|
|
74
161
|
|
75
|
-
class Deplate::Variables < Hash
|
76
|
-
attr_accessor :deplate
|
77
|
-
|
78
|
-
def initialize(deplate=nil)
|
79
|
-
super()
|
80
|
-
@deplate = deplate
|
81
|
-
end
|
82
|
-
|
83
|
-
def update(hash)
|
84
|
-
for key, val in hash
|
85
|
-
self[key] = val
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def []=(name, value)
|
90
|
-
if (m = /^(\S+)\[(\S+)?\]$/.match(name))
|
91
|
-
key = m[1]
|
92
|
-
field = m[2]
|
93
|
-
var = self[key]
|
94
|
-
if !var
|
95
|
-
if !field
|
96
|
-
self[key] = [value]
|
97
|
-
elsif field =~ /^[0-9]$/
|
98
|
-
self[key] = []
|
99
|
-
self[key][field.to_i] = value
|
100
|
-
else
|
101
|
-
self[key] = {field => value}
|
102
|
-
end
|
103
|
-
elsif var.kind_of?(Struct) || var.kind_of?(OpenStruct)
|
104
|
-
var.send("#{field}=", value)
|
105
|
-
elsif var.kind_of?(Hash)
|
106
|
-
var[field] = value
|
107
|
-
elsif var.kind_of?(Array)
|
108
|
-
if !field
|
109
|
-
var << value
|
110
|
-
elsif field =~ /^[0-9]+$/
|
111
|
-
field = field.to_i
|
112
|
-
var[field] = value
|
113
|
-
else
|
114
|
-
Deplate::Core.log(["Wrong index", field, name, var.class], :error)
|
115
|
-
end
|
116
|
-
elsif var
|
117
|
-
Deplate::Core.log(["Doc variable has wrong type", key, var.class], :error)
|
118
|
-
end
|
119
|
-
else
|
120
|
-
super
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
def [](name)
|
125
|
-
begin
|
126
|
-
if keys.include?(name)
|
127
|
-
return super
|
128
|
-
elsif name =~ /^\S+\(.*\)$/
|
129
|
-
m = /^(\S+)\((.*?)?\)$/.match(name)
|
130
|
-
if m
|
131
|
-
method = m[1]
|
132
|
-
args = m[2]
|
133
|
-
args, text = @deplate.input.parse_args(args, nil, false)
|
134
|
-
return @deplate.invoke_service(method, args, text)
|
135
|
-
else
|
136
|
-
Deplate::Core.log(["Malformed variable name", name], :error)
|
137
|
-
end
|
138
|
-
elsif (m = /^(\S+)\[(\S+)\]$/.match(name))
|
139
|
-
key = m[1]
|
140
|
-
field = m[2]
|
141
|
-
var = self[key]
|
142
|
-
if var.kind_of?(Struct) || var.kind_of?(OpenStruct)
|
143
|
-
return var.send(field)
|
144
|
-
elsif var.kind_of?(Hash)
|
145
|
-
return var[field]
|
146
|
-
elsif var.kind_of?(Array)
|
147
|
-
if field =~ /^[0-9]+$/
|
148
|
-
field = field.to_i
|
149
|
-
return var[field]
|
150
|
-
else
|
151
|
-
Deplate::Core.log(['Wrong index', field, name, var.class], :error)
|
152
|
-
end
|
153
|
-
elsif var
|
154
|
-
# <+TBD+> this is unsave
|
155
|
-
# return var.send(field)
|
156
|
-
Deplate::Core.log(['Variable has wrong type', key, var.class], :error)
|
157
|
-
else
|
158
|
-
Deplate::Core.log(['Unknown variable', key], :error)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
rescue Exception => e
|
162
|
-
Deplate::Core.log(['Retrieving doc variable failed', name, e], :error)
|
163
|
-
end
|
164
|
-
return nil
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
162
|
module Deplate::Void
|
163
|
+
module_function
|
169
164
|
end
|
170
165
|
|
171
166
|
# Based on code by:
|
@@ -197,3 +192,70 @@ class << Deplate::Safe
|
|
197
192
|
end
|
198
193
|
end
|
199
194
|
|
195
|
+
|
196
|
+
class Deplate::Symbols < Deplate::CommonObject
|
197
|
+
class_attribute :myname
|
198
|
+
|
199
|
+
class << self
|
200
|
+
def hook_post_myname=(name)
|
201
|
+
klass = self
|
202
|
+
Deplate::Core.declare_symbols(name, klass)
|
203
|
+
end
|
204
|
+
|
205
|
+
def register_as(*names)
|
206
|
+
for n in names
|
207
|
+
hook_post_myname=(n)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def initialize(deplate)
|
213
|
+
@deplate = deplate
|
214
|
+
@formatter = @deplate.formatter
|
215
|
+
end
|
216
|
+
|
217
|
+
def symbol_quote(invoker)
|
218
|
+
'"'
|
219
|
+
end
|
220
|
+
|
221
|
+
def symbol_gt(invoker)
|
222
|
+
">"
|
223
|
+
end
|
224
|
+
|
225
|
+
def symbol_lt(invoker)
|
226
|
+
"<"
|
227
|
+
end
|
228
|
+
|
229
|
+
def symbol_amp(invoker)
|
230
|
+
"&"
|
231
|
+
end
|
232
|
+
|
233
|
+
def doublequote_open(invoker)
|
234
|
+
%{"}
|
235
|
+
end
|
236
|
+
|
237
|
+
def doublequote_close(invoker)
|
238
|
+
%{"}
|
239
|
+
end
|
240
|
+
|
241
|
+
def singlequote_open(invoker)
|
242
|
+
%{'}
|
243
|
+
end
|
244
|
+
|
245
|
+
def singlequote_close(invoker)
|
246
|
+
%{'}
|
247
|
+
end
|
248
|
+
|
249
|
+
def nonbreakingspace(invoker)
|
250
|
+
%{ }
|
251
|
+
end
|
252
|
+
|
253
|
+
def symbol_paragraph(invoker)
|
254
|
+
%{§}
|
255
|
+
end
|
256
|
+
|
257
|
+
def format_symbol(invoker, sym)
|
258
|
+
return @formatter.plain_text(sym)
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
data/lib/deplate/external.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: 04-Sep-2004.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 08-Apr-2006.
|
7
|
+
# @Revision: 0.206
|
8
8
|
|
9
9
|
require "ps2ppm"
|
10
10
|
|
@@ -26,12 +26,19 @@ module Deplate::External
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def get_app(name, default=nil)
|
29
|
-
@@apps[name]
|
29
|
+
app = @@apps[name]
|
30
|
+
unless app
|
31
|
+
app = default || name
|
32
|
+
if RUBY_PLATFORM =~ /mswin/ and app !~ /\.\w+$/
|
33
|
+
app += '.exe'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
app
|
30
37
|
end
|
31
38
|
|
32
39
|
def log_popen(container, cmd)
|
33
40
|
rv = []
|
34
|
-
if container.deplate.
|
41
|
+
if container.deplate.allow_external
|
35
42
|
container.log(["PWD", Dir.pwd])
|
36
43
|
container.log(["Exec", cmd])
|
37
44
|
begin
|
@@ -41,8 +48,8 @@ module Deplate::External
|
|
41
48
|
else
|
42
49
|
until io.eof
|
43
50
|
l = io.gets
|
44
|
-
rv << l
|
45
|
-
puts l
|
51
|
+
rv << l.chomp
|
52
|
+
puts l unless Deplate::Core.quiet?
|
46
53
|
end
|
47
54
|
end
|
48
55
|
end
|
@@ -60,7 +67,7 @@ module Deplate::External
|
|
60
67
|
# directory, i.e., that the proper working directory was previously
|
61
68
|
# set
|
62
69
|
def write_file(container, filename, &block)
|
63
|
-
if container.deplate.
|
70
|
+
if container.deplate.allow_external
|
64
71
|
File.open(filename, "w") {|io| block.call(io)}
|
65
72
|
end
|
66
73
|
end
|
@@ -79,21 +86,45 @@ module Deplate::External
|
|
79
86
|
end
|
80
87
|
|
81
88
|
def ps2img(instance, device, psfile, outfile, args)
|
82
|
-
r = args["rx"] || instance.deplate.variables["ps2imgRes"] || 96
|
83
|
-
|
89
|
+
# r = args["rx"] || instance.deplate.variables["ps2imgRes"] || 96
|
90
|
+
r = args["rx"] || instance.deplate.variables["ps2imgRes"] || 120
|
84
91
|
# r = args["rx"] || 140
|
85
92
|
# case device
|
86
93
|
# when "pdf"
|
87
94
|
# log_popen(instance, "#{get_app('ps2pdf'} #{psfile} #{outfile}")
|
88
95
|
# else
|
89
96
|
# log_popen(instance, "#{get_app('ps2ppm'} -o -r #{r} -g -t -f #{device} #{psfile}")
|
90
|
-
|
97
|
+
# log_popen(instance, "#{get_app('convert')} -antialias -density #{r}x#{r} #{psfile} #{outfile}")
|
91
98
|
Ps2ppm.run(psfile, "o" => true, "r" => r, "g" => true, "t" => true, "f" => device)
|
92
99
|
# end
|
93
100
|
end
|
94
101
|
|
102
|
+
def jave(instance, imgfile, args)
|
103
|
+
variables = args[:deplate].variables
|
104
|
+
cmd = ["#{get_app('jave')} image2ascii #{imgfile}"]
|
105
|
+
alg = args['ascii_algorithm'] || args['algorithm'] ||
|
106
|
+
variables['ascii_algorithm'] || 'edge_detection'
|
107
|
+
cmd << "algorithm=#{alg}"
|
108
|
+
width = args['ascii_width'] || args['width'] || variables['ascii_width']
|
109
|
+
if width =~ /^(\d+)%$/
|
110
|
+
width = 80 * $1.to_i / 100
|
111
|
+
elsif width =~ /^(\d+)cm$/
|
112
|
+
width = $1.to_i / 2
|
113
|
+
elsif width =~ /^(\d+)mm$/
|
114
|
+
width = $1.to_i / 20
|
115
|
+
elsif width =~ /^(\d+)px$/ or width.to_i > 120
|
116
|
+
width = $1.to_i / 8
|
117
|
+
elsif width =~ /^(\d+)pt$/
|
118
|
+
width = $1.to_i / 8
|
119
|
+
elsif width !~ /^(\d+)$/
|
120
|
+
width = nil
|
121
|
+
end
|
122
|
+
cmd << "width=#{width}" if width
|
123
|
+
log_popen(instance, cmd.join(' '))
|
124
|
+
end
|
125
|
+
|
95
126
|
def dot(instance, device, dotfile, outfile, command_line_args=[])
|
96
|
-
c = command_line_args.join(
|
127
|
+
c = command_line_args.join(' ')
|
97
128
|
log_popen(instance, "#{get_app('dot')} -T#{device} -o#{outfile} #{c} #{dotfile}")
|
98
129
|
end
|
99
130
|
|
File without changes
|
File without changes
|
data/lib/deplate/fmt/dbk-book.rb
CHANGED
File without changes
|
data/lib/deplate/fmt/dbk-ref.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: 02-Apr-2006.
|
7
|
+
# @Revision: 0.2125
|
8
8
|
|
9
9
|
require "deplate/docbook"
|
10
10
|
|
@@ -26,7 +26,7 @@ class Deplate::Formatter::DbkRef < Deplate::Formatter::Docbook
|
|
26
26
|
out = @deplate.variables["refentry"]
|
27
27
|
unless out
|
28
28
|
out = @deplate.options.out
|
29
|
-
out = File.basename(out,
|
29
|
+
out = File.basename(out, '.*')
|
30
30
|
@deplate.variables["refentry"] = out
|
31
31
|
end
|
32
32
|
o = []
|
File without changes
|
File without changes
|
File without changes
|
data/lib/deplate/fmt/html.rb
CHANGED
@@ -3,9 +3,10 @@
|
|
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.4111
|
8
8
|
|
9
|
+
# require 'cgi'
|
9
10
|
require 'uri'
|
10
11
|
require 'parsedate'
|
11
12
|
require 'time'
|
@@ -16,9 +17,9 @@ require 'deplate/formatter'
|
|
16
17
|
# A sample html formatter.
|
17
18
|
|
18
19
|
class Deplate::Formatter::HTML < Deplate::Formatter
|
19
|
-
self.myname =
|
20
|
+
self.myname = 'html'
|
20
21
|
self.rx = /html?/i
|
21
|
-
self.suffix =
|
22
|
+
self.suffix = '.html'
|
22
23
|
|
23
24
|
self.label_delegate = [
|
24
25
|
:format_heading,
|
@@ -37,7 +38,7 @@ class Deplate::Formatter::HTML < Deplate::Formatter
|
|
37
38
|
:format_paragraph,
|
38
39
|
:format_verbatim,
|
39
40
|
]
|
40
|
-
|
41
|
+
|
41
42
|
attr_accessor :html_class
|
42
43
|
|
43
44
|
|
@@ -45,14 +46,16 @@ class Deplate::Formatter::HTML < Deplate::Formatter
|
|
45
46
|
def initialize(deplate, args)
|
46
47
|
super
|
47
48
|
# Create OpenOffice compatible footnotes
|
48
|
-
@footnote_template
|
49
|
-
@
|
49
|
+
@footnote_template = 'sdfootnote%dsym'
|
50
|
+
@html_navigation_note = nil
|
51
|
+
@is_html_pageicons = false
|
50
52
|
@special_symbols = {
|
51
53
|
%{"} => %{"},
|
52
54
|
%{>} => %{>},
|
53
55
|
%{<} => %{<},
|
54
56
|
%{&} => %{&},
|
55
|
-
%{
|
57
|
+
# %{�} => %{€},
|
58
|
+
%{ } => lambda {|escaped| escaped ? ' ' : ' '},
|
56
59
|
}
|
57
60
|
build_plain_text_rx
|
58
61
|
@encodings = {
|
@@ -63,29 +66,35 @@ class Deplate::Formatter::HTML < Deplate::Formatter
|
|
63
66
|
def hook_post_write_file_html
|
64
67
|
@deplate.options.css.each do |name, anyway|
|
65
68
|
begin
|
66
|
-
src
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
File.
|
71
|
-
|
69
|
+
src = @deplate.collected_css[name]
|
70
|
+
if src
|
71
|
+
css = File.basename(src)
|
72
|
+
dest = @deplate.auxiliary_filename(css, true)
|
73
|
+
if anyway or !File.exist?(dest)
|
74
|
+
@deplate.copy_file(src, dest)
|
75
|
+
end
|
76
|
+
else
|
77
|
+
srcc = @deplate.auxiliary_filename("#{name}.css", true)
|
78
|
+
unless File.exist?(srcc)
|
79
|
+
log(['File not found', srcc], :error)
|
80
|
+
end
|
72
81
|
end
|
73
82
|
rescue
|
74
|
-
log(["Can't copy css file",
|
83
|
+
log(["Can't copy css file", name], :error)
|
75
84
|
end
|
76
85
|
end
|
77
86
|
end
|
78
87
|
|
79
88
|
def hook_pre_body_flush_html
|
80
|
-
url = @variables[
|
89
|
+
url = @variables['baseUrl']
|
81
90
|
if url
|
82
|
-
fn =
|
83
|
-
if fn && fn !=
|
91
|
+
fn = output_destination
|
92
|
+
if fn && fn != '-'
|
84
93
|
fn = Pathname.new(fn).expand_path
|
85
|
-
unless fn.dirname.to_s ==
|
94
|
+
unless fn.dirname.to_s == '.'
|
86
95
|
pwd = Pathname.new(Dir.pwd).expand_path
|
87
|
-
fn = fn.relative_path_from(pwd).to_s.gsub(/\\/,
|
88
|
-
fp = @variables[
|
96
|
+
fn = fn.relative_path_from(pwd).to_s.gsub(/\\/, '/')
|
97
|
+
fp = @variables['baseUrlStripDir']
|
89
98
|
if fp
|
90
99
|
fn = fn.split(/\//)
|
91
100
|
fn = fn[fp.to_i..-1]
|
@@ -118,19 +127,19 @@ class Deplate::Formatter::HTML < Deplate::Formatter
|
|
118
127
|
def prepare
|
119
128
|
html_head
|
120
129
|
|
121
|
-
bodyOpts = @variables[
|
130
|
+
bodyOpts = @variables['bodyOptions'] || ''
|
122
131
|
output_at(:pre, :body_beg, %{<body #{bodyOpts}>\n<a name="#pagetop"></a>})
|
123
132
|
|
124
|
-
output_at(:post, :body_end,
|
125
|
-
output_at(:post, :doc_end,
|
133
|
+
output_at(:post, :body_end, '</body>')
|
134
|
+
output_at(:post, :doc_end, '</html>')
|
126
135
|
end
|
127
136
|
|
128
137
|
def html_head
|
129
138
|
output_at(:pre, :doc_def, head_doctype)
|
130
139
|
output_at(:pre, :doc_beg, html_def)
|
131
|
-
output_at(:pre, :head_beg,
|
140
|
+
output_at(:pre, :head_beg, '<head>')
|
132
141
|
|
133
|
-
t = @variables[
|
142
|
+
t = @variables['encoding'] || 'ISO-8859-1'
|
134
143
|
t = canonic_enc_name(t)
|
135
144
|
t = %{http-equiv="content-type" content="text/html; charset=#{t}"}
|
136
145
|
output_at(:pre, :head, head_meta_tag(t))
|
@@ -146,9 +155,9 @@ class Deplate::Formatter::HTML < Deplate::Formatter
|
|
146
155
|
date = date.elt
|
147
156
|
if date =~ /^\d\d(\d\d)$/
|
148
157
|
date = Time.local(date)
|
149
|
-
|
150
|
-
if date =~ /^(\w+)\s
|
151
|
-
date = "1-#$1-#$
|
158
|
+
elsif !date.empty?
|
159
|
+
if date =~ /^(\w+)(\s+|-|\.|\/)(\d\d(\d\d))$/
|
160
|
+
date = "1-#$1-#$3"
|
152
161
|
end
|
153
162
|
begin
|
154
163
|
date = ParseDate.parsedate(date, true)
|
@@ -159,14 +168,18 @@ class Deplate::Formatter::HTML < Deplate::Formatter
|
|
159
168
|
end
|
160
169
|
end
|
161
170
|
end
|
162
|
-
date
|
163
|
-
|
164
|
-
|
171
|
+
if date == ''
|
172
|
+
date = nil
|
173
|
+
else
|
174
|
+
date ||= Time.now
|
175
|
+
# date = date.xmlschema
|
176
|
+
date = xmlschema(date)
|
177
|
+
end
|
165
178
|
|
166
|
-
title = @deplate.get_clip(
|
179
|
+
title = @deplate.get_clip('title')
|
167
180
|
title = clean_tags(title.elt) if title
|
168
181
|
|
169
|
-
if @variables[
|
182
|
+
if @variables['useDublinCore']
|
170
183
|
output_at(:pre, :head_meta, head_meta_tag(%{name="DC.Title" content="%s"}) % title) if title
|
171
184
|
output_at(:pre, :head_meta, head_meta_tag(%{name="DC.Creator" content="%s"}) % author) if author
|
172
185
|
# DC.Subject
|
@@ -179,24 +192,24 @@ class Deplate::Formatter::HTML < Deplate::Formatter
|
|
179
192
|
else
|
180
193
|
output_at(:pre, :head_meta, head_meta_tag(%{name="author" content="%s"}) % author) if author
|
181
194
|
output_at(:pre, :head_meta, head_meta_tag(%{name="description" content="%s"}) % desc) if desc
|
182
|
-
output_at(:pre, :head_meta, head_meta_tag(%{name="keywords" content="%s"}) % kw.join(
|
195
|
+
output_at(:pre, :head_meta, head_meta_tag(%{name="keywords" content="%s"}) % kw.join(', ')) if kw
|
183
196
|
output_at(:pre, :head_meta, head_meta_tag(%{name="language" content="%s"}) % lang) if lang
|
184
197
|
output_at(:pre, :head_meta, head_meta_tag(%{name="date" content="%s"}) % date) if date
|
185
198
|
end
|
186
|
-
output_at(:pre, :head_meta, head_meta_tag(%{name="generator" content="deplate.rb #{Deplate::Core.version}"})) unless @variables[
|
187
|
-
md = @variables[
|
199
|
+
output_at(:pre, :head_meta, head_meta_tag(%{name="generator" content="deplate.rb #{Deplate::Core.version}"})) unless @variables['noGenerator']
|
200
|
+
md = @variables['metaDataExtra']
|
188
201
|
output_at(:pre, :head_meta, md) if md
|
189
202
|
|
190
203
|
output_at(:pre, :head_title, %{<title>%s</title>} % title) if title
|
191
204
|
|
192
|
-
headExtra = @variables[
|
205
|
+
headExtra = @variables['headExtra']
|
193
206
|
headExtra = headExtra.join("\n") if headExtra.kind_of?(Array)
|
194
207
|
output_at(:pre, :head_extra, headExtra) if headExtra and !headExtra.empty?
|
195
208
|
|
196
209
|
css = head_css
|
197
210
|
output_at(:pre, :css, css) unless css.empty?
|
198
211
|
|
199
|
-
styleExtra = @variables[
|
212
|
+
styleExtra = @variables['styleExtra']
|
200
213
|
if styleExtra
|
201
214
|
styleExtra = styleExtra.join("\n") if styleExtra.kind_of?(Array)
|
202
215
|
styleExtra = <<EOH
|
@@ -210,14 +223,20 @@ EOH
|
|
210
223
|
end
|
211
224
|
|
212
225
|
shortcutIcon = @variables["shortcutIcon"]
|
213
|
-
|
226
|
+
if shortcutIcon
|
227
|
+
shortcutIcon = escape_filename(shortcutIcon)
|
228
|
+
output_at(:pre, :head_end, head_link_tag(%{rel="shortcut icon" href="#{shortcutIcon}" type="image/x-icon"}))
|
229
|
+
end
|
214
230
|
pageicon = @variables["pageIcon"]
|
215
|
-
|
231
|
+
if pageicon
|
232
|
+
pageicon = escape_filename(pageicon)
|
233
|
+
output_at(:pre, :head_end, head_link_tag(%{rel="icon" href="#{pageicon}" type="image/x-icon"}))
|
234
|
+
end
|
216
235
|
|
217
|
-
output_at(:pre, :html_relations,
|
236
|
+
output_at(:pre, :html_relations, invoke_service('navigation_links')) unless @variables['noPageNavigation']
|
218
237
|
|
219
|
-
output_at(:pre, :head_end, @variables[
|
220
|
-
output_at(:pre, :head_end,
|
238
|
+
output_at(:pre, :head_end, @variables['explorerHack'])
|
239
|
+
output_at(:pre, :head_end, '</head>')
|
221
240
|
end
|
222
241
|
|
223
242
|
def head_meta_tag(text)
|
@@ -230,11 +249,11 @@ EOH
|
|
230
249
|
|
231
250
|
def xmlschema(time)
|
232
251
|
z = time.zone.scan(/([+-])(\d+):(\d+)/)[0]
|
233
|
-
z = z ? (
|
252
|
+
z = z ? ('%s%02d:%02d' % z) : ''
|
234
253
|
if time.hour != 0 or time.min != 0 or time.sec != 0
|
235
|
-
time.strftime(
|
254
|
+
time.strftime('%Y-%m-%dT%H:%M:%S' + z)
|
236
255
|
else
|
237
|
-
time.strftime(
|
256
|
+
time.strftime('%Y-%m-%d')
|
238
257
|
end
|
239
258
|
end
|
240
259
|
private :xmlschema
|
@@ -253,7 +272,7 @@ EOH
|
|
253
272
|
id = use_id(args, opts)
|
254
273
|
oid = opts['id']
|
255
274
|
if oid and oid != id
|
256
|
-
log(['ID mismatch', id, oid, opts, args], :error)
|
275
|
+
invoker.log(['ID mismatch', id, oid, opts, args], :error)
|
257
276
|
end
|
258
277
|
opts['id'] = encode_id(id) if id
|
259
278
|
# args = args.dup
|
@@ -268,7 +287,7 @@ EOH
|
|
268
287
|
case cls
|
269
288
|
when Array
|
270
289
|
unless opts['class'].empty?
|
271
|
-
opts['class'] = opts['class']
|
290
|
+
opts['class'] = class_attr(opts['class'])
|
272
291
|
end
|
273
292
|
when nil
|
274
293
|
opts['class'] = get_html_class(invoker)
|
@@ -279,23 +298,11 @@ EOH
|
|
279
298
|
end
|
280
299
|
end
|
281
300
|
if single
|
282
|
-
opts <<
|
301
|
+
opts << '/'
|
283
302
|
end
|
284
|
-
%{<%s>} % [tag, *opts].compact.join(
|
303
|
+
%{<%s>} % [tag, *opts].compact.join(' ')
|
285
304
|
end
|
286
305
|
|
287
|
-
def consume_label(label, warn=false)
|
288
|
-
if !label
|
289
|
-
return false
|
290
|
-
elsif @consumed_labels.include?(label)
|
291
|
-
log(['Duplicate label'], label, :error) if warn
|
292
|
-
return false
|
293
|
-
else
|
294
|
-
@consumed_labels << label
|
295
|
-
return true
|
296
|
-
end
|
297
|
-
end
|
298
|
-
|
299
306
|
def close_tag(invoker, tag)
|
300
307
|
%{</%s>} % tag
|
301
308
|
end
|
@@ -304,76 +311,145 @@ EOH
|
|
304
311
|
[open_tag(invoker, tag, opts), text, close_tag(invoker, tag)].join
|
305
312
|
end
|
306
313
|
|
314
|
+
def wrap_formatted_particle_styles(invoker, value, args)
|
315
|
+
s = args[:styles]
|
316
|
+
unless !s or s.empty?
|
317
|
+
value.sub!(/\A(\s*)(.*?)(\s*)\Z/m) do |m|
|
318
|
+
%{#$1<span class="#{class_attr(s)}">#$2</span>#$3}
|
319
|
+
end
|
320
|
+
end
|
321
|
+
value
|
322
|
+
end
|
323
|
+
|
324
|
+
def wrap_formatted_element_styles(invoker, value, args)
|
325
|
+
s = args[:styles]
|
326
|
+
unless !s or s.empty?
|
327
|
+
value.sub!(/\A(\s*)(.*?)(\s*)\Z/m) do |m|
|
328
|
+
<<EOT
|
329
|
+
#$1<div class="#{class_attr(s)}">
|
330
|
+
#$2
|
331
|
+
</div>#$3
|
332
|
+
EOT
|
333
|
+
end
|
334
|
+
end
|
335
|
+
value
|
336
|
+
end
|
337
|
+
|
338
|
+
def wrap_formatted_element_zz_stepwise(invoker, value, args)
|
339
|
+
if @variables['stepwiseDisplay']
|
340
|
+
@deplate.output.attributes[:stepwiseIdx] ||= 0
|
341
|
+
idx = @deplate.output.attributes[:stepwiseIdx] += 1
|
342
|
+
beg = (@variables['stepwiseBegin'] || '1').to_i
|
343
|
+
vis = idx > beg ? 'hidden' : 'visible'
|
344
|
+
value.sub!(/\A(\s*)(.*?)(\s*)\Z/m) do |m|
|
345
|
+
<<EOT
|
346
|
+
#$1<div id="Step#{idx}" style="visibility:#{vis};">
|
347
|
+
#$2
|
348
|
+
#$1</div>#$3
|
349
|
+
EOT
|
350
|
+
end
|
351
|
+
end
|
352
|
+
value
|
353
|
+
end
|
354
|
+
|
307
355
|
def wrap_text(text, args={})
|
308
356
|
args[:check] ||= lambda do |line|
|
309
357
|
line =~ /<[^>]*$/
|
310
358
|
end
|
311
359
|
super(text, args)
|
312
360
|
end
|
313
|
-
|
361
|
+
|
362
|
+
def class_attr(classes)
|
363
|
+
classes.flatten.compact.uniq.join(' ')
|
364
|
+
end
|
365
|
+
|
314
366
|
|
315
367
|
################################################ Lists {{{1
|
316
|
-
def format_list_item(invoker, type, level, item,
|
368
|
+
def format_list_item(invoker, type, level, item, args={})
|
317
369
|
indent = format_indent(level, true)
|
318
370
|
body = item.body
|
319
|
-
|
320
|
-
|
321
|
-
html_class ||= item.style || get_html_class(invoker)
|
371
|
+
opts = {'class' => []}
|
372
|
+
html_class ||= get_html_class(invoker, :add => item.style, :set => false)
|
322
373
|
if html_class
|
323
|
-
opts[
|
374
|
+
opts['class'] << html_class
|
324
375
|
end
|
325
376
|
case type
|
326
|
-
when
|
377
|
+
when 'Ordered', 'Itemize'
|
378
|
+
explicit = args[:explicit]
|
327
379
|
ev = list_item_explicit_value(item, explicit)
|
328
380
|
if ev
|
329
|
-
|
381
|
+
ev = ev.sub(/\.\s*$/, '')
|
382
|
+
if ev =~ /^([[:lower:]])$/
|
383
|
+
ev = $1[0] - 96
|
384
|
+
elsif ev =~ /^([[:upper:]])$/
|
385
|
+
ev = $1[0] - 64
|
386
|
+
end
|
387
|
+
opts['value'] = ev.to_s
|
330
388
|
else
|
331
389
|
case item.item
|
332
|
-
when
|
333
|
-
opts[
|
334
|
-
when
|
335
|
-
opts[
|
336
|
-
when
|
337
|
-
opts[
|
338
|
-
when
|
339
|
-
opts[
|
390
|
+
when '-'
|
391
|
+
opts['class'] << 'dash'
|
392
|
+
when '+'
|
393
|
+
opts['class'] << 'plus'
|
394
|
+
when '*'
|
395
|
+
opts['class'] << 'asterisk'
|
396
|
+
when '�'
|
397
|
+
opts['class'] << 'bullet'
|
340
398
|
end
|
341
399
|
end
|
342
|
-
li = open_tag(invoker,
|
400
|
+
li = open_tag(invoker, 'li', opts)
|
343
401
|
# indent1 = format_indent(level + 1, true)
|
344
402
|
# return %{#{indent}#{li}\n#{indent1}#{body}}, %{#{indent}</li>}
|
345
|
-
body = indent_text(body, level + 1)
|
403
|
+
body = indent_text(wrap_text(body), :mult => level + 1)
|
346
404
|
return %{#{indent}#{li}\n#{body}}, %{#{indent}</li>}
|
347
|
-
when
|
348
|
-
dt = open_tag(invoker,
|
349
|
-
dd = open_tag(invoker,
|
405
|
+
when 'Description'
|
406
|
+
dt = open_tag(invoker, 'dt', opts)
|
407
|
+
dd = open_tag(invoker, 'dd', opts)
|
350
408
|
accum = []
|
351
409
|
accum << "#{dt}#{item.item}</dt>\n" if item.item
|
352
410
|
accum << "#{dd}\n"
|
353
|
-
accum << indent_text(body, 1) if body
|
354
|
-
return indent_text(accum.join, level), "#{indent}</dd>"
|
355
|
-
when
|
356
|
-
|
411
|
+
accum << indent_text(wrap_text(body), :mult => 1) if body
|
412
|
+
return indent_text(accum.join, :mult => level), "#{indent}</dd>"
|
413
|
+
when 'Task'
|
414
|
+
pri = item.opts[:priority]
|
415
|
+
cat = item.opts[:category]
|
416
|
+
done = item.opts[:done] ? 'done' : nil
|
417
|
+
due = item.opts[:due]
|
418
|
+
opts = {}
|
419
|
+
cls = cat ? [html_class, cat].join('-') : html_class
|
420
|
+
opts['class'] = class_attr([cls, done])
|
421
|
+
li = open_tag(invoker, 'li', opts)
|
422
|
+
task = [cat, pri].compact.join
|
423
|
+
task += " #{due}" if due
|
424
|
+
body = [%{<span class="#{cls}">#{task}</span>}, body].join(' ')
|
425
|
+
body = indent_text(wrap_text(body), :mult => level + 1)
|
426
|
+
return %{#{indent}#{li}\n#{body}}, %{#{indent}</li>}
|
427
|
+
when 'Paragraph'
|
428
|
+
body = wrap_text(body)
|
429
|
+
body = %{<br class="itempara" />#{body}} unless args[:follow_container]
|
430
|
+
return indent_text(body, :mult => 2), nil
|
431
|
+
when 'Container'
|
432
|
+
return body, nil
|
357
433
|
else
|
358
|
-
|
434
|
+
invoker.log(['Unknown list type', type], :error)
|
359
435
|
end
|
360
436
|
end
|
361
437
|
|
362
438
|
def format_list_env(invoker, type, level, what, subtype=nil)
|
363
439
|
indent = format_indent(level)
|
364
440
|
opts = {'class' => []}
|
365
|
-
html_class ||= get_html_class(invoker)
|
441
|
+
html_class ||= get_html_class(invoker, :add => type, :set => false)
|
366
442
|
if html_class
|
367
|
-
opts[
|
443
|
+
opts['class'] << html_class
|
368
444
|
end
|
369
445
|
case type
|
370
|
-
when
|
446
|
+
when 'Ordered'
|
371
447
|
case subtype
|
372
|
-
when
|
373
|
-
opts[
|
448
|
+
when 'a'
|
449
|
+
opts['type'] = 'a'
|
374
450
|
opts['class'] << 'alpha'
|
375
|
-
when
|
376
|
-
opts[
|
451
|
+
when 'A'
|
452
|
+
opts['type'] = 'A'
|
377
453
|
opts['class'] << 'Alpha'
|
378
454
|
# when "1"
|
379
455
|
# type = %{}
|
@@ -381,13 +457,16 @@ EOH
|
|
381
457
|
opts['class'] << 'numeric'
|
382
458
|
# type = %{}
|
383
459
|
end
|
384
|
-
tag =
|
385
|
-
when
|
386
|
-
tag =
|
387
|
-
when
|
388
|
-
tag =
|
460
|
+
tag = 'ol'
|
461
|
+
when 'Itemize'
|
462
|
+
tag = 'ul'
|
463
|
+
when 'Task'
|
464
|
+
tag = 'ul'
|
465
|
+
opts['class'] << 'Task'
|
466
|
+
when 'Description'
|
467
|
+
tag = 'dl'
|
389
468
|
else
|
390
|
-
|
469
|
+
invoker.log(['Unknown list type', type], :error)
|
391
470
|
end
|
392
471
|
|
393
472
|
case what
|
@@ -408,24 +487,35 @@ EOH
|
|
408
487
|
end
|
409
488
|
end
|
410
489
|
|
411
|
-
def get_html_class(invoker,
|
412
|
-
html_class = [
|
413
|
-
invoker.args["htmlClass"],
|
414
|
-
invoker.styles_as_string,
|
415
|
-
]
|
416
|
-
html_class.compact!
|
490
|
+
def get_html_class(invoker, args={})
|
417
491
|
if invoker.respond_to?(:html_class)
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
492
|
+
html_class = invoker.html_class
|
493
|
+
else
|
494
|
+
html_class = nil
|
495
|
+
end
|
496
|
+
unless html_class
|
497
|
+
default = args[:default]
|
498
|
+
html_class = [
|
499
|
+
invoker.args[:htmlClass],
|
500
|
+
invoker.args['htmlClass'],
|
501
|
+
invoker.styles_as_string,
|
502
|
+
args[:style],
|
503
|
+
args[:html_class],
|
504
|
+
(args[:add] || []),
|
505
|
+
]
|
506
|
+
html_class.flatten!
|
507
|
+
html_class.compact!
|
423
508
|
if html_class.empty?
|
424
|
-
html_class
|
509
|
+
html_class = default
|
510
|
+
else
|
511
|
+
html_class.uniq!
|
512
|
+
html_class = class_attr(html_class)
|
513
|
+
end
|
514
|
+
if invoker.respond_to?(:html_class=) and args[:set] != false
|
515
|
+
invoker.html_class = html_class
|
425
516
|
end
|
426
517
|
end
|
427
|
-
html_class
|
428
|
-
return html_class.empty? ? nil : html_class.join(" ")
|
518
|
+
return html_class
|
429
519
|
end
|
430
520
|
|
431
521
|
def format_label(invoker, mode=nil, label=nil, with_id=true)
|
@@ -442,7 +532,7 @@ EOH
|
|
442
532
|
when :after
|
443
533
|
for l in label
|
444
534
|
if @open_labels.delete(l)
|
445
|
-
accum <<
|
535
|
+
accum << '</a>'
|
446
536
|
end
|
447
537
|
end
|
448
538
|
when :closeOpen
|
@@ -453,7 +543,7 @@ EOH
|
|
453
543
|
# when :once
|
454
544
|
else
|
455
545
|
for l in label
|
456
|
-
text = if block_given? then yield(l) else
|
546
|
+
text = if block_given? then yield(l) else '' end
|
457
547
|
accum << %{<a name="#{l}"></a>#{text}}
|
458
548
|
end
|
459
549
|
end
|
@@ -464,10 +554,10 @@ EOH
|
|
464
554
|
def format_figure(invoker, inline=false, elt=nil)
|
465
555
|
elt ||= invoker.elt
|
466
556
|
if inline
|
467
|
-
include_image(elt, invoker.args)
|
557
|
+
include_image(invoker, elt, invoker.args)
|
468
558
|
else
|
469
559
|
acc = []
|
470
|
-
fig = @deplate.msg(
|
560
|
+
fig = @deplate.msg('Figure')
|
471
561
|
caption = invoker.caption
|
472
562
|
if caption
|
473
563
|
capAbove = !(caption && caption.args && caption.args.include?("below"))
|
@@ -483,7 +573,7 @@ EOH
|
|
483
573
|
if caption and capAbove
|
484
574
|
acc << cap
|
485
575
|
end
|
486
|
-
acc << include_image(elt, invoker.args)
|
576
|
+
acc << include_image(invoker, elt, invoker.args)
|
487
577
|
if caption and !capAbove
|
488
578
|
acc << cap
|
489
579
|
end
|
@@ -492,60 +582,119 @@ EOH
|
|
492
582
|
end
|
493
583
|
end
|
494
584
|
|
495
|
-
def include_image(file, args, inline=false)
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
585
|
+
def include_image(invoker, file, args, inline=false)
|
586
|
+
acc = []
|
587
|
+
|
588
|
+
file = args['file'] if args['file']
|
589
|
+
file = img_url(use_image_filename(file, args))
|
590
|
+
acc << %{src="#{file}"}
|
591
|
+
|
592
|
+
w = args['w'] || args['width']
|
593
|
+
acc << %{width="#{w}"} if w
|
594
|
+
h = args['h'] || args['heigth']
|
595
|
+
acc << %{height="#{h}"} if h
|
596
|
+
|
597
|
+
# b = args['border'] || '0'
|
598
|
+
# acc << %{border="#{b}"}
|
599
|
+
|
600
|
+
# f = file[0..-(File.extname(file).size + 1)]
|
601
|
+
alt = args['alt']
|
504
602
|
if alt
|
505
603
|
alt.gsub!(/[\\"&<>]/) do |s|
|
506
604
|
case s
|
507
605
|
when '\\'
|
508
|
-
'
|
606
|
+
''
|
509
607
|
else
|
510
|
-
plain_text(s)
|
608
|
+
plain_text(s).gsub(/\\([0-9&`'+])/, '\\1')
|
511
609
|
end
|
512
610
|
end
|
513
611
|
else
|
514
612
|
alt = File.basename(file, '.*')
|
515
613
|
end
|
516
|
-
|
517
|
-
|
518
|
-
style = style
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
614
|
+
acc << %{alt="#{alt}"}
|
615
|
+
|
616
|
+
style = args['style']
|
617
|
+
if style
|
618
|
+
style = style.split(/[ ,]/)
|
619
|
+
else
|
620
|
+
style = []
|
621
|
+
end
|
622
|
+
style << (inline ? 'inline' : 'figure')
|
623
|
+
acc << %{class="#{class_attr(style)}"}
|
624
|
+
|
625
|
+
img_id = args['id']
|
626
|
+
unless img_id
|
627
|
+
fbase = Deplate::Core.clean_file_name(File.basename(fbase || 'imgid'))
|
628
|
+
img_id = @deplate.auto_numbered(fbase, :inc => 1, :fmt => %{#{fbase}_%s})
|
629
|
+
end
|
630
|
+
acc << %{id="#{img_id}" name="#{img_id}"}
|
631
|
+
|
632
|
+
hi = args['hi']
|
633
|
+
if hi
|
634
|
+
case hi
|
635
|
+
when String
|
636
|
+
hi_img = img_url(use_image_filename(hi, args))
|
637
|
+
else
|
638
|
+
hi_img = [File.dirname(file), %{hi-#{File.basename(file)}}]
|
639
|
+
hi_img = File.join(hi_img.compact)
|
525
640
|
end
|
641
|
+
|
642
|
+
setup_highlight_image
|
643
|
+
acc << %{onMouseover="HighlightImage('%s', '%s')" onMouseout="HighlightImage('%s', '%s')"} % [
|
644
|
+
img_id, img_url(hi_img, args),
|
645
|
+
img_id, file
|
646
|
+
]
|
526
647
|
end
|
527
|
-
|
648
|
+
|
649
|
+
return %{<img #{acc.join(' ')}/>}
|
528
650
|
end
|
529
651
|
|
652
|
+
def setup_highlight_image
|
653
|
+
unless @deplate.options.highlight_image
|
654
|
+
output_at(:pre, :javascript, <<EOJS
|
655
|
+
<script type="text/javascript">
|
656
|
+
<!--
|
657
|
+
function HighlightImage(Name, Src) {
|
658
|
+
if (document.images) {
|
659
|
+
document.images[Name].src = Src
|
660
|
+
}
|
661
|
+
}
|
662
|
+
//-->
|
663
|
+
</script>
|
664
|
+
EOJS
|
665
|
+
)
|
666
|
+
@deplate.options.highlight_image = true
|
667
|
+
end
|
668
|
+
end
|
669
|
+
|
670
|
+
def img_url(file, args={})
|
671
|
+
if args[:raw]
|
672
|
+
file
|
673
|
+
else
|
674
|
+
fmt = @deplate.variables['htmlImgUrl'] || @deplate.variables['htmlAuxUrl']
|
675
|
+
fmt ? fmt % file : file
|
676
|
+
end
|
677
|
+
end
|
678
|
+
|
530
679
|
def image_suffixes
|
531
|
-
[
|
680
|
+
['.png', '.jpeg', '.jpg', '.gif', '.bmp', '.wmf']
|
532
681
|
end
|
533
682
|
|
534
683
|
################################################ Elements {{{1
|
535
684
|
def format_note(invoker)
|
536
685
|
marker = invoker.marker
|
537
686
|
case marker
|
538
|
-
when
|
539
|
-
html_class =
|
540
|
-
when
|
541
|
-
html_class =
|
542
|
-
when
|
543
|
-
html_class =
|
544
|
-
when
|
545
|
-
html_class =
|
687
|
+
when '#'
|
688
|
+
html_class = 'note'
|
689
|
+
when '+'
|
690
|
+
html_class = 'warning'
|
691
|
+
when '?'
|
692
|
+
html_class = 'caution'
|
693
|
+
when '!'
|
694
|
+
html_class = 'important'
|
546
695
|
else
|
547
|
-
log([
|
548
|
-
html_class =
|
696
|
+
invoker.log(['Unknown marker', marker], :error)
|
697
|
+
html_class = 'note'
|
549
698
|
end
|
550
699
|
cls = %{ class="%s"} % html_class
|
551
700
|
join_blocks(["<div#{cls}><p#{cls}>", invoker.elt, "</p></div>\n"])
|
@@ -556,19 +705,18 @@ EOH
|
|
556
705
|
elt = invoker.elt
|
557
706
|
caption = invoker.caption
|
558
707
|
level_as_string = invoker.level_as_string
|
559
|
-
|
560
|
-
style.
|
561
|
-
|
562
|
-
|
563
|
-
clss = html_class ? html_class : "standard"
|
708
|
+
capAbove = !(caption && caption.args && caption.args.include?('below'))
|
709
|
+
style = invoker.styles_as_string || @variables['tableStyle']
|
710
|
+
style.gsub!(/[,;]+/, ' ') if style
|
711
|
+
clss = style || get_html_class(invoker, :default => 'standard')
|
564
712
|
clsss = %{ class="#{clss}"}
|
565
713
|
opts = format_particle(:table_args, invoker)
|
566
|
-
halfindent =
|
714
|
+
halfindent = ' '
|
567
715
|
indent = halfindent * 2
|
568
716
|
|
569
717
|
acc = []
|
570
718
|
unless args[:dontWrapTable]
|
571
|
-
acc << %{<div class="#{['table', style]
|
719
|
+
acc << %{<div class="#{class_attr(['table', style])}">}
|
572
720
|
end
|
573
721
|
acc << %{<table#{clsss}#{opts}>}
|
574
722
|
if caption
|
@@ -580,7 +728,7 @@ EOH
|
|
580
728
|
end
|
581
729
|
# capOpts << %{style="text-align=#{float_align_caption(invoker)};"}
|
582
730
|
cap = %{#{@deplate.msg("Table")} #{level_as_string}: #{caption.elt}}
|
583
|
-
acc << %{<caption#{capOpts.join(
|
731
|
+
acc << %{<caption#{capOpts.join(' ')}>#{cap}</caption>}
|
584
732
|
end
|
585
733
|
|
586
734
|
acc_head = []
|
@@ -588,17 +736,17 @@ EOH
|
|
588
736
|
acc_body = []
|
589
737
|
elt.each_with_index do |r, n|
|
590
738
|
if r.head
|
591
|
-
row = formatted_table_row(n, r, args, indent, clss,
|
739
|
+
row = formatted_table_row(n, r, args, indent, clss, 'th')
|
592
740
|
if row
|
593
741
|
table_add_row(acc_head, row, %{head #{style}}, :indent => halfindent)
|
594
742
|
end
|
595
743
|
elsif r.foot
|
596
|
-
row = formatted_table_row(n, r, args, indent, clss,
|
744
|
+
row = formatted_table_row(n, r, args, indent, clss, 'td')
|
597
745
|
if row
|
598
746
|
table_add_row(acc_foot, row, %{foot #{style}}, :indent => halfindent)
|
599
747
|
end
|
600
748
|
elsif r.high
|
601
|
-
row = formatted_table_row(n, r, args, indent, clss,
|
749
|
+
row = formatted_table_row(n, r, args, indent, clss, 'td')
|
602
750
|
table_add_row(acc_body, row, %{high #{style}}, :indent => halfindent) if row
|
603
751
|
elsif r.is_ruler
|
604
752
|
else
|
@@ -619,8 +767,8 @@ EOH
|
|
619
767
|
end
|
620
768
|
acc << acc_body
|
621
769
|
|
622
|
-
acc <<
|
623
|
-
note = invoker.args[
|
770
|
+
acc << '</table>'
|
771
|
+
note = invoker.args['note']
|
624
772
|
if note
|
625
773
|
note = @deplate.parse_and_format(invoker, note)
|
626
774
|
nopts = ['', %{class="tableNote"}]
|
@@ -629,14 +777,18 @@ EOH
|
|
629
777
|
acc << %{<div#{nopts.join(' ')}>#{note}</div>}
|
630
778
|
end
|
631
779
|
acc << "</div>\n" unless args[:dontWrapTable]
|
632
|
-
acc <<
|
780
|
+
acc << ''
|
633
781
|
|
634
782
|
join_blocks(acc)
|
635
783
|
end
|
636
784
|
|
785
|
+
# def table_empty_cell
|
786
|
+
# '{ins:  }'
|
787
|
+
# end
|
788
|
+
|
637
789
|
def table_add_row(acc, row, clss, args)
|
638
|
-
tag = args[:tag] ||
|
639
|
-
indent = args[:indent] ||
|
790
|
+
tag = args[:tag] || 'tr'
|
791
|
+
indent = args[:indent] || ' '
|
640
792
|
dblindent = indent * 2
|
641
793
|
row = row.join("\n#{dblindent}")
|
642
794
|
acc << %{#{indent}<#{tag} class="#{clss}">}
|
@@ -644,11 +796,11 @@ EOH
|
|
644
796
|
acc << "#{indent}</#{tag}>"
|
645
797
|
end
|
646
798
|
|
647
|
-
def format_heading(invoker)
|
648
|
-
l = format_label(invoker, nil, nil, false)
|
649
|
-
level = invoker.level
|
799
|
+
def format_heading(invoker, level=nil, elt=nil)
|
650
800
|
args = invoker.args
|
651
|
-
|
801
|
+
level ||= invoker.level
|
802
|
+
elt ||= invoker.elt
|
803
|
+
l = format_label(invoker, nil, nil, false)
|
652
804
|
html_args = invoker.html_args || ''
|
653
805
|
id = invoker.get_id
|
654
806
|
if consume_label(id)
|
@@ -657,9 +809,10 @@ EOH
|
|
657
809
|
if level > 0 and level <= 6
|
658
810
|
hd = "h#{level}"
|
659
811
|
if invoker.plain_caption?
|
660
|
-
ls =
|
812
|
+
ls = ''
|
661
813
|
else
|
662
|
-
ls
|
814
|
+
ls = invoker.level_as_string
|
815
|
+
ls += ' ' if ls
|
663
816
|
end
|
664
817
|
%{\n<#{hd}#{html_args}>#{l}#{ls}#{elt}</#{hd}>\n}
|
665
818
|
else
|
@@ -673,7 +826,7 @@ EOH
|
|
673
826
|
end
|
674
827
|
|
675
828
|
def format_break(invoker)
|
676
|
-
format_pagebreak(invoker,
|
829
|
+
format_pagebreak(invoker, 'break')
|
677
830
|
end
|
678
831
|
|
679
832
|
def format_anchor(invoker)
|
@@ -692,28 +845,34 @@ EOH
|
|
692
845
|
################################################ Regions {{{1
|
693
846
|
def format_verbatim(invoker, text=nil)
|
694
847
|
text ||= invoker.elt
|
695
|
-
format_environment(invoker,
|
848
|
+
format_environment(invoker, 'pre', {'class'=>'verbatim'}, plain_text(text, :pre))
|
696
849
|
end
|
697
850
|
|
698
851
|
def format_abstract(invoker)
|
699
|
-
format_environment(invoker, %{blockquote}, {
|
852
|
+
format_environment(invoker, %{blockquote}, {'class'=>'abstract'}, invoker.elt)
|
700
853
|
end
|
701
854
|
|
702
855
|
def format_quote(invoker)
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
856
|
+
elt = invoker.elt.strip
|
857
|
+
rv = [if invoker.args['long']
|
858
|
+
format_environment(invoker, %{blockquote}, {'class'=>'longquote'}, elt)
|
859
|
+
else
|
860
|
+
format_environment(invoker, %{blockquote}, {'class'=>'quote'}, elt)
|
861
|
+
end]
|
862
|
+
if (src = invoker.args['source'])
|
863
|
+
rv << format_environment(invoker, %{div}, {'class' => 'source'},
|
864
|
+
plain_text(src))
|
707
865
|
end
|
866
|
+
join_blocks(rv)
|
708
867
|
end
|
709
868
|
|
710
869
|
def format_header(invoker)
|
711
|
-
format_header_or_footer(invoker, :pre, :header,
|
870
|
+
format_header_or_footer(invoker, :pre, :header, 'HEADER', 'header')
|
712
871
|
nil
|
713
872
|
end
|
714
873
|
|
715
874
|
def format_footer(invoker)
|
716
|
-
format_header_or_footer(invoker, :post, :footer,
|
875
|
+
format_header_or_footer(invoker, :post, :footer, 'FOOTER', 'footer')
|
717
876
|
nil
|
718
877
|
end
|
719
878
|
|
@@ -730,7 +889,7 @@ EOH
|
|
730
889
|
acc << c % ii.elt if ii
|
731
890
|
end
|
732
891
|
acc << %{</div>}
|
733
|
-
acc << format_pagebreak(invoker,
|
892
|
+
acc << format_pagebreak(invoker, 'title') if invoker.args['page']
|
734
893
|
join_blocks(acc)
|
735
894
|
end
|
736
895
|
|
@@ -761,28 +920,33 @@ EOH
|
|
761
920
|
|
762
921
|
|
763
922
|
################################################ Particles {{{1
|
764
|
-
def format_emphasize(invoker, text)
|
765
|
-
|
923
|
+
def format_emphasize(invoker, text=nil)
|
924
|
+
text ||= invoker.elt || invoker.text
|
925
|
+
inline_tag(invoker, 'em', text)
|
766
926
|
end
|
767
927
|
|
768
|
-
def format_code(invoker, text)
|
769
|
-
|
928
|
+
def format_code(invoker, text=nil)
|
929
|
+
text ||= invoker.elt || invoker.text
|
930
|
+
inline_tag(invoker, 'code', plain_text(text, :code))
|
770
931
|
end
|
771
932
|
|
772
933
|
def format_url(invoker, name, dest, anchor, literal=false)
|
773
934
|
dest = Deplate::HyperLink.url_anchor(dest, anchor)
|
774
|
-
dest.gsub!(/&/,
|
775
|
-
|
935
|
+
dest.gsub!(/&/, '&')
|
936
|
+
if name =~ /^mailto:(.*)$/
|
937
|
+
name = $1
|
938
|
+
end
|
939
|
+
inline_tag(invoker, 'a', name, href_args(invoker, dest))
|
776
940
|
end
|
777
941
|
|
778
942
|
def format_wiki(invoker, name, dest, anchor)
|
779
943
|
dest = Deplate::HyperLink.url_anchor(dest, anchor)
|
780
944
|
# dest.gsub!(/&/, "&")
|
781
|
-
inline_tag(invoker,
|
945
|
+
inline_tag(invoker, 'a', name, href_args(invoker, dest))
|
782
946
|
end
|
783
947
|
|
784
948
|
def href_args(invoker, dest)
|
785
|
-
args = {
|
949
|
+
args = {'href' => dest}
|
786
950
|
target = invoker.args['target']
|
787
951
|
if target
|
788
952
|
args['target'] = target
|
@@ -793,29 +957,29 @@ EOH
|
|
793
957
|
|
794
958
|
def format_symbol(invoker, text)
|
795
959
|
case text
|
796
|
-
when
|
797
|
-
return
|
798
|
-
when
|
799
|
-
return
|
800
|
-
when
|
801
|
-
return
|
802
|
-
when
|
803
|
-
return
|
804
|
-
when
|
805
|
-
return
|
806
|
-
when
|
807
|
-
return
|
808
|
-
when
|
809
|
-
return
|
810
|
-
when
|
811
|
-
return
|
812
|
-
when
|
813
|
-
return
|
814
|
-
when
|
815
|
-
return
|
816
|
-
when
|
817
|
-
return
|
818
|
-
when
|
960
|
+
when '<-'
|
961
|
+
return '←'
|
962
|
+
when '->'
|
963
|
+
return '→'
|
964
|
+
when '<=', '<<<'
|
965
|
+
return '⇐'
|
966
|
+
when '=>', '>>>'
|
967
|
+
return '⇒'
|
968
|
+
when '<->'
|
969
|
+
return '↔'
|
970
|
+
when '<=>'
|
971
|
+
return '⇔'
|
972
|
+
when '!='
|
973
|
+
return '≠'
|
974
|
+
when '~~'
|
975
|
+
return '≈'
|
976
|
+
when '...'
|
977
|
+
return '…'
|
978
|
+
when '--'
|
979
|
+
return '–'
|
980
|
+
when '=='
|
981
|
+
return '≡'
|
982
|
+
when '+++', '###', '???', '!!!'
|
819
983
|
m = plain_text(text)
|
820
984
|
return %{<span class="marker"><em class="marker">#{m}</em></span>}
|
821
985
|
# when "<~"
|
@@ -830,19 +994,19 @@ EOH
|
|
830
994
|
end
|
831
995
|
|
832
996
|
def doublequote_open(invoker)
|
833
|
-
|
997
|
+
'“'
|
834
998
|
end
|
835
999
|
|
836
1000
|
def doublequote_close(invoker)
|
837
|
-
|
1001
|
+
'”'
|
838
1002
|
end
|
839
1003
|
|
840
1004
|
def singlequote_open(invoker)
|
841
|
-
|
1005
|
+
'‘'
|
842
1006
|
end
|
843
1007
|
|
844
1008
|
def singlequote_close(invoker)
|
845
|
-
|
1009
|
+
'’'
|
846
1010
|
end
|
847
1011
|
|
848
1012
|
|
@@ -851,45 +1015,53 @@ EOH
|
|
851
1015
|
if idx
|
852
1016
|
return format_label(invoker, :string, [idx.label])
|
853
1017
|
else
|
854
|
-
return
|
1018
|
+
return ''
|
855
1019
|
end
|
856
1020
|
end
|
857
1021
|
|
858
1022
|
def format_footnote(invoker)
|
859
1023
|
elt = invoker.elt
|
860
|
-
if elt and elt.elt and elt.
|
861
|
-
|
862
|
-
lab = fn.label
|
1024
|
+
if elt and elt.elt and elt.fn_consumed
|
1025
|
+
lab = elt.fn_label
|
863
1026
|
if !@deplate.footnotes_used.include?(lab)
|
864
1027
|
idx = @deplate.footnote_last_idx +=1
|
865
|
-
hclass =
|
866
|
-
id =
|
867
|
-
name =
|
1028
|
+
hclass = 'sdfootnoteanc'
|
1029
|
+
id = 'sdfootnote%d' % idx
|
1030
|
+
name = 'sdfootnote%danc' % idx
|
868
1031
|
href = @footnote_template % idx
|
869
1032
|
lab = [href]
|
870
|
-
|
871
|
-
|
1033
|
+
elt.fn_n = idx
|
1034
|
+
elt.fn_label = lab
|
872
1035
|
@deplate.footnotes_used << lab
|
873
1036
|
invoker.container.postponed_format << Proc.new do |container|
|
874
1037
|
consume_label(id, true)
|
875
|
-
t = [
|
876
|
-
%{<
|
877
|
-
|
878
|
-
|
879
|
-
|
1038
|
+
t = [
|
1039
|
+
%{<div id="#{id}">},
|
1040
|
+
]
|
1041
|
+
l = %{<a class="sdfootnotesym" name="#{href}" href="##{name}">#{idx}</a>}
|
1042
|
+
e = elt.elt[0]
|
1043
|
+
case e
|
1044
|
+
when Deplate::Element::Paragraph
|
1045
|
+
e.elt.insert(0, l)
|
1046
|
+
else
|
1047
|
+
t << l
|
1048
|
+
end
|
1049
|
+
elt.push_styles('sdfootnote')
|
1050
|
+
t << elt.format_current
|
1051
|
+
t << %{</div>}
|
880
1052
|
output_at(:body, :footnotes, t.join("\n"))
|
881
1053
|
end
|
882
1054
|
else
|
883
|
-
href = @footnote_template %
|
1055
|
+
href = @footnote_template % elt.fn_n
|
884
1056
|
end
|
885
|
-
return %{<a class="sdfootnoteanc" name="#{name}" href="##{href}">#{
|
1057
|
+
return %{<a class="sdfootnoteanc" name="#{name}" href="##{href}">#{elt.fn_n}</a>}
|
886
1058
|
else
|
887
|
-
return
|
1059
|
+
return ''
|
888
1060
|
end
|
889
1061
|
end
|
890
1062
|
|
891
1063
|
def format_ref(invoker)
|
892
|
-
text = invoker.text ||
|
1064
|
+
text = invoker.text || ''
|
893
1065
|
f = @deplate.get_filename_for_label(invoker, text)
|
894
1066
|
if f
|
895
1067
|
# if invoker.args['obj'] and (o = @deplate.label_aliases[text])
|
@@ -902,74 +1074,31 @@ EOH
|
|
902
1074
|
if l
|
903
1075
|
t = plain_text(l)
|
904
1076
|
else
|
905
|
-
t = @variables[
|
1077
|
+
t = @variables['refButton'] || '[⇒]'
|
906
1078
|
end
|
907
|
-
|
1079
|
+
prefix = invoker.args['prefix'] || ' '
|
1080
|
+
return %{#{prefix}<a href="#{URI.escape(f)}##{URI.escape(text)}" class="ref">#{t}</a>}
|
1081
|
+
else
|
1082
|
+
return text.empty? ? '??' : text
|
908
1083
|
end
|
909
1084
|
end
|
910
1085
|
|
911
1086
|
def format_linebreak(invoker)
|
912
|
-
open_tag(invoker,
|
913
|
-
end
|
914
|
-
|
915
|
-
# def format_cite(invoker)
|
916
|
-
# container = invoker.container
|
917
|
-
# args = invoker.args
|
918
|
-
# n = args["n"]
|
919
|
-
# p = args["p"]
|
920
|
-
# np = args["np"]
|
921
|
-
# y = args["y"]
|
922
|
-
# acc = []
|
923
|
-
# pmsg = @deplate.msg("p.\\ ")
|
924
|
-
# for c in invoker.elt
|
925
|
-
# cc = bib_entry(c)
|
926
|
-
# if cc
|
927
|
-
# yr = cc.assoc("year")
|
928
|
-
# yr = if yr then yr[1] else "" end
|
929
|
-
# if p
|
930
|
-
# p = @deplate.parse_and_format(container, "#{pmsg}#{p}")
|
931
|
-
# yr += ": #{p}"
|
932
|
-
# # yr += ": " + p if p
|
933
|
-
# end
|
934
|
-
# if y
|
935
|
-
# acc << referenced_bib_entry(invoker, c, yr)
|
936
|
-
# else
|
937
|
-
# nm = cc.assoc("author") || cc.assoc("editor")
|
938
|
-
# if nm
|
939
|
-
# nm = nm[1]
|
940
|
-
# nm = nm.gsub(/\s+/, " ").split(" and ").collect do |a|
|
941
|
-
# a.scan(/\w+$/)
|
942
|
-
# end
|
943
|
-
# nm = nm.join(", ")
|
944
|
-
# acc << referenced_bib_entry(invoker, c, [nm, yr].join(" "))
|
945
|
-
# else
|
946
|
-
# acc << referenced_bib_entry(invoker, c, c)
|
947
|
-
# end
|
948
|
-
# end
|
949
|
-
# end
|
950
|
-
# end
|
951
|
-
# n &&= n + " "
|
952
|
-
# acc = acc.join("; ")
|
953
|
-
# if np
|
954
|
-
# return %{#{n}#{acc}}
|
955
|
-
# else
|
956
|
-
# return %{ (#{n}#{acc})}
|
957
|
-
# end
|
958
|
-
# end
|
1087
|
+
open_tag(invoker, 'br', nil, :single => true)
|
1088
|
+
end
|
959
1089
|
|
960
1090
|
def referenced_bib_entry(invoker, key, text)
|
961
1091
|
hd = @deplate.options.html_makebib_heading
|
962
|
-
f = hd ? hd.top_heading.output_file_name(:relative => invoker.container) :
|
1092
|
+
f = hd ? hd.top_heading.output_file_name(:relative => invoker.container) : ''
|
963
1093
|
%{<a href="#{f}##{encode_id(key)}">#{text}</a>}
|
964
1094
|
end
|
965
|
-
private :referenced_bib_entry
|
966
1095
|
|
967
1096
|
def format_subscript(invoker)
|
968
|
-
inline_tag(invoker,
|
1097
|
+
inline_tag(invoker, 'sub', invoker.elt)
|
969
1098
|
end
|
970
1099
|
|
971
1100
|
def format_superscript(invoker)
|
972
|
-
inline_tag(invoker,
|
1101
|
+
inline_tag(invoker, 'sup', invoker.elt)
|
973
1102
|
end
|
974
1103
|
|
975
1104
|
# this doesn't work with IExplorer and others
|
@@ -982,7 +1111,7 @@ EOH
|
|
982
1111
|
end
|
983
1112
|
|
984
1113
|
def format_pagenumber(invoker)
|
985
|
-
return
|
1114
|
+
return ''
|
986
1115
|
end
|
987
1116
|
|
988
1117
|
|
@@ -1015,15 +1144,15 @@ EOH
|
|
1015
1144
|
|
1016
1145
|
################################################ Head {{{1
|
1017
1146
|
def head_css
|
1018
|
-
csso = @variables[
|
1147
|
+
csso = @variables['css']
|
1019
1148
|
if csso
|
1020
1149
|
csss = csso.split(/\s+/)
|
1021
1150
|
else
|
1022
1151
|
csss = []
|
1023
1152
|
end
|
1024
|
-
cls = @variables[
|
1153
|
+
cls = @variables['class']
|
1025
1154
|
if cls
|
1026
|
-
csss << cls +
|
1155
|
+
csss << cls + '.css'
|
1027
1156
|
end
|
1028
1157
|
acc = []
|
1029
1158
|
csss.each_with_index do | f, i |
|
@@ -1034,14 +1163,19 @@ EOH
|
|
1034
1163
|
else
|
1035
1164
|
with_title = true
|
1036
1165
|
end
|
1037
|
-
cssName = File.basename(css,
|
1166
|
+
cssName = File.basename(css, '.css')
|
1167
|
+
unless @deplate.options.css.find {|c, anyway| cssName == c}
|
1168
|
+
@deplate.options.css << [cssName]
|
1169
|
+
end
|
1038
1170
|
cssFile = @deplate.auxiliary_filename(css)
|
1171
|
+
cssFmt = @deplate.variables['htmlCssUrl'] || @deplate.variables['htmlAuxUrl']
|
1172
|
+
cssFile = cssFmt % cssFile if cssFmt
|
1039
1173
|
opts = [%{rel="stylesheet" type="text/css" href="#{URI.escape(cssFile)}"}]
|
1040
1174
|
opts << %{title="#{cssName}"} if with_title
|
1041
1175
|
opts << %{media="#{media}"} if media
|
1042
|
-
acc << head_link_tag(opts.join(
|
1176
|
+
acc << head_link_tag(opts.join(' '))
|
1043
1177
|
end
|
1044
|
-
cssExtra = @variables[
|
1178
|
+
cssExtra = @variables['cssExtra']
|
1045
1179
|
acc << cssExtra if cssExtra
|
1046
1180
|
return acc.join("\n")
|
1047
1181
|
end
|
@@ -1060,132 +1194,102 @@ EOH
|
|
1060
1194
|
def html_def
|
1061
1195
|
acc = []
|
1062
1196
|
acc << html_lang
|
1063
|
-
acc << @variables[
|
1197
|
+
acc << @variables['htmlDefEtc'] if @variables['htmlDefEtc']
|
1064
1198
|
if acc.empty?
|
1065
|
-
return
|
1199
|
+
return '<html>'
|
1066
1200
|
else
|
1067
|
-
return "<html #{acc.join(
|
1201
|
+
return "<html #{acc.join(' ')}>"
|
1068
1202
|
end
|
1069
1203
|
end
|
1070
|
-
|
1204
|
+
|
1071
1205
|
|
1072
1206
|
################################################ List of ... {{{1
|
1073
|
-
def
|
1074
|
-
format_list_of(invoker,
|
1075
|
-
:
|
1207
|
+
def format_list_of_toc(invoker)
|
1208
|
+
format_list_of(invoker,
|
1209
|
+
:title => 'Table of Contents',
|
1210
|
+
:prefix => 'hd',
|
1211
|
+
:listing => 'toc',
|
1212
|
+
:flat => false,
|
1213
|
+
:style => 'toc')
|
1076
1214
|
end
|
1077
1215
|
|
1078
|
-
alias :format_list_of_toc :format_list_of_contents
|
1079
|
-
|
1080
1216
|
def format_list_of_minitoc(invoker)
|
1081
|
-
data = @deplate.
|
1082
|
-
format_list_of(invoker,
|
1083
|
-
:
|
1084
|
-
:
|
1085
|
-
|
1217
|
+
data = @deplate.options.listings.get('toc').find_all {|e| e.level == 1}
|
1218
|
+
format_list_of(invoker,
|
1219
|
+
:title => 'Contents',
|
1220
|
+
:prefix => 'hd',
|
1221
|
+
:data => data, :flat => false,
|
1222
|
+
:img => @variables['navGif'],
|
1223
|
+
:style => 'minitoc') do |hd|
|
1224
|
+
hd.args['shortcaption'] || hd.args['id']
|
1086
1225
|
end
|
1087
1226
|
end
|
1088
1227
|
|
1089
|
-
def
|
1090
|
-
format_list_of(invoker,
|
1091
|
-
:
|
1228
|
+
def format_list_of_lot(invoker)
|
1229
|
+
format_list_of(invoker,
|
1230
|
+
:title => 'List of Tables',
|
1231
|
+
:prefix => 'tab',
|
1232
|
+
:listing => 'lot',
|
1233
|
+
:flat => true,
|
1234
|
+
:style => 'lot')
|
1092
1235
|
end
|
1093
1236
|
|
1094
|
-
def
|
1095
|
-
@html_class = "lof"
|
1096
|
-
format_list_of(invoker,
|
1097
|
-
:
|
1237
|
+
def format_list_of_lof(invoker)
|
1238
|
+
# @html_class = "lof"
|
1239
|
+
format_list_of(invoker,
|
1240
|
+
:title => 'List of Figures',
|
1241
|
+
:prefix => 'fig',
|
1242
|
+
:listing => 'lof',
|
1243
|
+
:flat => true,
|
1244
|
+
:style => 'lof')
|
1098
1245
|
end
|
1099
1246
|
|
1100
1247
|
def format_list_of_index(invoker)
|
1101
|
-
format_the_index(invoker,
|
1102
|
-
|
1248
|
+
format_the_index(invoker, 'Index',
|
1249
|
+
@deplate.index,
|
1250
|
+
'idx',
|
1251
|
+
true,
|
1252
|
+
:style => 'index')
|
1253
|
+
end
|
1254
|
+
|
1255
|
+
def listing_prematter(invoker, args, id)
|
1256
|
+
img = args[:img]
|
1257
|
+
img = %{<img src="#{img_url(img, args)}" border="0" alt="" />} if img
|
1258
|
+
%{<div id="%s">%s\n<div id="%sBlock" class="%s">} % [
|
1259
|
+
id,
|
1260
|
+
img,
|
1261
|
+
id,
|
1262
|
+
get_html_class(invoker, args)
|
1263
|
+
]
|
1103
1264
|
end
|
1104
|
-
|
1105
|
-
def
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
consume_label("#{id}Block", true)
|
1117
|
-
acc << %{<div id="%s">%s\n<div id="%sBlock" class="%s">} % [id, img, id, html_class]
|
1118
|
-
unless args["plain"] || args["noTitle"]
|
1119
|
-
ti = @deplate.msg(name)
|
1120
|
-
acc << %{<h1 class="%s">%s%s</h1>} % [html_class, format_label(invoker), ti]
|
1121
|
-
end
|
1122
|
-
|
1123
|
-
ll = 1
|
1124
|
-
levels = args['levels']
|
1125
|
-
if levels
|
1126
|
-
range_from, range_to, rest = levels.split(/\.\./)
|
1127
|
-
if rest
|
1128
|
-
log(['Malformed range', levels], :error)
|
1129
|
-
end
|
1130
|
-
end
|
1131
|
-
range_from ||= args['min']
|
1132
|
-
if range_from
|
1133
|
-
range_from = range_from.to_i
|
1134
|
-
end
|
1135
|
-
range_to ||= args['max']
|
1136
|
-
if range_to
|
1137
|
-
range_to = range_to.to_i
|
1138
|
-
end
|
1139
|
-
top = args['top']
|
1140
|
-
if top
|
1141
|
-
top = /^#{Regexp.escape(top)}/
|
1142
|
-
end
|
1143
|
-
sub = args['sub']
|
1144
|
-
if sub
|
1145
|
-
sub = /^#{Regexp.escape(invoker.level_as_string)}\./
|
1265
|
+
|
1266
|
+
def listing_postmatter(invoker, args)
|
1267
|
+
%{</div></div>}
|
1268
|
+
end
|
1269
|
+
|
1270
|
+
def listing_title(invoker, args, name)
|
1271
|
+
if name
|
1272
|
+
%{<h1 class="%s">%s%s</h1>} % [
|
1273
|
+
get_html_class(invoker, args),
|
1274
|
+
format_label(invoker),
|
1275
|
+
@deplate.msg(name)
|
1276
|
+
]
|
1146
1277
|
end
|
1147
|
-
accData = []
|
1148
|
-
for hd in data
|
1149
|
-
if hd.nil? or hd.args["noList"]
|
1150
|
-
next
|
1151
|
-
end
|
1152
|
-
if range_from and hd.level < range_from
|
1153
|
-
next
|
1154
|
-
end
|
1155
|
-
if range_to and hd.level > range_to
|
1156
|
-
next
|
1157
|
-
end
|
1158
|
-
if top and hd.level_as_string !~ top
|
1159
|
-
next
|
1160
|
-
end
|
1161
|
-
if sub and hd.level_as_string !~ sub
|
1162
|
-
next
|
1163
|
-
end
|
1164
|
-
l = if flat then 1 else hd.level end
|
1165
|
-
f = hd.output_file_name(:relative => invoker)
|
1166
|
-
d = f + "#" + @deplate.elt_label(prefix, hd.level_as_string)
|
1167
|
-
v = nil
|
1168
|
-
if block_given?
|
1169
|
-
v = yield(hd)
|
1170
|
-
end
|
1171
|
-
unless v
|
1172
|
-
v = hd.caption ? hd.caption.elt : hd.elt.dup
|
1173
|
-
end
|
1174
|
-
# v.gsub!(/<a name=".*?"><\/a>/, "")
|
1175
|
-
v = clean_tags(v)
|
1176
|
-
v = [hd.level_as_string, v].join(" ") unless hd.plain_caption?
|
1177
|
-
b = format_url(invoker, v, d, nil, true)
|
1178
|
-
s = Deplate::ListItem.new(nil, b, "Itemize", "Itemize", l, 0, true)
|
1179
|
-
s.style = html_class
|
1180
|
-
accData << s
|
1181
|
-
end
|
1182
|
-
acc << printable_list(invoker, accData)
|
1183
|
-
acc << %{</div></div>}
|
1184
|
-
join_blocks(acc)
|
1185
1278
|
end
|
1186
|
-
|
1187
|
-
def
|
1188
|
-
|
1279
|
+
|
1280
|
+
def listing_item(invoker, args, prefix, title, heading, level, other_args)
|
1281
|
+
v = clean_tags(title)
|
1282
|
+
v = [heading.level_as_string, v].join(' ') unless heading.plain_caption?
|
1283
|
+
f = heading.output_file_name(:relative => invoker)
|
1284
|
+
d = [f, @deplate.elt_label(prefix, heading.level_as_string)].join('#')
|
1285
|
+
b = format_url(invoker, v, d, nil, true)
|
1286
|
+
s = Deplate::ListItem.new(nil, b, 'Itemize', 'Itemize', level, 0, true)
|
1287
|
+
s.style = get_html_class(invoker, args)
|
1288
|
+
s
|
1289
|
+
end
|
1290
|
+
|
1291
|
+
def format_the_index(invoker, name, data, prefix='', flat=false, other_args={})
|
1292
|
+
style = other_args[:style] || 'index'
|
1189
1293
|
accum = []
|
1190
1294
|
chars = []
|
1191
1295
|
|
@@ -1196,41 +1300,43 @@ EOH
|
|
1196
1300
|
chars << cht
|
1197
1301
|
lab = format_label(invoker, :string, [format_index_hd_label(cht)])
|
1198
1302
|
accum << format_list_env(invoker, "Description", 0, :close) unless accum.empty?
|
1199
|
-
accum << %{<h2 class="%s">%s%s</h2>} % [
|
1303
|
+
accum << %{<h2 class="%s">%s%s</h2>} % [style, lab, cht]
|
1200
1304
|
accum << format_list_env(invoker, "Description", 0, :open)
|
1201
1305
|
end
|
1202
1306
|
acc = []
|
1203
1307
|
for i in arr
|
1204
1308
|
ff = @deplate.dest
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1309
|
+
xf = i.file(invoker)
|
1310
|
+
xl = i.level_as_string
|
1311
|
+
if xf or xl
|
1312
|
+
f = xf || invoker.output_file_name(:level_as_string => xl,
|
1313
|
+
:relative => invoker)
|
1208
1314
|
if f == ff
|
1209
|
-
f =
|
1210
|
-
l =
|
1315
|
+
f = ''
|
1316
|
+
l = xl
|
1211
1317
|
if l and !l.empty?
|
1212
1318
|
t = l
|
1213
1319
|
elsif @deplate.options.multi_file_output
|
1214
|
-
t = @variables[
|
1320
|
+
t = @variables['refButton'] || '[⇒]'
|
1215
1321
|
else
|
1216
|
-
t =
|
1322
|
+
t = 'I'
|
1217
1323
|
end
|
1218
1324
|
else
|
1219
|
-
t = @deplate.file_with_suffix(f,
|
1325
|
+
t = @deplate.file_with_suffix(f, '', true)
|
1220
1326
|
end
|
1221
1327
|
acc << format_url(invoker, t, f, i.label, true)
|
1222
1328
|
else
|
1223
|
-
log([
|
1329
|
+
invoker.log(['Index: Neither file nor level defined: dropping', n, i.label], :error)
|
1224
1330
|
end
|
1225
1331
|
end
|
1226
1332
|
l = format_label(invoker, :string, [format_index_entry_label(invoker, n)])
|
1227
|
-
s = Deplate::ListItem.new(l + plain_text(n), acc.join(
|
1228
|
-
accum += format_list_item(invoker,
|
1333
|
+
s = Deplate::ListItem.new(l + plain_text(n), acc.join(', '))
|
1334
|
+
accum += format_list_item(invoker, 'Description', 0, s)
|
1229
1335
|
end
|
1230
|
-
accum << format_list_env(invoker,
|
1336
|
+
accum << format_list_env(invoker, 'Description', 0, :close)
|
1231
1337
|
|
1232
1338
|
acc = []
|
1233
|
-
acc << %{<p class="%stoc">} %
|
1339
|
+
acc << %{<p class="%stoc">} % style
|
1234
1340
|
for c in chars
|
1235
1341
|
l = format_url(invoker, c, "", format_index_hd_label(c), true)
|
1236
1342
|
acc << l
|
@@ -1256,21 +1362,21 @@ EOH
|
|
1256
1362
|
opts = [nil]
|
1257
1363
|
align = float_align(invoker)
|
1258
1364
|
case align
|
1259
|
-
when
|
1260
|
-
when
|
1261
|
-
when
|
1365
|
+
when 'center'
|
1366
|
+
when 'right'
|
1367
|
+
when 'left'
|
1262
1368
|
end
|
1263
1369
|
opts << %{align="#{align}"} if align
|
1264
|
-
width = args[
|
1370
|
+
width = args['width'] || @variables['tableWidth']
|
1265
1371
|
opts << %{width="#{width}"} if width
|
1266
1372
|
opts << %{summary="#{caption.elt}"} if caption and caption.elt
|
1267
|
-
return opts.join(
|
1373
|
+
return opts.join(' ')
|
1268
1374
|
end
|
1269
1375
|
|
1270
1376
|
def float_align(invoker)
|
1271
1377
|
args = invoker.args
|
1272
|
-
args[
|
1273
|
-
# ||
|
1378
|
+
args['align'] || @variables['floatAlign']
|
1379
|
+
# || 'center'
|
1274
1380
|
end
|
1275
1381
|
|
1276
1382
|
def float_align_caption(invoker)
|
@@ -1284,9 +1390,9 @@ EOH
|
|
1284
1390
|
end
|
1285
1391
|
|
1286
1392
|
def formatted_table_row(n, row, args, indent, html_class=nil, thistag=nil)
|
1287
|
-
colwidths = Deplate::Core.props(args[
|
1288
|
-
coljusts = Deplate::Core.props(args[
|
1289
|
-
rowheight = Deplate::Core.props(args[
|
1393
|
+
colwidths = Deplate::Core.props(args['cols'], 'w')
|
1394
|
+
coljusts = Deplate::Core.props(args['cols'], 'j')
|
1395
|
+
rowheight = Deplate::Core.props(args['rows'], 'h')
|
1290
1396
|
t = []
|
1291
1397
|
row.cols.each_with_index do |cell, i|
|
1292
1398
|
case cell
|
@@ -1299,9 +1405,9 @@ EOH
|
|
1299
1405
|
tag = thistag
|
1300
1406
|
else
|
1301
1407
|
if row.head
|
1302
|
-
tag =
|
1408
|
+
tag = 'th'
|
1303
1409
|
else
|
1304
|
-
tag =
|
1410
|
+
tag = 'td'
|
1305
1411
|
end
|
1306
1412
|
end
|
1307
1413
|
|
@@ -1333,7 +1439,7 @@ EOH
|
|
1333
1439
|
if styles.empty?
|
1334
1440
|
styles = ""
|
1335
1441
|
else
|
1336
|
-
opts << %{style="%s"} % styles.join(
|
1442
|
+
opts << %{style="%s"} % styles.join('; ')
|
1337
1443
|
end
|
1338
1444
|
|
1339
1445
|
if cell.span_x > 1
|
@@ -1344,7 +1450,7 @@ EOH
|
|
1344
1450
|
end
|
1345
1451
|
|
1346
1452
|
# t << "<#{tag}#{opts.join(" ")}>#{indented(c, indent)}\n#{indent}</#{tag}>"
|
1347
|
-
t << "<#{tag}#{opts.join(
|
1453
|
+
t << "<#{tag}#{opts.join(' ')}>#{c}</#{tag}>"
|
1348
1454
|
end
|
1349
1455
|
end
|
1350
1456
|
t
|
@@ -1359,7 +1465,7 @@ EOH
|
|
1359
1465
|
|
1360
1466
|
public
|
1361
1467
|
################################################ navigation bar {{{1
|
1362
|
-
def format_navigation_bar(invoker, type, slot, bartype, first=
|
1468
|
+
def format_navigation_bar(invoker, type, slot, bartype, first=nil, last=nil)
|
1363
1469
|
idx, first, last = navbar_output_index(invoker, first, last)
|
1364
1470
|
|
1365
1471
|
nomenu = invoker.args['noNavMenu'] || @variables['noNavMenu']
|
@@ -1392,76 +1498,85 @@ EOH
|
|
1392
1498
|
link_up = head_link_tag(%{rel="up" href="#{url}" title="#{clean_tags(tit)}"})
|
1393
1499
|
set_at(:pre, :htmlsite_up, link_up)
|
1394
1500
|
end
|
1395
|
-
unless bartype == :inline or @variables[
|
1396
|
-
output_at(:body, :navbar_js,
|
1501
|
+
unless bartype == :inline or @variables['noBindKeys']
|
1502
|
+
output_at(:body, :navbar_js, invoke_service('navigation_keys', 'next' => urlspace))
|
1397
1503
|
end
|
1398
1504
|
else
|
1399
|
-
if (first or idx == 0) and !@variables[
|
1400
|
-
output_at(type, slot,
|
1505
|
+
if (first or idx == 0) and !@variables['noNavigationNote']
|
1506
|
+
output_at(type, slot, invoke_service('navigation_note'))
|
1401
1507
|
end
|
1402
1508
|
end
|
1403
1509
|
end
|
1404
1510
|
navbar_end(type, slot, idx)
|
1405
1511
|
end
|
1406
1512
|
|
1513
|
+
def format_navigation_buttons(invoker, type, slot, bartype, first=false, last=false)
|
1514
|
+
idx, first, last = navbar_output_index(invoker, first, last)
|
1515
|
+
urlp, prv = navbar_button_prev(type, slot, idx, bartype, !first && idx > 0)
|
1516
|
+
url, home = navbar_button_home(type, slot, idx, bartype, idx > 0)
|
1517
|
+
urln, nxt = navbar_button_next(type, slot, idx, bartype, !last)
|
1518
|
+
output_at(type, slot, [urlp, url, urln].join)
|
1519
|
+
end
|
1520
|
+
|
1407
1521
|
def navbar_button_prev(type, slot, idx, bartype, ok)
|
1408
1522
|
if ok
|
1409
|
-
text = @variables[
|
1523
|
+
text = @variables['prevButton'] || plain_text('<<')
|
1410
1524
|
urlp = navbar_guess_file_name(idx - 1, idx, bartype)
|
1411
|
-
ak
|
1412
|
-
prv
|
1525
|
+
ak = bartype == :top ? %{ accesskey="B"} : ''
|
1526
|
+
prv = %{<a class="navbarUrl" title="Previous" href="#{urlp}"#{ak}>#{text}</a>}
|
1413
1527
|
else
|
1414
1528
|
urlp = nil
|
1415
1529
|
end
|
1416
1530
|
unless urlp
|
1417
|
-
prv =
|
1531
|
+
prv = ' '
|
1418
1532
|
end
|
1419
|
-
navbar_add_element(type, slot, idx, prv,
|
1533
|
+
navbar_add_element(type, slot, idx, prv, 'navbar')
|
1420
1534
|
return urlp, prv
|
1421
1535
|
end
|
1422
|
-
|
1536
|
+
|
1423
1537
|
def navbar_button_home(type, slot, idx, bartype, ok)
|
1424
|
-
if ok or @variables[
|
1425
|
-
text = @variables[
|
1426
|
-
url = navbar_guess_file_name(
|
1427
|
-
ak = [:top,
|
1428
|
-
hc = [
|
1538
|
+
if ok or @variables['homeShowAlways']
|
1539
|
+
text = @variables['homeButton'] || '[-]'
|
1540
|
+
url = navbar_guess_file_name(@deplate.home_index, idx, bartype) || '#pagetop'
|
1541
|
+
ak = [:top, 'navbar'].include?(bartype) ? %{ accesskey='H'} : ''
|
1542
|
+
hc = ['navbar'].include?(bartype) ? 'navBar' : 'navbarUrl'
|
1429
1543
|
home = %{<a class="#{hc}" title="Home" href="#{url}"#{ak}>#{text}</a>}
|
1430
1544
|
else
|
1431
1545
|
url = nil
|
1432
1546
|
end
|
1433
1547
|
unless url
|
1434
|
-
home =
|
1548
|
+
home = ' '
|
1435
1549
|
end
|
1436
|
-
navbar_add_element(type, slot, idx, home,
|
1550
|
+
navbar_add_element(type, slot, idx, home, 'navbar')
|
1437
1551
|
return url, home
|
1438
1552
|
end
|
1439
1553
|
|
1440
1554
|
def navbar_button_next(type, slot, idx, bartype, ok)
|
1441
1555
|
if ok
|
1442
|
-
text = @variables[
|
1556
|
+
text = @variables['nextButton'] || plain_text('>>')
|
1443
1557
|
urln = navbar_guess_file_name(idx + 1, idx, bartype)
|
1444
|
-
ak = bartype == :top ? %{ accesskey=
|
1558
|
+
ak = bartype == :top ? %{ accesskey='N'} : ''
|
1445
1559
|
nxt = %{<a class="navbarUrl" title="Next" href="#{urln}"#{ak}>#{text}</a>}
|
1446
1560
|
else
|
1447
1561
|
urln = nil
|
1448
1562
|
end
|
1449
1563
|
unless urln
|
1450
|
-
nxt =
|
1564
|
+
nxt = ' '
|
1451
1565
|
end
|
1452
|
-
navbar_add_element(type, slot, idx, nxt,
|
1566
|
+
navbar_add_element(type, slot, idx, nxt, 'navbar')
|
1453
1567
|
return urln, nxt
|
1454
1568
|
end
|
1455
1569
|
|
1456
1570
|
def navbar_menu(type, slot, idx, bartype)
|
1457
|
-
unless @deplate.options.navmenu
|
1571
|
+
# unless @deplate.options.navmenu
|
1458
1572
|
navmenu = [%{<form action=""><select class="navmenu" name="Contents"
|
1459
1573
|
onChange="self.location.href=this.form.Contents.options[this.form.Contents.options.selectedIndex].value">},
|
1460
1574
|
%{<option value="">[ #{@deplate.msg("Contents")} ]</option>},
|
1461
1575
|
%{<option value="">------------------------</option>}]
|
1462
1576
|
|
1463
1577
|
acc = []
|
1464
|
-
@variables[
|
1578
|
+
@variables['@contents'] ||= acc
|
1579
|
+
th = @deplate.output.top_heading
|
1465
1580
|
@deplate.each_heading(:top) do |hd, title|
|
1466
1581
|
file = hd.output_file_name(:basename => true)
|
1467
1582
|
unless hd.kind_of?(Deplate::NullTop)
|
@@ -1471,7 +1586,16 @@ EOH
|
|
1471
1586
|
end
|
1472
1587
|
acc << [title, file]
|
1473
1588
|
end
|
1474
|
-
|
1589
|
+
pre = (hd.level and hd.level > 1) ? (' ' * hd.level) : nil
|
1590
|
+
o = []
|
1591
|
+
o << 'selected' if hd == th
|
1592
|
+
if o.empty?
|
1593
|
+
o = nil
|
1594
|
+
else
|
1595
|
+
o << nil unless o.empty?
|
1596
|
+
o = o.join(' ')
|
1597
|
+
end
|
1598
|
+
navmenu << %{<option #{o}value="#{file}">#{pre}#{title}</option>}
|
1475
1599
|
end
|
1476
1600
|
|
1477
1601
|
navmenu << %{</select>}
|
@@ -1480,8 +1604,8 @@ EOH
|
|
1480
1604
|
# navmenu << %{</button>}
|
1481
1605
|
navmenu << %{</form>}
|
1482
1606
|
@deplate.options.navmenu = navmenu.join("\n")
|
1483
|
-
end
|
1484
|
-
navbar_add_element(type, slot, idx, @deplate.options.navmenu,
|
1607
|
+
# end
|
1608
|
+
navbar_add_element(type, slot, idx, @deplate.options.navmenu, 'navmenu')
|
1485
1609
|
end
|
1486
1610
|
|
1487
1611
|
|
@@ -1489,88 +1613,56 @@ EOH
|
|
1489
1613
|
def format_navigation_links(depth)
|
1490
1614
|
acc = []
|
1491
1615
|
start = navbar_guess_file_name(0, nil, :inline)
|
1492
|
-
if start and start !=
|
1493
|
-
title = @deplate.msg(
|
1616
|
+
if start and start != ''
|
1617
|
+
title = @deplate.msg('Frontpage')
|
1494
1618
|
acc << head_link_tag(%{rel="start" href="#{start}" title="#{clean_tags(title)}"})
|
1495
1619
|
end
|
1496
|
-
tags = [
|
1497
|
-
@deplate.each_heading(depth ||
|
1620
|
+
tags = ['', 'chapter', 'section', 'subsection']
|
1621
|
+
@deplate.each_heading(depth || @deplate.options.split_level) do |hd, title|
|
1498
1622
|
ref = tags[hd.level]
|
1499
1623
|
anchor = hd.args[:id] || hd.label.first
|
1500
1624
|
file = hd.output_file_name(:basename => true)
|
1501
|
-
file =
|
1625
|
+
file = escape_filename(file)
|
1626
|
+
file = [file, '#', anchor].join if anchor
|
1502
1627
|
acc << head_link_tag(%{rel="#{ref}" href="#{file}" title="#{clean_tags(title)}"})
|
1503
1628
|
end
|
1504
1629
|
acc.join("\n")
|
1505
1630
|
end
|
1631
|
+
|
1632
|
+
def escape_filename(fname)
|
1633
|
+
fname.split(/\//).collect {|p| URI.escape(p)}.join('/')
|
1634
|
+
end
|
1506
1635
|
|
1507
|
-
def navbar_guess_file_name(idx, base, bartype, section=nil)
|
1636
|
+
def navbar_guess_file_name(idx, base=nil, bartype=nil, section=nil)
|
1508
1637
|
b = @deplate.output_filename_by_idx(base)
|
1509
1638
|
ff = @deplate.output_filename_by_idx(idx)
|
1510
1639
|
f = @deplate.relative_path_by_file(ff, b)
|
1640
|
+
f = escape_filename(f)
|
1511
1641
|
if bartype == :inline
|
1512
1642
|
section ||= @deplate.top_heading_by_idx(idx)
|
1513
1643
|
if section
|
1514
1644
|
anchor = section.args[:id] || section.label.first
|
1515
|
-
if anchor and anchor !=
|
1516
|
-
f = [f,
|
1645
|
+
if anchor and anchor != 'deplateNullTop'
|
1646
|
+
f = [f, '#', anchor].join
|
1517
1647
|
end
|
1518
1648
|
end
|
1519
1649
|
end
|
1520
1650
|
return f
|
1521
1651
|
end
|
1522
1652
|
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
end
|
1528
|
-
|
1529
|
-
def navbar_end(type, slot, idx)
|
1530
|
-
output_at(type, slot, %{</tr></table>})
|
1531
|
-
end
|
1532
|
-
|
1533
|
-
def navbar_add_element(type, slot, idx, element, htmlclass)
|
1534
|
-
if !@variables["noTabBarButtons"] and type and slot
|
1535
|
-
output_at(type, slot, %{<td class="#{htmlclass}">#{element}</td>})
|
1536
|
-
end
|
1653
|
+
def handle_key(key, function)
|
1654
|
+
key = ',%s,' % key.split(/\s*,\s*/).join(',')
|
1655
|
+
@deplate.output.attributes[:handle_keys] ||= {}
|
1656
|
+
@deplate.output.attributes[:handle_keys][key] = function
|
1537
1657
|
end
|
1538
1658
|
|
1539
|
-
|
1540
|
-
|
1541
|
-
if invoker.respond_to?(:top_heading)
|
1542
|
-
th = invoker.top_heading
|
1543
|
-
acc << @deplate.output_index(th)
|
1544
|
-
acc << first || th.first_top
|
1545
|
-
acc << last || th.last_top
|
1546
|
-
else
|
1547
|
-
idx = @deplate.output_index
|
1548
|
-
acc << idx
|
1549
|
-
acc << (first || (idx == 0))
|
1550
|
-
acc << (last || (@deplate.number_of_outputs == idx + 1))
|
1551
|
-
end
|
1552
|
-
return acc
|
1553
|
-
end
|
1554
|
-
|
1555
|
-
end
|
1556
|
-
|
1557
|
-
|
1558
|
-
class Deplate::Core
|
1559
|
-
def formatter_initialize_html
|
1560
|
-
@doc_services["navigation_bar"] = :html_navigation_bar
|
1561
|
-
@doc_services["navigation_note"] = :html_navigation_note
|
1562
|
-
@doc_services["navigation_keys"] = :html_navigation_keys
|
1563
|
-
@doc_services["navigation_links"] = :html_navigation_links
|
1564
|
-
@html_navigation_note = nil
|
1565
|
-
end
|
1566
|
-
|
1567
|
-
def html_navigation_links(args, text)
|
1568
|
-
depth = args["depth"]
|
1659
|
+
def_service('navigation_links') do |args, text|
|
1660
|
+
depth = args['depth']
|
1569
1661
|
depth &&= depth.to_i
|
1570
|
-
|
1662
|
+
format_navigation_links(depth)
|
1571
1663
|
end
|
1572
1664
|
|
1573
|
-
|
1665
|
+
def_service('navigation_bar') do |args, text|
|
1574
1666
|
type = :array
|
1575
1667
|
slot = []
|
1576
1668
|
invoker = args[:invoker]
|
@@ -1579,7 +1671,14 @@ class Deplate::Core
|
|
1579
1671
|
else
|
1580
1672
|
invoker = Deplate::PseudoContainer.new(@deplate, :args => args)
|
1581
1673
|
end
|
1582
|
-
|
1674
|
+
bartype = if args['top']
|
1675
|
+
:top
|
1676
|
+
elsif args['bottom']
|
1677
|
+
:bottom
|
1678
|
+
else
|
1679
|
+
:inline
|
1680
|
+
end
|
1681
|
+
format_navigation_bar(invoker, type, slot, bartype)
|
1583
1682
|
slot.join("\n")
|
1584
1683
|
end
|
1585
1684
|
|
@@ -1589,49 +1688,133 @@ class Deplate::Core
|
|
1589
1688
|
# 16 ... shift
|
1590
1689
|
# 17 ... ctrl
|
1591
1690
|
# 18 ... alt
|
1691
|
+
# 19 ... pause
|
1592
1692
|
# 27 ... esc
|
1593
1693
|
# 32 ... space
|
1694
|
+
# 33 ... page up
|
1695
|
+
# 34 ... page down
|
1594
1696
|
# 37 ... left
|
1595
1697
|
# 39 ... right
|
1596
1698
|
# 78 ... n
|
1699
|
+
# 109 ... -
|
1700
|
+
# 112 ... F1
|
1701
|
+
# ..
|
1702
|
+
# 121 ... F10
|
1703
|
+
# 188 ... ,
|
1704
|
+
# 190 ... .
|
1597
1705
|
# 191 ... #
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
EOJS
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
};
|
1621
|
-
var self = this;
|
1622
|
-
}
|
1623
|
-
var k = new HandleSpace();
|
1624
|
-
document.onkeydown = k.event;
|
1625
|
-
//-->
|
1626
|
-
</script>
|
1627
|
-
EOJS
|
1706
|
+
def_service('navigation_keys') do |args, text|
|
1707
|
+
urln = args['next']
|
1708
|
+
if urln
|
1709
|
+
last = false
|
1710
|
+
else
|
1711
|
+
idx, first, last = navbar_output_index(args[:invoker])
|
1712
|
+
urln = navbar_guess_file_name(idx + 1, idx)
|
1713
|
+
end
|
1714
|
+
# prevKey = @variables['prevKey'] || '8'
|
1715
|
+
acc = []
|
1716
|
+
if urln and !last
|
1717
|
+
nextKey = @variables['nextKey'] || '16'
|
1718
|
+
handle_key(nextKey, 'NavigationNextPage();') if nextKey.to_i > 0
|
1719
|
+
acc << <<EOJS
|
1720
|
+
<script type="text/javascript">
|
1721
|
+
<!--
|
1722
|
+
function NavigationNextPage() {
|
1723
|
+
window.location="#{urln}";
|
1724
|
+
}
|
1725
|
+
//-->
|
1726
|
+
</script>
|
1727
|
+
EOJS
|
1628
1728
|
end
|
1629
1729
|
acc.join
|
1630
1730
|
end
|
1731
|
+
|
1732
|
+
def_service('navigation_handle_keys') do |args, text|
|
1733
|
+
keys = @deplate.output.attributes[:handle_keys]
|
1734
|
+
if keys
|
1735
|
+
acc = [<<EOJS
|
1736
|
+
<script type="text/javascript">
|
1737
|
+
<!--
|
1738
|
+
function HandleKeys() {
|
1739
|
+
this.event = function(e) {
|
1740
|
+
if (!e) { e = window.event; }
|
1741
|
+
EOJS
|
1742
|
+
]
|
1743
|
+
cmd = nil
|
1744
|
+
keys.each do |key, fn|
|
1745
|
+
cmd = cmd ? '} else if' : 'if'
|
1746
|
+
acc << <<EOJS
|
1747
|
+
#{cmd} ("#{key}".indexOf(","+ e.keyCode +",") != -1) {
|
1748
|
+
#{fn}
|
1749
|
+
EOJS
|
1750
|
+
end
|
1751
|
+
# } else {
|
1752
|
+
# alert('DBG key code='+ e.keyCode);
|
1753
|
+
acc << <<EOJS
|
1754
|
+
}
|
1755
|
+
};
|
1756
|
+
var self = this;
|
1757
|
+
}
|
1758
|
+
var k = new HandleKeys();
|
1759
|
+
document.onkeydown = k.event;
|
1760
|
+
//-->
|
1761
|
+
</script>
|
1762
|
+
EOJS
|
1763
|
+
acc.join
|
1764
|
+
else
|
1765
|
+
''
|
1766
|
+
end
|
1767
|
+
end
|
1631
1768
|
|
1632
|
-
|
1769
|
+
def_service('stepwise_display') do |args, text|
|
1770
|
+
stepKey = @variables['stepwiseKey'] || '34'
|
1771
|
+
if @variables['stepwiseDisplay'] and stepKey
|
1772
|
+
handle_key(stepKey, 'StepwiseDisplayNext();')
|
1773
|
+
stepInit = @variables['stepwiseBegin'] || '1'
|
1774
|
+
acc = []
|
1775
|
+
acc << <<EOJS
|
1776
|
+
<script type="text/javascript">
|
1777
|
+
<!--
|
1778
|
+
var StepwiseCounter = #{stepInit};
|
1779
|
+
function StepwiseDisplayNext() {
|
1780
|
+
StepwiseCounter = StepwiseCounter + 1;
|
1781
|
+
var Elt = document.getElementById('Step' + StepwiseCounter);
|
1782
|
+
if (Elt)
|
1783
|
+
Elt.style.visibility = 'visible';
|
1784
|
+
EOJS
|
1785
|
+
if @variables['stepwiseContinous']
|
1786
|
+
acc << <<EOJS
|
1787
|
+
else
|
1788
|
+
NavigationNextPage();
|
1789
|
+
EOJS
|
1790
|
+
end
|
1791
|
+
acc << <<EOJS
|
1792
|
+
}
|
1793
|
+
//-->
|
1794
|
+
</script>
|
1795
|
+
EOJS
|
1796
|
+
acc.join
|
1797
|
+
else
|
1798
|
+
''
|
1799
|
+
end
|
1800
|
+
end
|
1801
|
+
|
1802
|
+
def_service('navigation_buttons') do |args, text|
|
1803
|
+
type = :array
|
1804
|
+
slot = []
|
1805
|
+
invoker = args[:invoker]
|
1806
|
+
if invoker
|
1807
|
+
invoker.args.update(args)
|
1808
|
+
else
|
1809
|
+
invoker = Deplate::PseudoContainer.new(self, :args => args)
|
1810
|
+
end
|
1811
|
+
format_navigation_buttons(invoker, type, slot, :inline)
|
1812
|
+
slot.join("\n")
|
1813
|
+
end
|
1814
|
+
|
1815
|
+
def_service('navigation_note') do |args, text|
|
1633
1816
|
unless @html_navigation_note
|
1634
|
-
@html_navigation_note = msg(:htmlnavigation_note)
|
1817
|
+
@html_navigation_note = @deplate.msg(:htmlnavigation_note)
|
1635
1818
|
unless @html_navigation_note
|
1636
1819
|
@html_navigation_note = [
|
1637
1820
|
%{<p class="htmlnavigationnote" />},
|
@@ -1651,12 +1834,64 @@ class Deplate::Core
|
|
1651
1834
|
].join("\n")
|
1652
1835
|
end
|
1653
1836
|
end
|
1654
|
-
|
1837
|
+
@html_navigation_note
|
1838
|
+
end
|
1839
|
+
|
1840
|
+
|
1841
|
+
private
|
1842
|
+
def navbar_begin(type, slot, idx)
|
1843
|
+
output_at(type, slot, %{<table class="navbar"><tr class="navbar">})
|
1844
|
+
end
|
1845
|
+
|
1846
|
+
def navbar_end(type, slot, idx)
|
1847
|
+
output_at(type, slot, %{</tr></table>})
|
1848
|
+
end
|
1849
|
+
|
1850
|
+
def navbar_add_element(type, slot, idx, element, htmlclass)
|
1851
|
+
if !@variables['noTabBarButtons'] and type and slot
|
1852
|
+
output_at(type, slot, %{<td class="#{htmlclass}">#{element}</td>})
|
1853
|
+
end
|
1655
1854
|
end
|
1855
|
+
|
1856
|
+
# Return [idx, first, last]
|
1857
|
+
def navbar_output_index(invoker, first=nil, last=nil)
|
1858
|
+
acc = []
|
1859
|
+
if invoker.respond_to?(:top_heading) and !invoker.kind_of?(Deplate::PseudoContainer)
|
1860
|
+
th = invoker.top_heading
|
1861
|
+
else
|
1862
|
+
th = @deplate.output.top_heading
|
1863
|
+
end
|
1864
|
+
if th
|
1865
|
+
idx = @deplate.output_index(th)
|
1866
|
+
end
|
1867
|
+
acc << idx
|
1868
|
+
gf = th.first_top
|
1869
|
+
gl = th.last_top
|
1870
|
+
# else
|
1871
|
+
# out = @deplate.output
|
1872
|
+
# acc << idx
|
1873
|
+
# gf = (idx == @deplate.home_index)
|
1874
|
+
# gl = (idx == @deplate.top_heading_idx)
|
1875
|
+
# end
|
1876
|
+
case first
|
1877
|
+
when true, false
|
1878
|
+
acc << first
|
1879
|
+
else
|
1880
|
+
acc << gf
|
1881
|
+
end
|
1882
|
+
case last
|
1883
|
+
when true, false
|
1884
|
+
acc << last
|
1885
|
+
else
|
1886
|
+
acc << gl
|
1887
|
+
end
|
1888
|
+
return acc
|
1889
|
+
end
|
1890
|
+
|
1656
1891
|
end
|
1657
1892
|
|
1658
1893
|
|
1659
|
-
class Deplate::
|
1894
|
+
class Deplate::Base
|
1660
1895
|
attr_accessor :html_class, :html_args
|
1661
1896
|
|
1662
1897
|
def hook_pre_setup_html
|
@@ -1692,5 +1927,3 @@ class Deplate::Command::LIST
|
|
1692
1927
|
end
|
1693
1928
|
end
|
1694
1929
|
|
1695
|
-
|
1696
|
-
# vim: ff=unix
|