From ae47fe30debd0ff7305553b284d17739b004af0d Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 30 Apr 2020 12:13:20 +0300 Subject: [PATCH] Improve doc: classify TUI scripts by plugins --- doc/gui/build_index.py | 13 ++++++++++++- doc/gui/index.rst.in | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/gui/build_index.py b/doc/gui/build_index.py index 09e22cbe6..c72cd7c95 100755 --- a/doc/gui/build_index.py +++ b/doc/gui/build_index.py @@ -78,7 +78,18 @@ def main(src_dir, build_dir): ## Collect TUI scripts tui_files = sorted(f for f in os.listdir(lib_dir) if \ osp.isfile(osp.join(lib_dir, f)) and re.match('TUI_.*\.rst', f)) - tui_scripts += [osp.join('..', plugin_name, i) for i in tui_files] + if tui_files: + tui_list_file = osp.join(dist_dir, 'TUI_examples.rst') + with open(tui_list_file, 'w') as flist: + flist.write('.. _tui_{}:\n\n'.format(plugin_name.lower())) + title = plugin_name.replace('Plugin', ' plug-in') + flist.write('{}\n'.format(title)) + flist.write('{}\n\n'.format('='*len(title))) + flist.write('.. toctree::\n') + flist.write(' :titlesonly:\n') + flist.write(' :maxdepth: 1\n\n') + flist.writelines([' {}\n'.format(i) for i in tui_files]) + tui_scripts.append(osp.join('..', plugin_name, 'TUI_examples.rst')) ## Mark plugin as processed processed.append(plugin_name) diff --git a/doc/gui/index.rst.in b/doc/gui/index.rst.in index bde9f7476..0f549fd30 100644 --- a/doc/gui/index.rst.in +++ b/doc/gui/index.rst.in @@ -8,7 +8,7 @@ Welcome to SHAPER documentation! .. toctree:: :titlesonly: - :maxdepth: 3 + :maxdepth: 2 General/Introduction.rst General/Tutorial.rst -- 2.39.2