Skip to content

Commit

Permalink
Merge pull request #176 from eputnam/pdoc36
Browse files Browse the repository at this point in the history
(PDOC-36) fix hack for README urls
  • Loading branch information
willmeek authored Apr 23, 2018
2 parents 2ec1b24 + 5d2c441 commit 8ce914e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet-strings/yard/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def self.scrub_string(str)
# @return [String] HTML document with links converted
def self.github_to_yard_links(data)
data.scan(/href\=\"\#(.+)\"/).each do |bad_link|
data.gsub!(bad_link.first, "label-#{bad_link.first.capitalize.gsub('-', '+')}")
data.gsub!("=\"##{bad_link.first}\"", "=\"#label-#{bad_link.first.capitalize.gsub('-', '+')}\"")
end
data
end
Expand Down
5 changes: 5 additions & 0 deletions spec/unit/puppet-strings/yard/util_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,10 @@
str = '<a href="github.com/blah/document.html#module-description">'
expect(subject.github_to_yard_links(str)).to eq(str)
end

it 'leaves plain text alone' do
str = '<a href="#module-description"> module-description'
expect(subject.github_to_yard_links(str)).to eq('<a href="#label-Module+description"> module-description')
end
end
end

0 comments on commit 8ce914e

Please # to comment.