-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
348 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<div class="doc doc-object doc-class"> | ||
{% with html_id = class.path %} | ||
|
||
{% if config.only_parameters or config.only_class_level %} | ||
|
||
{% with docstring_sections = class.docstring.parsed %} | ||
{% include "docstring.html" with context %} | ||
{% endwith %} | ||
|
||
{% if config.merge_init_into_class %} | ||
{% if "__init__" in class.members and class.members["__init__"].has_docstring %} | ||
{% with docstring_sections = class.members["__init__"].docstring.parsed %} | ||
{% include "docstring.html" with context %} | ||
{% endwith %} | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% else %} | ||
|
||
{% if root %} | ||
{% set show_full_path = config.show_root_full_path %} | ||
{% set root_members = True %} | ||
{% elif root_members %} | ||
{% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %} | ||
{% set root_members = False %} | ||
{% else %} | ||
{% set show_full_path = config.show_object_full_path %} | ||
{% endif %} | ||
|
||
{% if not root or config.show_root_heading %} | ||
|
||
{% filter heading(heading_level, | ||
role="class", | ||
id=html_id, | ||
class="doc doc-heading", | ||
toc_label=class.name) %} | ||
|
||
{% if config.separate_signature %} | ||
<span class="doc doc-object-name doc-class-name">{% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %}</span> | ||
{% elif config.merge_init_into_class and "__init__" in class.members -%} | ||
{%- with function = class.members["__init__"] -%} | ||
{%- filter highlight(language="python", inline=True) -%} | ||
{% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %} | ||
{%- include "signature.html" with context -%} | ||
{%- endfilter -%} | ||
{%- endwith -%} | ||
{% else %} | ||
<code>{% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %}</code> | ||
{% endif %} | ||
|
||
{% with labels = class.labels %} | ||
{% include "labels.html" with context %} | ||
{% endwith %} | ||
|
||
{% endfilter %} | ||
|
||
{% if config.separate_signature and config.merge_init_into_class %} | ||
{% if "__init__" in class.members %} | ||
{% with function = class.members["__init__"] %} | ||
{% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %} | ||
{% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %} | ||
{% endfilter %} | ||
{% endwith %} | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% else %} | ||
{% if config.show_root_toc_entry %} | ||
{% filter heading(heading_level, | ||
role="class", | ||
id=html_id, | ||
toc_label=class.path if config.show_root_full_path else class.name, | ||
hidden=True) %} | ||
{% endfilter %} | ||
{% endif %} | ||
{% set heading_level = heading_level - 1 %} | ||
{% endif %} | ||
|
||
<div class="doc doc-contents {% if root %}first{% endif %}"> | ||
{% if config.show_bases and class.bases %} | ||
<p class="doc doc-class-bases"> | ||
Bases: {% for expression in class.bases -%} | ||
<code>{% include "expression.html" with context %}</code>{% if not loop.last %}, {% endif %} | ||
{% endfor -%} | ||
</p> | ||
{% endif %} | ||
|
||
{% with docstring_sections = class.docstring.parsed %} | ||
{% with is_merged_init = True %} | ||
{% include "docstring.html" with context %} | ||
{% endwith %} | ||
{% endwith %} | ||
|
||
{% if config.merge_init_into_class %} | ||
{% if "__init__" in class.members and class.members["__init__"].has_docstring %} | ||
{% with docstring_sections = class.members["__init__"].docstring.parsed, is_merged_init = True %} | ||
{% include "docstring.html" with context %} | ||
{% endwith %} | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% if config.show_source %} | ||
{% if config.merge_init_into_class %} | ||
{% if "__init__" in class.members and class.members["__init__"].source %} | ||
<details class="quote"> | ||
<summary>Source code in <code>{{ class.relative_filepath }}</code></summary> | ||
{{ class.members["__init__"].source|highlight(language="python", linestart=class.members["__init__"].lineno, linenums=True) }} | ||
</details> | ||
{% endif %} | ||
{% elif class.source %} | ||
<details class="quote"> | ||
<summary>Source code in <code>{{ class.relative_filepath }}</code></summary> | ||
{{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }} | ||
</details> | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% with obj = class %} | ||
{% set root = False %} | ||
{% set heading_level = heading_level + 1 %} | ||
{% include "children.html" with context %} | ||
{% endwith %} | ||
</div> | ||
{% endif %} | ||
|
||
{% endwith %} | ||
</div> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{% if docstring_sections %} | ||
{{ log.debug("Rendering docstring") }} | ||
{% for section in docstring_sections %} | ||
{% if not config.only_parameters %} | ||
{% if section.kind.value == "text" %} | ||
{{ section.value|convert_markdown(heading_level, html_id) }} | ||
{% elif section.kind.value == "attributes" %} | ||
{% include "docstring/attributes.html" with context %} | ||
{% elif section.kind.value == "parameters" %} | ||
{% include "docstring/parameters.html" with context %} | ||
{% elif section.kind.value == "other parameters" %} | ||
{% include "docstring/other_parameters.html" with context %} | ||
{% elif section.kind.value == "raises" %} | ||
{% include "docstring/raises.html" with context %} | ||
{% elif section.kind.value == "warns" %} | ||
{% include "docstring/warns.html" with context %} | ||
{% elif section.kind.value == "yields" %} | ||
{% include "docstring/yields.html" with context %} | ||
{% elif section.kind.value == "receives" %} | ||
{% include "docstring/receives.html" with context %} | ||
{% elif section.kind.value == "returns" %} | ||
{% include "docstring/returns.html" with context %} | ||
{% elif section.kind.value == "examples" %} | ||
{% include "docstring/examples.html" with context %} | ||
{% elif section.kind.value == "admonition" %} | ||
{% include "docstring/admonition.html" with context %} | ||
{% endif %} | ||
{% elif section.kind.value == "parameters" %} | ||
{% include "docstring/parameters.html" with context %} | ||
{% elif section.kind.value == "attributes" %} | ||
{% include "docstring/attributes.html" with context %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} |
8 changes: 8 additions & 0 deletions
8
docs/assets/templates/python/material/docstring/examples.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{{ "# Examples\n"|convert_markdown(heading_level, html_id) }} | ||
{% for section_type, sub_section in section.value %} | ||
{% if section_type.value == "text" %} | ||
{{ sub_section|convert_markdown(heading_level, html_id) }} | ||
{% elif section_type.value == "examples" %} | ||
{{ sub_section|highlight(language="pycon", linenums=False) }} | ||
{% endif %} | ||
{% endfor %} |
105 changes: 105 additions & 0 deletions
105
docs/assets/templates/python/material/docstring/parameters.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
{{ log.debug("Rendering parameters section") }} | ||
{% if is_merged_init %} | ||
{{ "# Parameters\n"|convert_markdown(heading_level, html_id) }} | ||
{% endif %} | ||
{% if config.docstring_section_style == "table" %} | ||
{% block table_style %} | ||
<p><strong>{{ section.title or "Parameters:" }}</strong></p> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Type</th> | ||
<th>Description</th> | ||
<th>Default</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for parameter in section.value %} | ||
{% if not config.only_parameters or parameter.name not in ("nlp", "name", "vocab", "scorer") %} | ||
<tr> | ||
<td><code>{{ parameter.name }}</code></td> | ||
<td> | ||
{% if parameter.annotation %} | ||
{% with expression = parameter.annotation %} | ||
<code>{% include "expression.html" with context %}</code> | ||
{% endwith %} | ||
{% endif %} | ||
</td> | ||
<td>{{ parameter.description|convert_markdown(heading_level, html_id) }}</td> | ||
<td> | ||
{% if parameter.default %} | ||
{% with expression = parameter.default %} | ||
<code>{% include "expression.html" with context %}</code> | ||
{% endwith %} | ||
{% else %} | ||
<em>required</em> | ||
{% endif %} | ||
</td> | ||
</tr> | ||
{% endif %} | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% endblock table_style %} | ||
{% elif config.docstring_section_style == "list" %} | ||
{% block list_style %} | ||
<p>{{ section.title or "Parameters:" }}</p> | ||
<ul> | ||
{% for parameter in section.value %} | ||
{% if not config.only_parameters or parameter.name not in ("nlp", "name", "vocab", "scorer") %} | ||
<li class="field-body"> | ||
<b>{{ parameter.name }}</b> | ||
{% if parameter.annotation %} | ||
{% with expression = parameter.annotation %} | ||
(<code>{% include "expression.html" with context %}</code>) | ||
{% endwith %} | ||
{% endif %} | ||
– {{ parameter.description|convert_markdown(heading_level, html_id) }} | ||
</li> | ||
{% endif %} | ||
{% endfor %} | ||
</ul> | ||
{% endblock list_style %} | ||
{% elif config.docstring_section_style == "spacy" %} | ||
{% block spacy_style %} | ||
<table> | ||
<thead> | ||
<tr> | ||
<th><b>{{ (section.title or "PARAMETER").rstrip(":").upper() }}</b></th> | ||
<th><b>DESCRIPTION</b></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for parameter in section.value %} | ||
{% if not config.only_parameters or parameter.name not in ("nlp", "name", "vocab", "scorer") %} | ||
<tr> | ||
<td><code>{{ parameter.name }}</code></td> | ||
<td class="doc-param-details"> | ||
{{ parameter.description|convert_markdown(heading_level, html_id) }} | ||
<p> | ||
{% if parameter.annotation %} | ||
<span class="doc-param-annotation"> | ||
<b>TYPE:</b> | ||
{% with expression = parameter.annotation %} | ||
<code>{% include "expression.html" with context %}</code> | ||
{% endwith %} | ||
</span> | ||
{% endif %} | ||
{% if parameter.default %} | ||
<span class="doc-param-default"> | ||
<b>DEFAULT:</b> | ||
{% with expression = parameter.default %} | ||
<code>{% include "expression.html" with context %}</code> | ||
{% endwith %} | ||
</span> | ||
{% endif %} | ||
</p> | ||
</td> | ||
</tr> | ||
{% endif %} | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% endblock spacy_style %} | ||
{% endif %} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{{ log.debug("Rendering " + function.path) }} | ||
|
||
<div class="doc doc-object doc-function"> | ||
{% with html_id = function.path %} | ||
|
||
{% if root %} | ||
{% set show_full_path = config.show_root_full_path %} | ||
{% set root_members = True %} | ||
{% elif root_members %} | ||
{% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %} | ||
{% set root_members = False %} | ||
{% else %} | ||
{% set show_full_path = config.show_object_full_path %} | ||
{% endif %} | ||
|
||
{% if not root or config.show_root_heading %} | ||
|
||
{% filter heading(heading_level, | ||
role="function", | ||
id=html_id, | ||
class="doc doc-heading", | ||
toc_label=function.name ~ "()") %} | ||
|
||
{% if config.separate_signature %} | ||
<span class="doc doc-object-name doc-function-name">{% if show_full_path %}{{ function.path }}{% else %}{{ function.name }}{% endif %}</span> | ||
{% else %} | ||
{% filter highlight(language="python", inline=True) %} | ||
{% if show_full_path %}{{ function.path }}{% else %}{{ function.name }}{% endif %} | ||
{% include "signature.html" with context %} | ||
{% endfilter %} | ||
{% endif %} | ||
|
||
{% with labels = function.labels %} | ||
{% include "labels.html" with context %} | ||
{% endwith %} | ||
|
||
{% endfilter %} | ||
|
||
{% if config.separate_signature %} | ||
{% filter highlight(language="python", inline=False) %} | ||
{% filter format_signature(config.line_length) %} | ||
{% if show_full_path %}{{ function.path }}{% else %}{{ function.name }}{% endif %} | ||
{% include "signature.html" with context %} | ||
{% endfilter %} | ||
{% endfilter %} | ||
{% endif %} | ||
|
||
{% else %} | ||
{% if config.show_root_toc_entry %} | ||
{% filter heading(heading_level, | ||
role="function", | ||
id=html_id, | ||
toc_label=function.path if config.show_root_full_path else function.name, | ||
hidden=True) %} | ||
{% endfilter %} | ||
{% endif %} | ||
{% set heading_level = heading_level - 1 %} | ||
{% endif %} | ||
|
||
<div class="doc doc-contents {% if root %}first{% endif %}"> | ||
{% with docstring_sections = function.docstring.parsed %} | ||
{% include "docstring.html" with context %} | ||
{% endwith %} | ||
|
||
{% if not config.only_parameters and config.show_source and function.source %} | ||
<details class="quote"> | ||
<summary>Source code in <code>{{ function.relative_filepath }}</code></summary> | ||
{{ function.source|highlight(language="python", linestart=function.lineno, linenums=True) }} | ||
</details> | ||
{% endif %} | ||
</div> | ||
|
||
{% endwith %} | ||
</div> |