Skip to content

Commit

Permalink
Initial extension commit for indices.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Jan 14, 2023
1 parent 3df1aec commit 57ccf30
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 3 deletions.
46 changes: 46 additions & 0 deletions VHDLDomain/Index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from typing import Iterable, Optional as Nullable, List, Tuple

from sphinx.domains import Index, IndexEntry


class ComponentIndex(Index):
name = "componentindex"
localname = "Component Index"
shortname = "Components"

def generate(self, docnames: Iterable[str] = None) -> Tuple[List[Tuple[str, List[IndexEntry]]], bool]:
result: List[Tuple[str, List[IndexEntry]]] = []

return result, True

class PackageIndex(Index):
name = "packageindex"
localname = "Package Index"
shortname = "Packages"

def generate(self, docnames: Iterable[str] = None) -> Tuple[List[Tuple[str, List[IndexEntry]]], bool]:
result: List[Tuple[str, List[IndexEntry]]] = []

return result, True


class SubprogramIndex(Index):
name = "subprogramindex"
localname = "Subprogram Index"
shortname = "Subprograms"

def generate(self, docnames: Iterable[str] = None) -> Tuple[List[Tuple[str, List[IndexEntry]]], bool]:
result: List[Tuple[str, List[IndexEntry]]] = []

return result, True


class TypeIndex(Index):
name = "typeindex"
localname = "Type Index"
shortname = "Types"

def generate(self, docnames: Iterable[str] = None) -> Tuple[List[Tuple[str, List[IndexEntry]]], bool]:
result: List[Tuple[str, List[IndexEntry]]] = []

return result, True
28 changes: 28 additions & 0 deletions VHDLDomain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,31 @@
__copyright__ = "2016-2023, Patrick Lehmann"
__license__ = "Apache License, Version 2.0"
__version__ = "0.1.0"

from sphinx.application import Sphinx
from sphinx.domains import Domain

from VHDLDomain.Index import ComponentIndex, PackageIndex, SubprogramIndex, TypeIndex


class VHDLDomain(Domain):
name = "vhdl"
label = "VHDL"
initial_data = {}
directives = {}
roles = {}
indices = {
ComponentIndex,
PackageIndex,
SubprogramIndex,
TypeIndex
}


def setup(sphinxApplication: Sphinx):
sphinxApplication.add_domain(VHDLDomain)
# sphinxApplication.add_config_value('vhdl_autodoc_source_path', '.', 'env', [str])

return {
"version": "0.1"
}
27 changes: 24 additions & 3 deletions doc/Dependency.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,32 @@ VHDLDomain Package
+--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+
| **Package** | **Version** | **License** | **Dependencies** |
+========================================================+=============+==========================================================================================+=================================================================================================================================+
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥2.11.0 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/master/LICENSE.txt>`__ | |
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥2.11.0 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/master/LICENSE.txt>`__ | *None* |
+--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+
| `pyGHDL <https://GitHub.com/GHDL/ghdl>`__ | ≥?.??.? | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/master/LICENSE.txt>`__ | pyVHDLModel, ... |
| `Sphinx <https://GitHub.com/sphinx-doc/sphinx>`__ | ≥5.3.0 | `BSD-2-Clause <https://GitHub.com/sphinx-doc/sphinx/blob/master/LICENSE>`__ |br| | * ❓`sphinxcontrib-applehelp <>`__ |
| | | | * ❓`sphinxcontrib-devhelp <>`__ |
| | | * ``sphinx.util.smartypants`` | * ❓`sphinxcontrib-jsmath <>`__ |
| | | * ``smartypants.py`` | * ❓`sphinxcontrib-htmlhelp <>`__ |
| | | * ``NumpyDocstring._parse_numpydoc_see_also_section`` | * ❓`sphinxcontrib-serializinghtml <>`__ |
| | | | * ❓`sphinxcontrib-qthelp <>`__ |
| | | | * ❓`Jinja2 <>`__ |
| | | | * ❓`Pygments <>`__ |
| | | | * ❓`docutils <>`__ |
| | | | * ❓`snowballstemmer <>`__ |
| | | | * ❓`babel <>`__ |
| | | | * ❓`alabaster <>`__ |
| | | | * ❓`imagesize <>`__ |
| | | | * ❓`requests <>`__ |
| | | | * ❓`packaging <>`__ |
| | | | * ❓`importlib-metadata <>`__ |
| | | | * ❓`colorama <>`__ |
+--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+
| ❗❗`pyGHDL <https://GitHub.com/GHDL/ghdl>`__ | ≥?.??.? | `GPL 2 <https://GitHub.com/GHDL/ghdl/blob/master/COPYING.md>`__ | * `pyVHDLModel <https://GitHub.com/pyTooling/pyTooling/blob/master/LICENSE.txt>`__ |
| | | | * `pyTooling <https://GitHub.com/pyTooling/pyTooling/blob/master/LICENSE.txt>`__ |
+--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+

.. # ❗❓
.. # importlib-metadata, could be removed if VHDLDomain is limited to Py 3.10/3.11
.. _dependency-testing:

Expand Down Expand Up @@ -95,7 +116,7 @@ the mandatory dependencies too.
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
| `autoapi <https://GitHub.com/carlos-jenkins/autoapi>`__ | | `Apache License, 2.0 <https://GitHub.com/carlos-jenkins/autoapi/blob/master/LICENSE>`__ | *Not yet evaluated.* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
| !! `sphinx_fontawesome <https://GitHub.com/fraoustin/sphinx_fontawesome>`__ | ≥0.0.6 | `GPL 2.0 <https://GitHub.com/fraoustin/sphinx_fontawesome/blob/master/LICENSE>`__ | *Not yet evaluated.* |
| ❗❗ `sphinx_fontawesome <https://GitHub.com/fraoustin/sphinx_fontawesome>`__ | ≥0.0.6 | `GPL 2.0 <https://GitHub.com/fraoustin/sphinx_fontawesome/blob/master/LICENSE>`__ | *Not yet evaluated.* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
| `sphinx_autodoc_typehints <https://GitHub.com/agronholm/sphinx-autodoc-typehints>`__ | ≥1.19.5 | `MIT <https://GitHub.com/agronholm/sphinx-autodoc-typehints/blob/master/LICENSE>`__ | *Not yet evaluated.* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+----------------------+
Expand Down
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"sphinx_fontawesome",
"sphinx_autodoc_typehints",
"autoapi.sphinx",
"VHDLDomain",
]


Expand Down

0 comments on commit 57ccf30

Please sign in to comment.