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

Disable links to missing API docs. #219

Draft
wants to merge 3 commits into
base: ros2
Choose a base branch
from
Draft
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
17 changes: 12 additions & 5 deletions _includes/package_links.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,22 @@
{% endif %}

<div class="list-group list-group-sm {%if horizontal%}list-group-horizontal list-group-justified{%endif%}">
<a class="{{list_group_class}}"
target="_blank"
href="{{ package.data.docs_uri }}"
title="View API documentation on docs.ros.org"
{% unless package.snapshot.documented %}disabled{% endunless %}>
{% if package.data.docs_uri == '' %}
<div class="{{list_group_class}} disabled"
title="View API documentation">
<span style="margin-right: 5px;" class="glyphicon glyphicon-file"></span>
{%if hide_link_labels%}<br>{%endif%}
API Docs
</div>
{% else %}
<a class="{{list_group_class}}" target="_blank"
href="{{ package.data.docs_uri }}"
title="View API documentation">
<span style="margin-right: 5px;" class="glyphicon glyphicon-file"></span>
{%if hide_link_labels%}<br>{%endif%}
API Docs
</a>
{% endif %}
<a class="{{list_group_class}}"
target="_blank"
href="{{ package.data.browse_uri }}"
Expand Down
11 changes: 10 additions & 1 deletion _plugins/rosindex_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
require 'uri'
require 'set'
require 'yaml'
require "net/http"
require 'net/http'
require 'thread'

# local libs
Expand Down Expand Up @@ -513,6 +513,15 @@ def extract_package(site, distro, repo, snapshot, checkout_path, path, pkg_type,
docs_uri = "http://docs.ros.org/#{DEFAULT_LANGUAGE_PREFIX}/#{distro}/p/#{package_name}"
end

# ensure documentation uri refers to an existing site
url = URI(docs_uri)
Net::HTTP.start(url.host, url.port) do |http|
response = http.head(url.path)
if response.code != '200'
docs_uri = ''
end
end

# try to acquire information on the CI status of the package
ci_data = get_ci_data(distro, package_name, repo.name)

Expand Down
2 changes: 1 addition & 1 deletion _sass/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ th.rotate45 {
}

.list-group-horizontal .list-group-item {
display: inline-block;
display: table-cell;
}
.list-group-horizontal .list-group-item {
margin-bottom: 0;
Expand Down