1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00
haml--haml/lib/haml/helpers.rb

25 lines
416 B
Ruby
Raw Normal View History

module HAMLHelpers
def flatten(input)
input.gsub(/\n/, '
').gsub(/\r/, '')
end
def find_and_flatten(input)
sets = input.scan(/<(textarea|code|pre)[^>]*>(.*?)<\/\1>/im)
sets.each do |thing|
input = input.gsub(thing[1], flatten(thing[1]))
end
input
end
def tabs(count)
" " * count
end
def count_soft_tabs(line)
[line.index(/[^ ]/)/2, line.strip]
end
end