summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/docs.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/util/docs.rb')
-rw-r--r--lib/puppet/util/docs.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/puppet/util/docs.rb b/lib/puppet/util/docs.rb
index 01aea7d3d..ebbce7317 100644
--- a/lib/puppet/util/docs.rb
+++ b/lib/puppet/util/docs.rb
@@ -26,6 +26,34 @@ module Puppet::Util::Docs
extra
end
end
+
+ # Handle the inline indentation in the docs.
+ def scrub(text)
+ # Stupid markdown
+ #text = text.gsub("<%=", "&lt;%=")
+ # For text with no carriage returns, there's nothing to do.
+ if text !~ /\n/
+ return text
+ end
+ indent = nil
+
+ # If we can match an indentation, then just remove that same level of
+ # indent from every line.
+ if text =~ /^(\s+)/
+ indent = $1
+ begin
+ return text.gsub(/^#{indent}/,'')
+ rescue => detail
+ puts detail.backtrace
+ puts detail
+ end
+ else
+ return text
+ end
+
+ end
+
+ module_function :scrub
end
# $Id$