(PDOC-36) fix hack for README urls
Discovered that this hack was finding broken links and then replacing all instances of the link text in the README. This led to a lot of non-links being affected. This patch works harder to match only actual links and works as far as I can tell.
This commit is contained in:
parent
37cfe49f95
commit
5d2c4411ca
|
@ -24,7 +24,7 @@ module PuppetStrings::Yard::Util
|
|||
# @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
|
||||
|
|
|
@ -39,5 +39,10 @@ STR
|
|||
str = '<a href="www.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
|
||||
|
|
Loading…
Reference in New Issue