From 52027c6db59c2952f61ee03204fd947277d0cc62 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 10 May 2015 11:03:29 +0200 Subject: [PATCH] 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] --- etc/api/shared.yaml | 3 +++ src/mako/index.html.mako | 8 ++++++-- src/mako/lib/util.mako | 2 +- src/mako/lib/util.py | 3 +++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/etc/api/shared.yaml b/etc/api/shared.yaml index 70d359cb595..4918c099ffb 100644 --- a/etc/api/shared.yaml +++ b/etc/api/shared.yaml @@ -18,8 +18,11 @@ make: - api - cli html_index: + download_base_url: http://dl.byronimo.de asset_urls: crates_img: https://raw.githubusercontent.com/rust-lang/crates.io/master/public/favicon.ico + ubuntu_img: http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png + osx_img: http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74 directories: # directory under which all generated sources should reside output: gen diff --git a/src/mako/index.html.mako b/src/mako/index.html.mako index 78601da82db..637f987adb7 100644 --- a/src/mako/index.html.mako +++ b/src/mako/index.html.mako @@ -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 ! ${ad.make.id.upper()} % if api_name == 'api': + % else: + % for os_name in ('ubuntu', 'osx'): + + % endfor ## each os % endif % if not loop.last: -, +, % endif % endfor # each program type )
diff --git a/src/mako/lib/util.mako b/src/mako/lib/util.mako index 14c1a85990f..609e1257cf1 100644 --- a/src/mako/lib/util.mako +++ b/src/mako/lib/util.mako @@ -49,5 +49,5 @@ ${canonicalName}\ <%def name="program_name()" buffered="True">\ -${self.library_name().replace('_', '-')}\ +${util.program_name(name, version)}\ \ No newline at end of file diff --git a/src/mako/lib/util.py b/src/mako/lib/util.py index b5e547e7f56..54da752375c 100644 --- a/src/mako/lib/util.py +++ b/src/mako/lib/util.py @@ -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':