# File lib/amrita/node.rb, line 6
def Amrita::accelerator_loaded?
@@accelerator_loaded
end
def_tag(tagname, *attrs_p)
|
# File lib/amrita/node.rb, line 1138
def klass::def_tag(tagname, *attrs_p)
def_tag2(tagname, tagname, *attrs_p)
end
def_tag2(methodname, tagname, *attrs_p)
|
# File lib/amrita/node.rb, line 1142
def klass::def_tag2(methodname, tagname, *attrs_p)
methodname = methodname.id2name
tagname = tagname.id2name
attrs = attrs_p.collect { |a| a.id2name }
if attrs.size > 0
param = attrs.collect { |a| "#{a}=nil" }.join(", ")
param += ",*args,&block"
method_body = " e(#{tagname.to_ruby}, "
method_body += attrs.collect { |a| "a(#{a}, #{a})"}.join(", ")
method_body += ", *args, &block)"
else
param = "*args, &block"
method_body = " e(:#{tagname}, *args, &block) "
end
a = "def #{methodname}(#{param}) \n#{method_body}\nend\n"
#print a
eval a
end
e(tagname, attrs=nil, &block)
|
- e(:hr)
- <hr>
- e(:img src="a.png")
- <img src="a.png">
- e(:p) { "text" }
- <p>text</p>
- e(:span :class=>"fotter") { "bye" }
- <span class="fotter">bye</span>
# File lib/amrita/node.rb, line 1106
def e(tagname, attrs=nil, &block)
DefaultElementProcessor.generate_element(tagname, attrs, &block)
end
generate AttrArray object
# File lib/amrita/node.rb, line 1114
def a(*x, &block)
AttrArray.new(*x, &block)
end