chiark / gitweb /
m.sphinx: allow to link to special pages.
authorVladimír Vondruš <mosra@centrum.cz>
Fri, 6 Sep 2019 17:12:50 +0000 (19:12 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Tue, 10 Sep 2019 20:10:14 +0000 (22:10 +0200)
doc/plugins/sphinx.rst
documentation/test_python/test_inspect.py
plugins/m/sphinx.py

index c7cf28f02b5f69547fa2995cc305531fa2bd90a4..b6767a84b6c9a8f26aeb5a8a4f65df739016e647 100644 (file)
@@ -237,6 +237,8 @@ doing the following will ensure it can be easily used:
                     values. Sphinx treats those the same as ``py:data``.
                 -   ``py:data`` for data
                 -   ``std:doc`` for pages
+                -   ``std::special`` :label-warning:`m.css-specific` for
+                    special pages such as class / module / page listing
     ``2``       A `mysterious number <https://github.com/dahlia/sphinx-fakeinv/blob/02589f374471fa47073ab6cbac38258c3060a988/sphinx_fakeinv.py#L92-L93>`_.
                 `Sphinx implementation <https://github.com/sphinx-doc/sphinx/blob/a498960de9039b0d0c8d24f75f32fa4acd5b75e1/sphinx/util/inventory.py#L129>`_
                 denotes this as ``prio`` but doesn't use it in any way.
index c48ca659acd8fac6130495e39f3c8c44063ab41a..27ff89ea97095c2be44580209182b989e2cc1b7e 100644 (file)
@@ -217,6 +217,10 @@ inspect_create_intersphinx.pybind.overloaded_function py:function 2 inspect_crea
 inspect_create_intersphinx py:module 2 inspect_create_intersphinx.html -
 inspect_create_intersphinx.pybind py:module 2 inspect_create_intersphinx.pybind.html -
 page std:doc 2 page.html -
+index std:special 2 index.html -
+modules std:special 2 modules.html -
+classes std:special 2 classes.html -
+pages std:special 2 pages.html -
 """.lstrip())
         # Yes, above it should say A documentation page, but it doesn't
 
index fcddc7ad6f51b7f960e41728ccaa5496745c6b66..60e5bde051d0d4868f2614121934e931840827f2 100755 (executable)
@@ -512,11 +512,12 @@ def merge_inventories(name_map, **kwargs):
             type_string = 'py:data'
         elif entry.type == EntryType.PAGE:
             type_string = 'std:doc'
+        elif entry.type == EntryType.SPECIAL:
+            # TODO: this will cause duplicates when multiple m.css projects
+            #   gets together, solve better
+            type_string = 'std:special'
         else: # pragma: no cover
-            # TODO: what to do with these? allow linking to them? disambiguate
-            # or prefix the names somehow?
-            assert entry.type == EntryType.SPECIAL, entry.type
-            continue
+            assert False
 
         # Mark those with m-doc (as internal)
         internal_inventory.setdefault(type_string, {})[path_str] = (entry.url, '-', ['m-doc'])