module Sinatra::HamlHelpers

Sinatra::HamlHelpers

This extension provides some of the helper methods that existed in Haml 5 but were removed in Haml 6. To use this in your app, just register it:

require 'sinatra/base'
require 'sinatra/haml_helpers'

class Application < Sinatra::Base
  helpers Sinatra::HamlHelpers

  # now you can use the helpers in your views
  get '/' do
    haml_code = <<~HAML
      %p
        != surround "(", ")" do
          %a{ href: "https://example.org/" } example.org
    HAML
    haml haml_code
  end
end