Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
pdoc/examples/custom-template/module.html.jinja2
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
32 lines (29 sloc)
1.08 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# | |
We want to extend the default template instead of defining everything ourselves. | |
#} | |
{% extends "default/module.html.jinja2" %} | |
{# | |
We can redefine individual blocks. | |
For example, if the `--favicon` option does not do what you want, you can specify a replacement like this. | |
#} | |
{% block favicon %} | |
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,{% filter urlencode %}{% include "resources/pdoc-logo.svg" %}{% endfilter %}"/> | |
{% endblock %} | |
{# | |
We can access system environment variables in the template, for example to pass version information. | |
#} | |
{% block nav_footer %} | |
<footer>My Package v{{ env["VERSION"] | default("1.0") }}</footer> | |
{% endblock %} | |
{# | |
We can also adjust which members are documented by overriding the is_public macro. | |
In this example, the private function `Dog.__lt__` is exposed publicly. | |
However, doing this is not recommended, see https://pdoc.dev/docs/pdoc.html#control-what-is-documented. | |
#} | |
{% macro is_public(doc) %} | |
{% if doc.qualname == "Dog.__lt__" %} | |
true | |
{% else %} | |
{{ default_is_public(doc) }} | |
{% endif %} | |
{% endmacro %} |