From 9ef57b594e4ac854644c4a1ecee940eccdfe00b7 Mon Sep 17 00:00:00 2001 From: Charlie Sharpsteen Date: Thu, 22 May 2014 23:42:10 -0700 Subject: [PATCH] Trim comment characters from docstrings A very naive attempt. Simple removes any leading whitespace, the comment character and then one space. --- lib/puppetx/yardoc/pops/yard_statement.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/puppetx/yardoc/pops/yard_statement.rb b/lib/puppetx/yardoc/pops/yard_statement.rb index cf50070..b7d90bf 100644 --- a/lib/puppetx/yardoc/pops/yard_statement.rb +++ b/lib/puppetx/yardoc/pops/yard_statement.rb @@ -51,7 +51,10 @@ module Puppetx::Yardoc::Pops source_text.slice(0, line-1).reverse.each do |line| if COMMENT_PATTERN.match(line) - comments.unshift line + # FIXME: The gsub trims comments, but is extremely optimistic: It + # assumes only one space separates the comment body from the + # comment character. + comments.unshift line.gsub(/^\s*#\s/, '') else # No comment found on this line. We must be done piecing together a # comment block.