mitmproxy/docs/scripts/pdoc-template/module.html.jinja2

78 lines
3.1 KiB
Plaintext
Raw Normal View History

2021-02-02 22:34:26 +00:00
{% extends "default/module.html.jinja2" %}
{#
2021-02-04 21:52:28 +00:00
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 class(cls) %}
<div class="attr class">
{{ headerlink(cls) }}
<span class="name">{{ cls.qualname.replace("Events", " Events") }}</span>
</div>
{% endmacro %}
{% macro view_source(doc) %}
{% if doc.type == "function" %}
2021-02-04 21:52:28 +00:00
{{ default_view_source(doc) }}
{% endif %}
{% endmacro %}
{% macro is_public(doc) %}
{% if doc.name != "__init__" %}
{{ default_is_public(doc) }}
{% endif %}
{% endmacro %}
2021-02-04 21:52:28 +00:00
{% else %}
{% macro is_public(doc) %}
2021-02-05 21:04:45 +00:00
{% if doc.name is in(["from_state", "get_state", "set_state"]) %}
{% elif doc.modulename == "mitmproxy.addonmanager" %}
2021-02-04 21:52:28 +00:00
{% 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 %}
2021-02-05 21:04:45 +00:00
{% elif doc.modulename == "mitmproxy.coretypes.multidict" %}
{% if doc.name == "_MultiDict" %}
true
{% else %}
{{ default_is_public(doc) }}
{% endif %}
{% elif doc.modulename == "mitmproxy.flow" %}
{% if doc.name is not in(["__init__", "reply", "metadata"]) %}
{{ default_is_public(doc) }}
{% endif %}
{% elif doc.modulename == "mitmproxy.http" %}
{% if doc.qualname is not in([
"Message.__init__", "Message.data",
"Request.data",
"Response.data",
]) %}
{{ default_is_public(doc) }}
{% endif %}
{% elif doc.modulename == "mitmproxy.proxy.server_hooks" %}
{% if doc.qualname.startswith("ServerConnectionHookData") and doc.name != "__init__" %}
{{ default_is_public(doc) }}
{% endif %}
2021-09-04 15:03:26 +00:00
{% elif doc.modulename == "mitmproxy.proxy.context" %}
{% if doc.qualname is not in(["Context.__init__", "Context.fork", "Context.options"]) %}
{{ default_is_public(doc) }}
{% endif %}
{% elif doc.modulename == "mitmproxy.tls" %}
{% if doc.qualname is not in(["TlsData.__init__", "ClientHelloData.__init__"]) %}
{{ default_is_public(doc) }}
{% endif %}
2021-06-22 15:39:55 +00:00
{% elif doc.modulename == "mitmproxy.websocket" %}
{% if doc.qualname != "WebSocketMessage.type" %}
{{ default_is_public(doc) }}
{% endif %}
2021-02-05 21:04:45 +00:00
{% else %}
2021-02-04 21:52:28 +00:00
{{ default_is_public(doc) }}
{% endif %}
{% endmacro %}
{% endif %}