mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 17:56:16 +00:00
16 lines
436 B
Ruby
16 lines
436 B
Ruby
#htmlescape espaces special html characters. This is a replacement for
|
|
#CGI::escapeHTML, which has an inconsistent behavior with single quotes
|
|
#on different ruby versions ( 1.9 and 2.0 ).
|
|
|
|
#Example:
|
|
# {{ page.title | htmlescape }}
|
|
|
|
module Entities
|
|
|
|
def htmlescape(input)
|
|
input.gsub(/['&\"<>]/, { "'" => ''', '&' => '&', '"' => '"', '<' => '<', '>' => '>' })
|
|
end
|
|
|
|
Liquid::Template.register_filter self
|
|
|
|
end
|