Sha256: 0f44913f1d21781a8bf41d9f62ef4133fd65ce24dfbdb2749bfdfd523819f067

Contents?: true

Size: 721 Bytes

Versions: 1

Compression:

Stored size: 721 Bytes

Contents

# Creates tag.
#
def tag( name, *args, &block )
  if block_given?
    content = output_capture(&block)
  elsif args.first.is_a? String
    content = args.shift
  end
  attrs = args.shift || {}
#    t_attrs = attrs.map{|k,v| v.nil? ? " #{k}" : " #{k}=\"#{h(v)}\""}
  t_attrs = attrs.map{|k,v| v.nil? ? " #{k}" : " #{k}=\"#{(v)}\""}
  if content
    output = "<#{name}#{t_attrs.join}>"+content+"</#{name}>"
  else
    output = "<#{name}#{t_attrs.join}/>"
  end
  if Aerogel::Render::OutputBuffer.block_is_template?(block)
    output_concat(output)
    return nil
  else
    return output
  end
end

# Creates <a href=''..>...</a> tag.
#
def link_to( url, text = url, opts = {} )
  tag :a, text, opts.merge( href: url )
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aerogel-core-1.3.0 app/helpers/tags.rb