feat(index.html):added download links (osx,ubuntu)

All assets are configured via shared.yaml and are located elsewhere in
the web. This could lead to broken assets at some point, but I am just
risking it for know, knowing that it's easily done to have local
resources.

Closes #106
[skip ci]
This commit is contained in:
Sebastian Thiel
2015-05-10 11:03:29 +02:00
parent 0e6605d7a4
commit 52027c6db5
4 changed files with 13 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
<%
import os
import yaml
from util import (gen_crate_dir, api_index, crates_io_url)
from util import (gen_crate_dir, api_index, crates_io_url, program_name)
title = 'Google Service Documentation for Rust'
@@ -70,9 +70,13 @@ DO NOT EDIT !
<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>
% else:
% for os_name in ('ubuntu', 'osx'):
<a href="${html_index.download_base_url + '/google.rs/%s/%s/%s/%s' % (api_name, ad.cargo.build_version, os_name, program_name(an, v))}"><img src="${html_index.asset_urls.get('%s_img' % os_name)}" title="Download the 64bit program" height="16" width="16"/></a>
% endfor ## each os
% endif
% if not loop.last:
,
,
% endif
% endfor # each program type
)</span><br/>

View File

@@ -49,5 +49,5 @@ ${canonicalName}\
</%def>
<%def name="program_name()" buffered="True">\
${self.library_name().replace('_', '-')}\
${util.program_name(name, version)}\
</%def>

View File

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