1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00
haml--haml/lib/hamlit/helpers.rb
2016-08-27 02:37:45 +09:00

15 lines
373 B
Ruby

# frozen_string_literal: true
module Hamlit
module Helpers
extend self
# The same as original Haml::Helpers#preserve without block support.
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
end
end