diff --git a/etc/api/shared.yaml b/etc/api/shared.yaml index 8e329da7aa..06db9c3f25 100644 --- a/etc/api/shared.yaml +++ b/etc/api/shared.yaml @@ -15,12 +15,8 @@ api: make: # All known program ids. types: - - id: api - target_suffix: '' - documentation_engine: rustdoc - - id: cli - target_suffix: -cli - documentation_engine: mkdocs + - api + - cli directories: # directory under which all generated sources should reside output: gen diff --git a/src/mako/deps.mako b/src/mako/deps.mako index 8ded175ced..cb8e6819c2 100644 --- a/src/mako/deps.mako +++ b/src/mako/deps.mako @@ -138,7 +138,7 @@ publish${agsuffix}: | gen-all${agsuffix} ${space_join(4)} gen-all${agsuffix}: ${space_join(0)} % if global_targets: -${doc_index}: ${' '.join('docs-' + ti.id for ti in make.types)} ${' '.join(gen_type_cfg_path(ti.id) for ti in make.types)} +${doc_index}: ${' '.join('docs-' + api_name for api_name in make.types)} ${' '.join(gen_type_cfg_path(api_name) for api_name in make.types)} $(PYPATH) $(MAKO) --var DOC_ROOT=${doc_root} -io $(MAKO_SRC)/index.html.mako=$@ --data-files $(API_SHARED_INFO) $(API_LIST) @echo Documentation index created at '$@' docs-all: ${doc_index} diff --git a/src/mako/index.html.mako b/src/mako/index.html.mako index 05373f14fd..2e2b2694f5 100644 --- a/src/mako/index.html.mako +++ b/src/mako/index.html.mako @@ -1,17 +1,25 @@ <% import os + import yaml from util import (gen_crate_dir, api_index) title = 'Google Service Documentation for Rust' + # type cache: {'api': type-api.yaml-contents } + tc = dict() + for api_type in make.types: + data = yaml.load_all(open(os.path.join(directories.api_base, 'type-%s.yaml' % api_type))) + tc[api_type] = type(directories)(data.next()) + # end for each type to load cache for + first_api_prefix = None - for ti in make.types: - if ti.documentation_engine != 'rustdoc': + for ad in tc.values(): + if ad.make.documentation_engine != 'rustdoc': continue for an in sorted(api.list.keys()): for v in api.list[an]: - if api_index(DOC_ROOT, an, v, ti): - first_api_prefix = gen_crate_dir(an, v, ti) + if api_index(DOC_ROOT, an, v, ad.make): + first_api_prefix = gen_crate_dir(an, v, ad.make) break # for each version # for each api name @@ -46,19 +54,20 @@ DO NOT EDIT ! % for v in api.list[an]: <% has_any_index = False - types = list() - for ti in make.types: - if api_index(DOC_ROOT, an, v, ti): + type_names = list() + for api_name, ad in tc.iteritems(): + if api_index(DOC_ROOT, an, v, ad.make): has_any_index = True - types.append(ti) + type_names.append(api_name) # end for each type %>\ % if not has_any_index: <% continue %>\ % endif ${an} ${v} ( - % for ti in types: - ${ti.id.upper()} + % for api_name in type_names: + <% ad = tc[api_name] %> + ${ad.make.id.upper()} % if not loop.last: , % endif