classStringdefindent(amount, string="\t")
is_on =trueself.split("\n").collect do |line|# indent line
result = is_on ? string*amount + line : line
# turn indenting on or off for lines with preformatted text
if line =~/<pre/and line !~/<\/pre>/
is_on =falseelsif line !~/<pre/and line =~/<\/pre>/
is_on =trueend# return result
result
end.join("\n")endend