module Kramdown::Options

def self.parse(name, data)

String and then to the correct type.
If +data+ already has the correct type, it is just returned. Otherwise it is converted to a

value with the correct type.
Parse the given value +data+ as if it was a value for the option +name+ and return the parsed
def self.parse(name, data)
  raise ArgumentError, "No option named #{name} defined" if !@options.has_key?(name)
  return data if @options[name].type === data
  data = data.to_s
  if @options[name].type == String
    data
  elsif @options[name].type == Integer
    Integer(data)
  elsif @options[name].type == Float
    Float(data)
  elsif @options[name].type == Symbol
    (data.strip.empty? ? nil : data.to_sym)
  elsif @options[name].type == Boolean
    data.downcase.strip != 'false' && !data.empty?
  elsif @options[name].type == Array
    data.split(/\s+/)
  end
end