mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 01:36:13 +00:00
Escape special HTML characters on the events page
This commit is contained in:
parent
701dfd35a2
commit
4bdca82894
3 changed files with 19 additions and 3 deletions
16
_plugins/htmlescape.rb
Normal file
16
_plugins/htmlescape.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
#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
|
Loading…
Add table
Add a link
Reference in a new issue