lib/ramaze/gestalt.rb in Pistos-ramaze-2009.04.08 vs lib/ramaze/gestalt.rb in Pistos-ramaze-2009.06.12

- old
+ new

@@ -82,10 +82,13 @@ def _gestalt_call_tag(name, args, &block) if args.size == 1 and args[0].kind_of? Hash # args are just attributes, children in block... _gestalt_build_tag name, args[0], &block + elsif args[1].kind_of? Hash + # args are text and attributes ie. a('mylink', :href => '/mylink') + _gestalt_build_tag(name, args[1], args[0], &block) else # no attributes, but text _gestalt_build_tag name, {}, args, &block end end @@ -93,10 +96,10 @@ # build a tag for `name`, using `args` and an optional block that # will be yielded def _gestalt_build_tag(name, attr = {}, text = []) @out << "<#{name}" - @out << attr.map{|k,v| %[ #{k}="#{_gestalt_escape_entities(v)}"] }.join + @out << attr.map{|(k,v)| %[ #{k}="#{_gestalt_escape_entities(v)}"] }.join if text != [] or block_given? @out << ">" @out << _gestalt_escape_entities([text].join) if block_given? text = yield