module Rouge::HasModes

def get_mode(mode)

def get_mode(mode)
  return self if self.mode == mode
  new_name = "#{self.name}.#{mode}"
  Class.new(self) { name(new_name); set_mode!(mode) }
end

def mode(arg=:absent)

def mode(arg=:absent)
  return @mode if arg == :absent
  @modes ||= {}
  @modes[arg] ||= get_mode(arg)
end

def mode!(arg)

def mode!(arg)
  alt_name = "#{self.name}.#{arg}"
  register(alt_name)
  set_mode!(arg)
end

def set_mode!(mode)

def set_mode!(mode)
  @mode = mode
  send("make_#{mode}!")
end