From 09ce891eeb2037dcb090355bf792bf7c3d7edaa5 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Sat, 1 Apr 2017 01:48:29 +0800 Subject: [PATCH 1/7] refactor(index.html.mako) Renamed a couple variables --- src/mako/index.html.mako | 47 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/mako/index.html.mako b/src/mako/index.html.mako index 9b98515857..b15cdb43e9 100644 --- a/src/mako/index.html.mako +++ b/src/mako/index.html.mako @@ -29,19 +29,19 @@ DO NOT EDIT ! - ${title} + + ${title}
@@ -98,20 +101,18 @@ function onCopy(e) { continue api_data = tc["api"] - api_revision = api_data.get('revision', None) + revision = metadata.get('revision', None) - # TODO: Find out why the api link always ends in +00000 instead of +20161020 api_link = api_index(DOC_ROOT, name, version, api_data['make'], - api_data['cargo'], api_revision) + api_data['cargo'], revision) crates_link = crates_io_url(name, version) crates_link += "/" - crates_link += crate_version(api_data.cargo.build_version, api_revision) + crates_link += crate_version(api_data.cargo.build_version, revision) cli_data = tc["cli"] - cli_revision = cli_data.get('revision', None) cli_link = api_index(DOC_ROOT, name, version, cli_data['make'], - cli_data['cargo'], cli_revision) + cli_data['cargo'], revision) %>\ ${name} (${version}) From ef070eef59b2eb3e54b77b5fe600e6f6c900c8dd Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Sat, 1 Apr 2017 21:48:37 +0800 Subject: [PATCH 7/7] fix(index.html.mako): Added an assert to detect when docs need updating --- src/mako/index.html.mako | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mako/index.html.mako b/src/mako/index.html.mako index 272797a1fe..cbb9f03d6c 100644 --- a/src/mako/index.html.mako +++ b/src/mako/index.html.mako @@ -91,9 +91,9 @@ function onCopy(e) { % for version in api.list[name]: <% - # We know type_names is just ["api", "cli"] - #type_names = tc.keys() type_names = ["api", "cli"] + assert set(type_names) == set(tc.keys()), "The type cache has changed, make sure to update the documentation accordingly" + with open(api_json_path(directories.api_base, name, version)) as fp: metadata = json.load(fp)