mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
15 lines
373 B
Ruby
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
|