diff --git a/app.rb b/app.rb index 0478f3864..a5a780df4 100644 --- a/app.rb +++ b/app.rb @@ -12,6 +12,7 @@ require 'everypolitician/popolo' require_relative './lib/popolo_helper' +require_relative './helpers/html' require_rel './lib/page' Dotenv.load diff --git a/helpers/html.rb b/helpers/html.rb new file mode 100644 index 000000000..af068d69f --- /dev/null +++ b/helpers/html.rb @@ -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