Skip to content
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
8 changes: 0 additions & 8 deletions _plugins/fetch_remote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ def pre_read(site)
end
end

Jekyll.logger.info " Fixing up URLs in swagger files"
Dir.glob("./engine/api/*.yaml") do |file_name|
Jekyll.logger.info " #{file_name}"
text = File.read(file_name)
replace = text.gsub!("https://docs.docker.com/", "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, replace should not strip the /

Are there other places where we do this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was checking other pages too with hardcoded docs.docker.com which leads to unexpected behavior for review because it doesn't check the actual domain with htmlproofer. I have another branch that will fix that and remove hardcoded root url as you suggested in #14784 (comment)

File.open(file_name, "w") { |file| file.puts replace }
end

end_time = Time.now
Jekyll.logger.info "done in #{(end_time - beginning_time)} seconds"
end
Expand Down
24 changes: 24 additions & 0 deletions _plugins/fix_urls.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require 'jekyll'
require 'octopress-hooks'

module Jekyll

class FetchRemote < Octopress::Hooks::Site
def post_read(site)
beginning_time = Time.now
Jekyll.logger.info "Starting plugin fix_urls.rb..."

Jekyll.logger.info " Fixing up URLs in swagger files"
Dir.glob(%w[./docker-hub/api/*.yaml ./engine/api/*.yaml]) do |file_name|
Jekyll.logger.info " #{file_name}"
text = File.read(file_name)
replace = text.gsub!("https://docs.docker.com", "")
File.open(file_name, "w") { |file| file.puts replace }
end

end_time = Time.now
Jekyll.logger.info "done in #{(end_time - beginning_time)} seconds"
end
end

end