Merge pull request #176 from eputnam/pdoc36
(PDOC-36) fix hack for README urls
This commit is contained in:
commit
8ce914ee71
|
@ -24,7 +24,7 @@ module PuppetStrings::Yard::Util
|
||||||
# @return [String] HTML document with links converted
|
# @return [String] HTML document with links converted
|
||||||
def self.github_to_yard_links(data)
|
def self.github_to_yard_links(data)
|
||||||
data.scan(/href\=\"\#(.+)\"/).each do |bad_link|
|
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
|
end
|
||||||
data
|
data
|
||||||
end
|
end
|
||||||
|
|
|
@ -39,5 +39,10 @@ STR
|
||||||
str = '<a href="www.github.com/blah/document.html#module-description">'
|
str = '<a href="www.github.com/blah/document.html#module-description">'
|
||||||
expect(subject.github_to_yard_links(str)).to eq(str)
|
expect(subject.github_to_yard_links(str)).to eq(str)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue