module Hamlit::Helpers

Public Instance Methods

preserve(input) click to toggle source

The same as original Haml::Helpers#preserve without block support.

# File lib/hamlit/helpers.rb, line 6
def preserve(input)
  # https://github.com/haml/haml/blob/4.1.0.beta.1/lib/haml/helpers.rb#L130-L133
  s = input.to_s.chomp("\n")
  s.gsub!(/\n/, '
')
  s.delete!("\r")
  s
end