Reworked regex r%{}
This commit is contained in:
parent
d071d595ae
commit
a63e1bc1f9
1 changed files with 4 additions and 4 deletions
|
@ -86,7 +86,7 @@ class String
|
||||||
string.gsub!( %r{<pre>(.+?)</pre>}m ) { |placeholder|
|
string.gsub!( %r{<pre>(.+?)</pre>}m ) { |placeholder|
|
||||||
placeholder = placeholder.gsub(/\n/, '###BR###')
|
placeholder = placeholder.gsub(/\n/, '###BR###')
|
||||||
}
|
}
|
||||||
string.gsub!( %r{<code>(.+?)</code>/}m ) { |placeholder|
|
string.gsub!( %r{<code>(.+?)</code>}m ) { |placeholder|
|
||||||
placeholder = placeholder.gsub(/\n/, '###BR###')
|
placeholder = placeholder.gsub(/\n/, '###BR###')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,9 +106,9 @@ class String
|
||||||
string.gsub!(%r{<hr(|/| [^>]*)>}i, "___\n")
|
string.gsub!(%r{<hr(|/| [^>]*)>}i, "___\n")
|
||||||
|
|
||||||
# add new lines
|
# add new lines
|
||||||
string.gsub!( %r{\<(br|table)(|/| [^>]*)\>}i, "\n" )
|
string.gsub!( %r{<(br|table)(|/| [^>]*)>}i, "\n" )
|
||||||
string.gsub!( %r{\</(div|p|pre|blockquote|table|tr)(|\s.+?)\>}i, "\n" )
|
string.gsub!( %r{</(div|p|pre|blockquote|table|tr)(|\s.+?)>}i, "\n" )
|
||||||
string.gsub!( %r{/</td\>}i, ' ' )
|
string.gsub!( %r{</td>}i, ' ' )
|
||||||
|
|
||||||
# strip all other tags
|
# strip all other tags
|
||||||
string.gsub!( /\<.+?\>/, '' )
|
string.gsub!( /\<.+?\>/, '' )
|
||||||
|
|
Loading…
Reference in a new issue