Skip to content

Instantly share code, notes, and snippets.

@oprypin
Last active January 8, 2021 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oprypin/647c95a06bf83e7d867d02ad8cf7935c to your computer and use it in GitHub Desktop.
Save oprypin/647c95a06bf83e7d867d02ad8cf7935c to your computer and use it in GitHub Desktop.
diff --git a/docs/usage/features/handlers.md b/docs/usage/features/handlers.md
index 91d3d27e9..7b98f142e 100644
--- a/docs/usage/features/handlers.md
+++ b/docs/usage/features/handlers.md
@@ -4,13 +4,9 @@ Tourmaline is built around the concept of `Handlers`, each of which is modeled t
There are currently 7 types of handlers built in:
-- [CommandHandler][Tourmaline::Handlers::CommandHandler]
-- [UpdateHandler][Tourmaline::Handlers::UpdateHandler]
-- [HearsHandler][Tourmaline::Handlers::HearsHandler]
-- [EditedHandler][Tourmaline::Handlers::EditedHandler]
-- [InlineQueryHandler][Tourmaline::Handlers::InlineQueryHandler]
-- [CallbackQueryHandler][Tourmaline::Handlers::CallbackQueryHandler]
-- [ChosenInlineResultHandler][Tourmaline::Handlers::ChosenInlineResultHandler]
+{% for typ in crystal.lookup('Tourmaline::Handlers').types %}
+ - [{{typ.name}}][{{typ.abs_id}}]
+{% endfor %}
For the purposes of this document we'll be focusing on the CommandHandler, since it's the one you're most likely to use most often, but you can find specific documentation for each handler type on their API reference page.
diff --git a/mkdocs.yml b/mkdocs.yml
index 669851a40..2ed125d9c 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -23,6 +23,9 @@ plugins:
- gen-files:
scripts:
- docs/gen_doc_stubs.py
+ - macros:
+ modules:
+ - mkdocstrings.handlers.crystal.macros
- literate-nav:
nav_file: SUMMARY.md
- section-index
{% set root = config.plugins.mkdocstrings.get_handler('crystal').collector.root %}
{% for typ in root.lookup('Tourmaline::Handlers').types %}
- [{{typ.name}}][{{typ.abs_id}}]
{% endfor %}
items = [
f'- [{typ.name}][{typ.abs_id}]'
for typ in root.lookup('Tourmaline::Handlers').types
]
with mkdocs_gen_files.open('usage/features/handlers.md', 'r') as f:
s = f.read()
s = s.replace('{{placeholder}}', '\n'.join(items))
with mkdocs_gen_files.open('usage/features/handlers.md', 'w') as f:
f.write(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment