diff --git a/src/mako/cli/mkdocs.yml.mako b/src/mako/cli/mkdocs.yml.mako index bda0a4fcac..3a65b7acae 100644 --- a/src/mako/cli/mkdocs.yml.mako +++ b/src/mako/cli/mkdocs.yml.mako @@ -3,6 +3,9 @@ from cli import (subcommand_md_filename, mangle_subcommand) c = new_context(schemas, resources, context.get('methods')) + + def pretty(n): + return ' '.join(s.capitalize() for s in mangle_subcommand(n).split('-')) %>\ <%namespace name="util" file="../lib/util.mako"/>\ site_name: ${util.canonical_name()} v${util.crate_version()} @@ -17,8 +20,10 @@ site_dir: ${mkdocs.site_dir} pages: - ['index.md', 'Home'] % for resource in sorted(c.rta_map.keys()): -- ['${subcommand_md_filename(resource)}', 'Commands', '${' '.join(s.capitalize() for s in mangle_subcommand(resource).split('-'))}'] -% endfor +% for method in sorted(c.rta_map[resource]): +- ['${subcommand_md_filename(resource, method)}', '${pretty(resource)}', '${pretty(method)}'] +% endfor # each method +% endfor # each resource theme: readthedocs diff --git a/src/mako/lib/cli.py b/src/mako/lib/cli.py index bea9f504dd..82a2b1a2bb 100644 --- a/src/mako/lib/cli.py +++ b/src/mako/lib/cli.py @@ -14,8 +14,8 @@ def mangle_subcommand(name): # transform the resource name into a suitable filename to contain the markdown documentation for it -def subcommand_md_filename(resource): - return mangle_subcommand(resource) + '.md' +def subcommand_md_filename(resource, method): + return mangle_subcommand(resource) + '_' + mangle_subcommand(method) + '.md' # split the result along split segments