Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PDOC-30) Fix Markdown parsing lists parsing #37

Merged
merged 1 commit into from
Jul 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/puppet_x/puppetlabs/strings/pops/yard_statement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ def extract_comments
# 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/, '')
# NOTE: We cannot just trim any amount of whitespace as indentation
# is sometimes significant in markdown. We would need a real parser.

# Comments which begin with some whitespace, a hash and then some
# tabs and spaces should be scrubbed. Comments which just have a
# solitary hash then a newline should keep that newline since newlines
# are significant in markdown.
comments.unshift line.gsub(/^\s*#[\t ]/, '').gsub(/^\s*#\n/, "\n")
else
# No comment found on this line. We must be done piecing together a
# comment block.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def the_definedtype()

parse(puppet_code, :puppet)

comment = "Definition: foo::bar\nThis class does some stuff"
comment = "Definition: foo::bar\n\nThis class does some stuff"
expect(the_definedtype).to document_a(:type => :definedtype, :docstring => comment)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class foo::bar { }

parse(puppet_code, :puppet)

comment = "Class: foo::bar\nThis class does some stuff"
comment = "Class: foo::bar\n\nThis class does some stuff"
expect(the_hostclass).to document_a(:type => :hostclass, :docstring => comment)
end

Expand Down