module Repobrowse::Escape

Public Instance Methods

ha(str)
Alias for: xa
ht(str)
Alias for: xt
to_filename(str) click to toggle source

like format_sanitized_subject in git.git pretty.c with '%f' format string

# File lib/repobrowse/escape.rb, line 8
def to_filename(str)
  str = str.sub(/\n.*\z/s, '')
  str.gsub!(/[^A-Za-z0-9_\.]+/, '-')
  str.squeeze!('.')
  str.sub!(/[\.\-]+\z/, '')
  str.sub!(/\A[\.\-]+/, '')
  str
end
xa(str) click to toggle source
# File lib/repobrowse/escape.rb, line 21
def xa(str)
  str.encode!(xml: :attr)
end
Also aliased as: ha
xt(str) click to toggle source
# File lib/repobrowse/escape.rb, line 17
def xt(str)
  str.encode!(xml: :text)
end
Also aliased as: ht