2006-09-12 04:14:21 +00:00
|
|
|
module Haml
|
|
|
|
module Helpers
|
|
|
|
def flatten(input)
|
|
|
|
input.gsub(/\n/, '
').gsub(/\r/, '')
|
|
|
|
end
|
2006-07-31 14:28:44 +00:00
|
|
|
|
2006-09-12 04:14:21 +00:00
|
|
|
def find_and_flatten(input)
|
|
|
|
input.scan(/<(textarea|code|pre)[^>]*>(.*?)<\/\1>/im).each do |thing|
|
|
|
|
input = input.gsub(thing[1], flatten(thing[1]))
|
|
|
|
end
|
|
|
|
input
|
2006-08-08 13:42:19 +00:00
|
|
|
end
|
2006-08-08 21:38:50 +00:00
|
|
|
|
2006-09-12 04:14:21 +00:00
|
|
|
def tabs(count)
|
|
|
|
' ' * count
|
|
|
|
end
|
2006-08-08 21:38:50 +00:00
|
|
|
|
2006-09-12 04:14:21 +00:00
|
|
|
def count_soft_tabs(line)
|
|
|
|
line.index(/[^ ]/) ? [line.index(/[^ ]/)/2, line.strip] : []
|
|
|
|
end
|
2006-08-08 21:38:50 +00:00
|
|
|
end
|
2006-07-31 14:28:44 +00:00
|
|
|
end
|