Improved html2text.
This commit is contained in:
parent
6bb8c7b6eb
commit
7434971416
2 changed files with 41 additions and 34 deletions
|
@ -103,6 +103,9 @@ class String
|
|||
# remove style tags with content
|
||||
string.gsub!( %r{<style(|\s.+?)>(.+?)</style>}im, '')
|
||||
|
||||
# insert spaces on [A-z]\n[A-z]
|
||||
string.gsub!( /([A-z])\n([A-z])/m, '\1 \2' )
|
||||
|
||||
# remove empty lines
|
||||
string.gsub!( /^\s*/m, '' )
|
||||
|
||||
|
|
|
@ -105,6 +105,10 @@ class AaaStringTest < ActiveSupport::TestCase
|
|||
result = "test col \ntest 4711"
|
||||
assert_equal(result, html.html2text)
|
||||
|
||||
html = "<p><span>Was\nsoll verbessert werden:</span></p>"
|
||||
result = 'Was soll verbessert werden:'
|
||||
assert_equal(result, html.html2text)
|
||||
|
||||
html = "<!-- some comment -->
|
||||
<div>
|
||||
test<br><br><br>\n<br>\n<br>\n
|
||||
|
|
Loading…
Reference in a new issue