summaryrefslogtreecommitdiff
path: root/docs/ext
diff options
context:
space:
mode:
Diffstat (limited to 'docs/ext')
-rw-r--r--docs/ext/__init__.py0
-rw-r--r--docs/ext/docstrings.py56
-rw-r--r--docs/ext/manager_tmpl.j238
3 files changed, 0 insertions, 94 deletions
diff --git a/docs/ext/__init__.py b/docs/ext/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/docs/ext/__init__.py
+++ /dev/null
diff --git a/docs/ext/docstrings.py b/docs/ext/docstrings.py
deleted file mode 100644
index fc1c10b..0000000
--- a/docs/ext/docstrings.py
+++ /dev/null
@@ -1,56 +0,0 @@
-import inspect
-import os
-
-import jinja2
-import sphinx
-import sphinx.ext.napoleon as napoleon
-from sphinx.ext.napoleon.docstring import GoogleDocstring
-
-
-def classref(value, short=True):
- return value
-
- if not inspect.isclass(value):
- return ":class:%s" % value
- tilde = "~" if short else ""
- return ":class:`%sgitlab.objects.%s`" % (tilde, value.__name__)
-
-
-def setup(app):
- app.connect("autodoc-process-docstring", _process_docstring)
- app.connect("autodoc-skip-member", napoleon._skip_member)
-
- conf = napoleon.Config._config_values
-
- for name, (default, rebuild) in conf.items():
- app.add_config_value(name, default, rebuild)
- return {"version": sphinx.__display_version__, "parallel_read_safe": True}
-
-
-def _process_docstring(app, what, name, obj, options, lines):
- result_lines = lines
- docstring = GitlabDocstring(result_lines, app.config, app, what, name, obj, options)
- result_lines = docstring.lines()
- lines[:] = result_lines[:]
-
-
-class GitlabDocstring(GoogleDocstring):
- def _build_doc(self, tmpl, **kwargs):
- env = jinja2.Environment(
- loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), trim_blocks=False
- )
- env.filters["classref"] = classref
- template = env.get_template(tmpl)
- output = template.render(**kwargs)
-
- return output.split("\n")
-
- def __init__(
- self, docstring, config=None, app=None, what="", name="", obj=None, options=None
- ):
- super(GitlabDocstring, self).__init__(
- docstring, config, app, what, name, obj, options
- )
-
- if name.startswith("gitlab.v4.objects") and name.endswith("Manager"):
- self._parsed_lines.extend(self._build_doc("manager_tmpl.j2", cls=self._obj))
diff --git a/docs/ext/manager_tmpl.j2 b/docs/ext/manager_tmpl.j2
deleted file mode 100644
index 6e71c0c..0000000
--- a/docs/ext/manager_tmpl.j2
+++ /dev/null
@@ -1,38 +0,0 @@
-{% if cls._list_filters %}
-**Object listing filters**
-{% for item in cls._list_filters %}
-- ``{{ item }}``
-{% endfor %}
-{% endif %}
-
-{% if cls._create_attrs %}
-**Object Creation**
-{% if cls._create_attrs[0] %}
-Mandatory attributes:
-{% for item in cls._create_attrs[0] %}
-- ``{{ item }}``
-{% endfor %}
-{% endif %}
-{% if cls._create_attrs[1] %}
-Optional attributes:
-{% for item in cls._create_attrs[1] %}
-- ``{{ item }}``
-{% endfor %}
-{% endif %}
-{% endif %}
-
-{% if cls._update_attrs %}
-**Object update**
-{% if cls._update_attrs[0] %}
-Mandatory attributes for object update:
-{% for item in cls._update_attrs[0] %}
-- ``{{ item }}``
-{% endfor %}
-{% endif %}
-{% if cls._update_attrs[1] %}
-Optional attributes for object update:
-{% for item in cls._update_attrs[1] %}
-- ``{{ item }}``
-{% endfor %}
-{% endif %}
-{% endif %}