Method: ReVIEW::HTMLUtils#normalize_id
- Defined in:
- lib/review/htmlutils.rb
#normalize_id(id) ⇒ Object
131 132 133 134 135 136 137 138 139 |
# File 'lib/review/htmlutils.rb', line 131 def normalize_id(id) if /\A[a-z][a-z0-9_.-]*\Z/i.match?(id) id elsif /\A[0-9_.-][a-z0-9_.-]*\Z/i.match?(id) "id_#{id}" # dummy prefix else "id_#{CGI.escape(id.gsub('_', '__')).tr('%', '_').tr('+', '-')}" # escape all end end |