Class: SiSU_HTML_Tune::CleanHTML
- Inherits:
-
Object
- Object
- SiSU_HTML_Tune::CleanHTML
- Defined in:
- lib/sisu/html_tune.rb
Instance Method Summary collapse
- #clean ⇒ Object
- #clean_for_html ⇒ Object
-
#initialize(html = '') ⇒ CleanHTML
constructor
A new instance of CleanHTML.
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
#clean ⇒ Object
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_html ⇒ Object
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,'<').gsub(/[>]/m,'>') end |