module ERB::Util

def xml_name_escape(name)

Experimental RBS support (using type sampling data from the type_fusion project).

def xml_name_escape: ((Symbol | String) name) -> String

This signature was generated using 26 samples from 1 application.

It follows the requirements of the specification: https://www.w3.org/TR/REC-xml/#NT-Name

# => "1___2___3"
xml_name_escape('1 < 2 & 3')

A utility method for escaping XML names of tags and names of attributes.
def xml_name_escape(name)
  name = name.to_s
  return "" if name.blank?
  starting_char = name[0].gsub(TAG_NAME_START_REGEXP, TAG_NAME_REPLACEMENT_CHAR)
  return starting_char if name.size == 1
  following_chars = name[1..-1].gsub(TAG_NAME_FOLLOWING_REGEXP, TAG_NAME_REPLACEMENT_CHAR)
  starting_char + following_chars
end