Skip to content

Commit

Permalink
Add an HTML escape helper
Browse files Browse the repository at this point in the history
  • Loading branch information
octopusinvitro committed Sep 26, 2016
1 parent 4d5d7cb commit 1b0cdc5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
require 'everypolitician/popolo'

require_relative './lib/popolo_helper'
require_relative './helpers/html'
require_rel './lib/page'

Dotenv.load
Expand Down
11 changes: 11 additions & 0 deletions helpers/html.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'sinatra/base'

module Sinatra
module HTMLEscapeHelper
def h(text)
Rack::Utils.escape_html(text)
end
end

helpers HTMLEscapeHelper
end

0 comments on commit 1b0cdc5

Please sign in to comment.