Salome HOME
Improve doc: classify TUI scripts by plugins
authorvsr <vsr@opencascade.com>
Thu, 30 Apr 2020 09:13:20 +0000 (12:13 +0300)
committervsr <vsr@opencascade.com>
Thu, 30 Apr 2020 09:13:20 +0000 (12:13 +0300)
doc/gui/build_index.py
doc/gui/index.rst.in

index 09e22cbe6b4453e9ccbc0595254514953b4f4838..c72cd7c95bd10e2b807bdcacf37f46501d46096c 100755 (executable)
@@ -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)
 
index bde9f74766aa7f155ad5d0cd82f06c48129bbe95..0f549fd301307e7f404f3aab1fbe1dce027c84b7 100644 (file)
@@ -8,7 +8,7 @@ Welcome to SHAPER documentation!
 
 .. toctree::
    :titlesonly:
-   :maxdepth: 3
+   :maxdepth: 2
 
    General/Introduction.rst
    General/Tutorial.rst