Module: Amrita2::Runtime
Overview
Constant Summary
Constants included
from Util
Util::AMP_WITHOUT_REFRENCE, Util::DefaultAllowedScheme, Util::NAME, Util::NAMECHAR, Util::NOT_REFERENCE, Util::UrlInvalidChar
Constants included
from Amrita2
FilterMethods, Hooki, SanitizedString
Instance Method Summary
collapse
Methods included from Util
sanitize_attribute_value, sanitize_text, sanitize_url
Instance Method Details
#amrita_get_context_value ⇒ Object
309
310
311
|
# File 'lib/amrita2/template.rb', line 309
def amrita_get_context_value
Thread::current[:amrita_context_value]
end
|
#amrita_set_context_value(v) ⇒ Object
305
306
307
|
# File 'lib/amrita2/template.rb', line 305
def amrita_set_context_value(v)
Thread::current[:amrita_context_value] = v
end
|
#end_tag(e, out = "") ⇒ Object
333
334
335
336
|
# File 'lib/amrita2/template.rb', line 333
def end_tag(e, out="")
out << "</#{e.stag.name}>"
out
end
|
#new_element(tag, attrs = {}, &block) ⇒ Object
313
314
315
316
317
318
319
|
# File 'lib/amrita2/template.rb', line 313
def new_element(tag, attrs={}, &block)
a = {}
attrs.each { |k,v| a[k.to_s] = v }
ret = Hpricot::Elem.new(Hpricot::STag.new(tag.to_s, a))
ret.instance_eval(&block) if block_given?
ret
end
|
#start_tag(e, out = "") ⇒ Object
321
322
323
324
325
326
327
328
329
330
331
|
# File 'lib/amrita2/template.rb', line 321
def start_tag(e, out="")
out << "<#{e.stag.name}"
e.attributes.each do |k, v|
next unless v
out << " "
out << "#{k}=\"#{Util::sanitize_attribute_value(v.to_s)}\""
end unless e.attributes.empty?
out << ">"
out
end
|