From 22e583df5a3b9eebdb62836786e060f3e4c991b9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 6 Sep 2019 19:12:50 +0200 Subject: [PATCH] m.sphinx: allow to link to special pages. --- doc/plugins/sphinx.rst | 2 ++ documentation/test_python/test_inspect.py | 4 ++++ plugins/m/sphinx.py | 9 +++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/plugins/sphinx.rst b/doc/plugins/sphinx.rst index c7cf28f0..b6767a84 100644 --- a/doc/plugins/sphinx.rst +++ b/doc/plugins/sphinx.rst @@ -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 `_. `Sphinx implementation `_ denotes this as ``prio`` but doesn't use it in any way. diff --git a/documentation/test_python/test_inspect.py b/documentation/test_python/test_inspect.py index c48ca659..27ff89ea 100644 --- a/documentation/test_python/test_inspect.py +++ b/documentation/test_python/test_inspect.py @@ -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 diff --git a/plugins/m/sphinx.py b/plugins/m/sphinx.py index fcddc7ad..60e5bde0 100755 --- a/plugins/m/sphinx.py +++ b/plugins/m/sphinx.py @@ -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']) -- 2.30.2