b and i tags also have their eventual inner spaces better managed
This commit is contained in:
parent
2cc8012731
commit
24ff28b64a
@ -66,6 +66,7 @@ module EventsHelper
|
|||||||
Kramdown::Document.new(spaces(desc), input: :html, line_width: line_width)
|
Kramdown::Document.new(spaces(desc), input: :html, line_width: line_width)
|
||||||
.to_kramdown
|
.to_kramdown
|
||||||
.gsub(/\\([\"'])/, '\1') # Remove slash before quotes
|
.gsub(/\\([\"'])/, '\1') # Remove slash before quotes
|
||||||
|
.remove(/[[:blank:]]+$/) # Remove extraneous spaces
|
||||||
.remove(/{::}/) # Markdown artefact
|
.remove(/{::}/) # Markdown artefact
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -73,8 +74,8 @@ module EventsHelper
|
|||||||
|
|
||||||
# Cleaner html elements, to correct things like <em> test</em>
|
# Cleaner html elements, to correct things like <em> test</em>
|
||||||
def spaces(desc)
|
def spaces(desc)
|
||||||
desc.gsub(/<(strong|em)> /, ' <\1>')
|
desc.gsub(/<(strong|em|b|i)> /, ' <\1>')
|
||||||
.gsub(%r{ </(strong|em)>}, '</\1> ')
|
.gsub(%r{ </(strong|em|b|i)>}, '</\1> ')
|
||||||
.gsub(/ ([,.])/, '\1')
|
.gsub(/[[:space:]]([,.])/, '\1')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -16,5 +16,6 @@ class EventsHelperTest < ActionView::TestCase
|
|||||||
assert_equal '**h**,', to_markdown('<strong>h </strong>,')
|
assert_equal '**h**,', to_markdown('<strong>h </strong>,')
|
||||||
assert_equal '*ho***h**,', to_markdown('<em>ho</em><strong>h </strong>,')
|
assert_equal '*ho***h**,', to_markdown('<em>ho</em><strong>h </strong>,')
|
||||||
assert_equal '*ho* **h**,', to_markdown('<em>ho</em><strong> h</strong>,')
|
assert_equal '*ho* **h**,', to_markdown('<em>ho</em><strong> h</strong>,')
|
||||||
|
assert_equal '*ho* **h**,', to_markdown('<i>ho</i><b> h</b>,')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user