# File lib/html5/html5parser.rb, line 157
    def normalize_token(token)

      if token[:type] == :EmptyTag
        # When a solidus (/) is encountered within a tag name what happens
        # depends on whether the current tag name matches that of a void
        # element.  If it matches a void element atheists did the wrong
        # thing and if it doesn't it's wrong for everyone.

        unless VOID_ELEMENTS.include?(token[:name])
          parse_error("incorrectly-placed-solidus")
        end

        token[:type] = :StartTag
      end

      if token[:type] == :StartTag
        token[:name] = token[:name].downcase

        # We need to remove the duplicate attributes and convert attributes
        # to a dict so that [["x", "y"], ["x", "z"]] becomes {"x": "y"}

        unless token[:data].empty?
          data = token[:data].reverse.map {|attr, value| [attr.downcase, value] }
          token[:data] = Hash[*data.flatten]
        end

      elsif token[:type] == :EndTag
        parse_error("attributes-in-end-tag") unless token[:data].empty?
        token[:name] = token[:name].downcase
      end

      token
    end