module Roda::RodaPlugins::H

  1. lib/roda/plugins/h.rb

The h plugin adds an h instance method that will HTML escape the input and return it.

The following example will return “<foo>” as the body.

plugin :h

route do |r|
  h('<foo>')
end

Constants

CGI = Object.new  
ESCAPE_HTML = { "&" => "&".freeze, "<" => "<".freeze, ">" => ">".freeze, "'" => "'".freeze, '"' => """.freeze, }.freeze  

to be escaped by h().

ESCAPE_HTML_PATTERN = Regexp.union(*ESCAPE_HTML.keys)  

A Regexp of HTML entities to match for escaping.