feat(index.html): added back-link to crates.io

* url is created per-API and features a nice crates image coming
  from githubusercontent.

Closes #105
[skip ci]
This commit is contained in:
Sebastian Thiel
2015-05-10 09:10:18 +02:00
parent 5c284e1c41
commit 0e6605d7a4
3 changed files with 10 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
<%
import os
import yaml
from util import (gen_crate_dir, api_index)
from util import (gen_crate_dir, api_index, crates_io_url)
title = 'Google Service Documentation for Rust'
@@ -68,6 +68,9 @@ DO NOT EDIT !
% for api_name in type_names:
<% ad = tc[api_name] %>
<a class="mod" href="${api_index(DOC_ROOT, an, v, ad.make)}" title="${ad.make.id.upper()} docs for the ${an} ${v}">${ad.make.id.upper()}</a>
% if api_name == 'api':
<a href="${crates_io_url(an, v)}"><img src="${html_index.asset_urls.crates_img}" title="This API on crates.io" height="16" width="16"/></a>
% endif
% if not loop.last:
,
% endif

View File

@@ -832,6 +832,9 @@ def to_extern_crate_name(crate_name):
def gen_crate_dir(name, version, ti):
return to_extern_crate_name(library_to_crate_name(library_name(name, version), ti.target_suffix))
def crates_io_url(name, version):
return "https://crates.io/crates/%s" % library_to_crate_name(library_name(name, version))
def api_index(DOC_ROOT, name, version, ti, check_exists=True):
crate_dir = gen_crate_dir(name, version, ti)
if ti.documentation_engine == 'rustdoc':