lib/action_admin/shortcode.rb
# Parses shortcode string and returns attributes
Parses shortcode string and returns attributes
Parses shortcode string and returns attributes
def parse_shortcode_attr(string, attribs)
      found = Hash["#{string}".scan(/(\w+)="([^"]+)"/)].symbolize_keys
      valid = found.select { |k, _v| k.in? attribs.keys }
      valid = Hash[valid.map { |k, v| k == :ids ? [k, v.split(',').map(&:strip)] : [k, v] }]
      valid_shortcode?(string) ? attribs.merge(valid) : attribs
    end
def parse_shortcode_attr ( string , attribs ) found = Hash [ "#{string}" . scan ( / ( \w +)="([^"]+)" / ) ] . symbolize_keys valid = found . select { | k , _v | k . in? attribs . keys } valid = Hash [ valid . map { | k , v | k == :ids ? [ k , v . split ( ',' ) . map ( & :strip ) ] : [ k , v ] } ] valid_shortcode? ( string ) ? attribs . merge ( valid ) : attribs end
Parses shortcode string and returns attributes
Parses shortcode string and returns attributes
string
attribs