Skip to content

Commit

Permalink
Merge pull request #38 from fhoussiau/main
Browse files Browse the repository at this point in the history
Add module docstring
  • Loading branch information
vemel authored Oct 1, 2024
2 parents ed6f6ea + 4f3eb3d commit 26f346c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion handsdown/md_document.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Markdown file builder.
"""

import re
import traceback
from pathlib import Path
Expand Down Expand Up @@ -86,7 +87,7 @@ def __exit__(
@property
def source_file_name(self) -> str:
"""
Source cide file name.
Source code file name.
"""
return self.source_code_url.split("/")[-1]

Expand Down
4 changes: 2 additions & 2 deletions handsdown/templates/common/class.md.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

[Show source in {{ md_document.source_file_name }}:{{ class.line_number }}]({{ md_document.source_code_url }}#L{{ class.line_number }})

{% for attrubute in class.get_documented_attribute_strings() -%}
{% for attribute in class.get_documented_attribute_strings() -%}
{% if loop.first -%}{{ "#### Attributes\n" -}}{% endif -%}
{{ "\n- " }}{{ attrubute }}
{{ "\n- " }}{{ attribute }}
{% if loop.last -%}{{ "\n\n" -}}{% endif -%}
{% endfor -%}

Expand Down
6 changes: 4 additions & 2 deletions handsdown/templates/material/module.md.jinja2
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# {{ module_record.title }}

{{ module_record.docstring }}

[{{ generator.md_index.title }}]({{ md_document.get_doc_link(generator.md_index.path) }}#{{ md_document.get_anchor(generator.md_index.title) }}) /{{ ' ' -}}
{% for parent_import_string in module_record.import_string.get_parents() -%}
{% set parent_module_record = generator.module_records.find_module_record(parent_import_string) -%}
Expand All @@ -20,8 +22,8 @@

{% if module_record.get_documented_attribute_strings() -%}
#### Attributes
{% for attrubute in module_record.get_documented_attribute_strings() -%}
{{ "\n- " }}{{ attrubute }}
{% for attribute in module_record.get_documented_attribute_strings() -%}
{{ "\n- " }}{{ attribute }}
{% endfor -%}
{{ "\n\n" -}}
{% endif -%}
Expand Down
6 changes: 4 additions & 2 deletions handsdown/templates/readthedocs/module.md.jinja2
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# {{ module_record.title }}

{{ module_record.docstring }}

[{{ generator.md_index.title }}]({{ md_document.get_doc_link(generator.md_index.path) }}#{{ md_document.get_anchor(generator.md_index.title) }}) /{{ ' ' -}}
{%- for parent_import_string in module_record.import_string.get_parents() -%}
{% set parent_module_record = generator.module_records.find_module_record(parent_import_string) -%}
Expand All @@ -20,8 +22,8 @@

{% if module_record.get_documented_attribute_strings() -%}
#### Attributes
{% for attrubute in module_record.get_documented_attribute_strings() -%}
{{ "\n- " }}{{ attrubute }}
{% for attribute in module_record.get_documented_attribute_strings() -%}
{{ "\n- " }}{{ attribute }}
{% endfor -%}
{{ "\n\n" -}}
{% endif -%}
Expand Down

0 comments on commit 26f346c

Please sign in to comment.