Skip to content

Commit b188451

Browse files
committed
improve(docs): refine docstrings and API page
1 parent 54502d5 commit b188451

File tree

5 files changed

+41
-19
lines changed

5 files changed

+41
-19
lines changed

docs/api.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,32 @@ icon: fontawesome/solid/code
1212

1313
::: mkdocs_rss_plugin.config.RssPluginConfig
1414

15+
::: mkdocs_rss_plugin.config._DateFromMeta
16+
17+
::: mkdocs_rss_plugin.config._FeedsFilenamesConfig
18+
1519
----
1620

1721
::: mkdocs_rss_plugin.constants
1822

19-
----
23+
## Models
2024

2125
::: mkdocs_rss_plugin.models.PageInformation
2226

23-
----
24-
25-
::: mkdocs_rss_plugin.util.Util
27+
::: mkdocs_rss_plugin.models.RssFeedBase
2628

2729
## Integrations
2830

31+
::: mkdocs_rss_plugin.integrations.theme_material_base.IntegrationMaterialThemeBase
32+
33+
::: mkdocs_rss_plugin.integrations.theme_material_blog_plugin.IntegrationMaterialBlog
34+
2935
::: mkdocs_rss_plugin.integrations.theme_material_social_plugin.IntegrationMaterialSocialCards
36+
37+
## Utils
38+
39+
::: mkdocs_rss_plugin.git_manager.ci.CiHandler
40+
41+
::: mkdocs_rss_plugin.timezoner
42+
43+
::: mkdocs_rss_plugin.util.Util

mkdocs_rss_plugin/constants.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
# ########## Globals #############
1515
# ################################
1616

17-
DEFAULT_CACHE_FOLDER = Path(".cache/plugins/rss")
18-
DEFAULT_TEMPLATE_FOLDER = Path(__file__).parent / "templates"
19-
DEFAULT_TEMPLATE_FILENAME = DEFAULT_TEMPLATE_FOLDER / "rss.xml.jinja2"
20-
MKDOCS_LOGGER_NAME = "[RSS-plugin]"
21-
REMOTE_REQUEST_HEADERS = {
17+
DEFAULT_CACHE_FOLDER: Path = Path(".cache/plugins/rss")
18+
DEFAULT_TEMPLATE_FOLDER: Path = Path(__file__).parent / "templates"
19+
DEFAULT_TEMPLATE_FILENAME: Path = DEFAULT_TEMPLATE_FOLDER / "rss.xml.jinja2"
20+
MKDOCS_LOGGER_NAME: str = "[RSS-plugin]"
21+
REMOTE_REQUEST_HEADERS: dict[str, str] = {
2222
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
2323
"User-Agent": f"{__about__.__title__}/{__about__.__version__}",
2424
}

mkdocs_rss_plugin/git_manager/ci.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@
2727

2828

2929
class CiHandler:
30-
def __init__(self, repo: Git):
30+
"""Helper class to handle CI specific warnings."""
31+
32+
def __init__(self, repo: Git) -> None:
33+
"""Initialize the CI handler.
34+
35+
Args:
36+
repo (Git): Git repository object
37+
"""
3138
self.repo = repo
3239

3340
def raise_ci_warnings(self) -> None:

mkdocs_rss_plugin/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
@dataclass
2222
class PageInformation:
23-
"""Data type to set and get page information in order to produce the RSS feed."""
23+
"""Object describing a page information gathered from Mkdocs and used as feed's item."""
2424

2525
abs_path: Optional[Path] = None
2626
categories: Optional[list] = None
@@ -37,6 +37,8 @@ class PageInformation:
3737

3838
@dataclass
3939
class RssFeedBase:
40+
"""Object describing a feed."""
41+
4042
author: Optional[str] = None
4143
buildDate: Optional[str] = None
4244
copyright: Optional[str] = None

mkdocs_rss_plugin/timezoner.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,13 @@ def set_datetime_zoneinfo(
3838
) -> datetime:
3939
"""Apply timezone to a naive datetime.
4040
41-
:param input_datetime: offset-naive datetime
42-
:type input_datetime: datetime
43-
:param config_timezone: name of timezone as registered in IANA database,
44-
defaults to "UTC". Example : Europe/Paris.
45-
:type config_timezone: str, optional
46-
47-
:return: offset-aware datetime
48-
:rtype: datetime
41+
Args:
42+
input_datetime (datetime): offset-naive datetime
43+
config_timezone (str, optional): name of timezone as registered in IANA
44+
database. Defaults to "UTC". Example : Europe/Paris.
45+
46+
Returns:
47+
datetime: offset-aware datetime
4948
"""
5049
if input_datetime.tzinfo:
5150
return input_datetime

0 commit comments

Comments
 (0)