Skip to content

Commit

Permalink
Disable links to missing API docs.
Browse files Browse the repository at this point in the history
Signed-off-by: Michel Hidalgo <[email protected]>
  • Loading branch information
hidmic committed Jan 31, 2020
1 parent c5e2011 commit 7aca9cd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
19 changes: 10 additions & 9 deletions _includes/package_links.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
{% 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 %}>
<a class="{{list_group_class}} {% if package.data.docs_uri == '' %}disabled{% endif %}" target="_blank"
{% unless package.data.docs_uri == '' %}href="{{ package.data.docs_uri }}"{% endunless %}
{% if package.data.docs_uri == '' %}href="javascript:void(0)"{% endif %}
title="View API documentation">
<span style="margin-right: 5px;" class="glyphicon glyphicon-file"></span>
{%if hide_link_labels%}<br>{%endif%}
API Docs
Expand Down Expand Up @@ -51,11 +50,13 @@
Wiki
</a>
{%endif%}
<a class="{{list_group_class}}"
target="_blank"
<a class="{{list_group_class}} {% unless package.snapshot.documented %}disabled{% endunless %}"
target="_blank"
{% if package.snapshot.documented %}
href="http://http404error.github.io/roseco/graph.html?id=ros.json&focus={{page.package_name}}&height=1&depth=2&tred=standard&metagroup=false&colorby=Health&direction=LR"
title="View RosEco package graph"
{% unless package.snapshot.documented %}disabled{% endunless %}>
{% endif %}
{% unless package.snapshot.documented %}href="javascript:void(0);"{% endunless %}
title="View RosEco package graph">
<span style="margin-right: 5px;" class="glyphicon glyphicon-tree-deciduous"></span>
{%if hide_link_labels%}<br>{%endif%}
RosEco
Expand Down
11 changes: 10 additions & 1 deletion _plugins/rosindex_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
require 'colorator'
require 'fileutils'
require 'find'
require 'net/http'
require 'rexml/document'
require 'rexml/xpath'
require 'pathname'
require 'json'
require 'uri'
require 'set'
require 'yaml'
require "net/http"
require 'thread'

# local libs
Expand Down Expand Up @@ -500,6 +500,15 @@ def extract_package(site, distro, repo, snapshot, checkout_path, path, pkg_type,
docs_uri = "http://docs.ros2.org/#{distro}/api/#{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

0 comments on commit 7aca9cd

Please sign in to comment.