Class: SiSU_HTML_Tune::CleanHTML

Inherits:
Object
  • Object
show all
Defined in:
lib/sisu/html_tune.rb

Instance Method Summary collapse

Constructor Details

#initialize(html = '') ⇒ CleanHTML

Returns a new instance of CleanHTML.



97
98
99
# File 'lib/sisu/html_tune.rb', line 97

def initialize(html='')
  @html=html
end

Instance Method Details

#cleanObject



110
111
112
113
114
115
116
117
118
119
# File 'lib/sisu/html_tune.rb', line 110

def clean
  html=@html
  str=if html.is_a?(String)
    html
  else html.obj
  end
  str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
    gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
    gsub(/[\\]{2}/m,'<br>')
end

#clean_for_htmlObject



100
101
102
103
104
105
106
107
108
109
# File 'lib/sisu/html_tune.rb', line 100

def clean_for_html
  html=@html
  str=if html.is_a?(String)
    html
  else html.obj
  end
  str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
    gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;').
    gsub(/[<]/m,'&lt;').gsub(/[>]/m,'&gt;')
end