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 e943828
Show file tree
Hide file tree
Showing 2 changed files with 13 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
12 changes: 12 additions & 0 deletions helpers/html.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true
require 'sinatra/base'

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

helpers HTMLEscapeHelper
end

0 comments on commit e943828

Please sign in to comment.