Docs: Encourage html safe methods for safe join
This commit is contained in:
parent
23af6f37a3
commit
295e7079aa
@ -24,11 +24,11 @@ def raw(stringish)
|
||||
# the supplied separator, are HTML escaped unless they are HTML
|
||||
# safe, and the returned string is marked as HTML safe.
|
||||
#
|
||||
# safe_join([raw("<p>foo</p>"), "<p>bar</p>"], "<br />")
|
||||
# # => "<p>foo</p><br /><p>bar</p>"
|
||||
# safe_join([tag.p("foo"), "<p>bar</p>"], "<br>")
|
||||
# # => "<p>foo</p><br><p>bar</p>"
|
||||
#
|
||||
# safe_join([raw("<p>foo</p>"), raw("<p>bar</p>")], raw("<br />"))
|
||||
# # => "<p>foo</p><br /><p>bar</p>"
|
||||
# safe_join([tag.p("foo"), tag.p("bar")], tag.br)
|
||||
# # => "<p>foo</p><br><p>bar</p>"
|
||||
#
|
||||
def safe_join(array, sep = $,)
|
||||
sep = ERB::Util.unwrapped_html_escape(sep)
|
||||
|
Loading…
Reference in New Issue
Block a user