# File lib/puppet/util/docs.rb, line 77 77: def scrub(text) 78: # Stupid markdown 79: #text = text.gsub("<%=", "<%=") 80: # For text with no carriage returns, there's nothing to do. 81: return text if text !~ /\n/ 82: indent = nil 83: 84: # If we can match an indentation, then just remove that same level of 85: # indent from every line. However, ignore any indentation on the 86: # first line, since that can be inconsistent. 87: text = text.lstrip 88: text.gsub!(/^([\t]+)/) { |s| " "*8*s.length; } # Expand leading tabs 89: # Find first non-empty line after the first line: 90: line2start = (text =~ /(\n?\s*\n)/) 91: line2start += $1.length 92: if (text[line2start..-1] =~ /^([ ]+)\S/) == 0 93: indent = Regexp.quote($1) 94: begin 95: return text.gsub(/^#{indent}/,'') 96: rescue => detail 97: puts detail.backtrace 98: puts detail 99: end 100: else 101: return text 102: end 103: 104: end