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