-
-
Notifications
You must be signed in to change notification settings - Fork 654
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
plugin_meta
, plugin_description
and `plugin_installatio…
…n` macros
- Loading branch information
Showing
12 changed files
with
446 additions
and
204 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -12,4 +12,4 @@ dist.zip | |
packages/jspsych/README.md | ||
.turbo | ||
*.pyc | ||
cache.db | ||
docs/__generator__/cache |
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
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
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 |
---|---|---|
@@ -1,15 +1,29 @@ | ||
from pathlib import Path | ||
|
||
from docs.__generator__.plugins import generate_plugin_parameters_section | ||
from docs.__generator__.utils import hash_file | ||
from docs.__generator__.plugins import ( | ||
generate_plugin_author_info, | ||
generate_plugin_installation_section, | ||
generate_plugin_parameters_section, | ||
generate_plugin_summary, | ||
generate_plugin_version_info, | ||
) | ||
|
||
|
||
# https://mkdocs-macros-plugin.readthedocs.io/en/latest/macros/ | ||
def define_env(env): | ||
@env.macro | ||
def plugin_parameters(plugin: str): | ||
return generate_plugin_parameters_section(Path(f"packages/plugin-{plugin}")) | ||
|
||
@env.macro | ||
def plugin_description(plugin: str): | ||
return generate_plugin_summary(Path(f"packages/plugin-{plugin}")) | ||
|
||
@env.macro | ||
def plugin_meta(plugin: str): | ||
plugin_dir = Path(f"packages/plugin-{plugin}") | ||
return f"{generate_plugin_version_info(plugin_dir)} {generate_plugin_author_info(plugin_dir)}\n" | ||
|
||
return generate_plugin_parameters_section( | ||
plugin_dir, hash_file(plugin_dir / "src/index.ts") | ||
) | ||
@env.macro | ||
def plugin_installation(plugin: str): | ||
return generate_plugin_installation_section(Path(f"packages/plugin-{plugin}")) |
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
Oops, something went wrong.