mitmproxy/docs/scripts/pdoc-template/module.html.jinja2
Maximilian Hils 51193f1d20 api docs++
2021-02-05 09:15:54 +01:00

40 lines
1.4 KiB
Django/Jinja

{% extends "default/module.html.jinja2" %}
{% block nav %}{% endblock %}
{% block style_layout %}{% endblock %}
{% block style_pygments %}{% endblock %}
{#
To document all event hooks, we do a bit of hackery:
1. scripts/api-events.py auto-generates generated/events.py.
2. scripts/api-render.py renders generated/events.py together with the remaining API docs.
3. This templates hides some elements of the default pdoc template.
#}
{% if module.name == "events" %}
{% macro module_name() %}
{% endmacro %}
{% macro view_source(doc) %}
{% if doc.type != "module" %}
{{ default_view_source(doc) }}
{% endif %}
{% endmacro %}
{% macro is_public(doc) %}
{% if doc.name != "__init__" %}
{{ default_is_public(doc) }}
{% endif %}
{% endmacro %}
{% else %}
{% macro is_public(doc) %}
{% if doc.modulename == "mitmproxy.addonmanager" %}
{% if doc.qualname.startswith("Loader") and not doc.name.startswith("_") %}
true
{% endif %}
{% elif doc.modulename == "mitmproxy.certs" %}
{% if doc.qualname == "Cert" or doc.qualname.startswith("Cert.") %}
{{ default_is_public(doc) }}
{% endif %}
{% elif doc.name is not in(["from_state", "get_state", "set_state"]) %}
{{ default_is_public(doc) }}
{% endif %}
{% endmacro %}
{% endif %}