mirror of https://github.com/zulip/zulip.git
apidocs: Automatically add javascript example tabs.
The javascript tab in .md templates can be generated along with the line that adds js example. Further, as a part of the effort of moving towards a single template, the markdown extension for javascrit examples is modified to return empty string if javascript example doesn't exist for that endpoint. This would make it possible to cover more endpoints with a single template. The js example tabs are now automatically generated during generation of javascript code, and so need to be removed. Also, the markdown function to render js examples can be added in all templates, since it is parses and returns an empty string if the examples don't exist, and allows us to move towards a common template. The pages have been verified to be correct by using diff between old and new pages' raw HTML.
This commit is contained in:
parent
448456e4c0
commit
274f73d117
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/realm/playgrounds:post|example}
|
||||
|
||||
{generate_code_example(javascript)|/realm/playgrounds:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/realm/playgrounds:post|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/realm/filters:post|example}
|
||||
|
||||
{generate_code_example(javascript)|/realm/filters:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/realm/filters:post|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/messages/{message_id}/reactions:post|example}
|
||||
|
||||
{generate_code_example(javascript)|/messages/{message_id}/reactions:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl, exclude=["emoji_code","reaction_type"])|/messages/{message_id}/reactions:post|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/streams/{stream_id}:delete|example}
|
||||
|
||||
{generate_code_example(javascript)|/streams/{stream_id}:delete|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/streams/{stream_id}:delete|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/messages/matches_narrow:get|example}
|
||||
|
||||
{generate_code_example(javascript)|/messages/matches_narrow:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/messages/matches_narrow:get|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/realm/profile_fields:post|example(admin_config=True)}
|
||||
|
||||
{generate_code_example(javascript)|/realm/profile_fields:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/realm/profile_fields:post|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/user_groups/create:post|example}
|
||||
|
||||
{generate_code_example(javascript)|/user_groups/create:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/user_groups/create:post|example}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/users:post|example(admin_config=True)}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/users:post|example(admin_config=True)}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/users/me:delete|example}
|
||||
|
||||
{generate_code_example(javascript)|/users/me:delete|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/users/me:delete|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/users/{user_id}:delete|example}
|
||||
|
||||
{generate_code_example(javascript)|/users/{user_id}:delete|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/users/{user_id}:delete|example}
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
{generate_code_example(python)|/messages/{message_id}:delete|example(admin_config=True)}
|
||||
|
||||
{generate_code_example(javascript)|/messages/{message_id}:delete|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/messages/{message_id}:delete|example}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/events:delete|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/events:delete|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/attachments:get|example}
|
||||
|
||||
{generate_code_example(javascript)|/attachments:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/attachments:get|example}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/realm/emoji:get|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/realm/emoji:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/realm/profile_fields:get|example}
|
||||
|
||||
{generate_code_example(javascript)|/realm/profile_fields:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/realm/profile_fields:get|example}
|
||||
|
|
|
@ -28,10 +28,6 @@ print(client.get_events(
|
|||
`call_on_each_message` and `call_on_each_event` will automatically register
|
||||
a queue for you.
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/events:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/realm/linkifiers:get|example}
|
||||
|
||||
{generate_code_example(javascript)|/realm/linkifiers:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/realm/linkifiers:get|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/messages/{message_id}/history:get|example}
|
||||
|
||||
{generate_code_example(javascript)|/messages/{message_id}/history:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/messages/{message_id}/history:get|example}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/messages:get|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/messages:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/users/me:get|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/users/me:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/messages/{message_id}:get|example}
|
||||
|
||||
{generate_code_example(javascript)|/messages/{message_id}:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/messages/{message_id}:get|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/server_settings:get|example}
|
||||
|
||||
{generate_code_example(javascript)|/server_settings:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/server_settings:get|example}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/get_stream_id:get|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/get_stream_id:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/users/me/{stream_id}/topics:get|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/users/me/{stream_id}/topics:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/streams:get|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/streams:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/users/{user_id}/subscriptions/{stream_id}:get|example}
|
||||
|
||||
{generate_code_example(javascript)|/users/{user_id}/subscriptions/{stream_id}:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/users/{user_id}/subscriptions/{stream_id}:get|example}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/users/me/subscriptions:get|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/users/me/subscriptions:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/users/{email}:get|example}
|
||||
|
||||
{generate_code_example(javascript)|/users/{email}:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl, include=[""])|/users/{email}:get|example}
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
{generate_code_example(python)|/user_groups:get|example}
|
||||
|
||||
{generate_code_example(javascript)|/user_groups:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/user_groups:get|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/users/{user_id_or_email}/presence:get|example}
|
||||
|
||||
{generate_code_example(javascript)|/users/{user_id_or_email}/presence:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/users/{user_id_or_email}/presence:get|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/users/{user_id}:get|example}
|
||||
|
||||
{generate_code_example(javascript)|/users/{user_id}:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl, include=[""])|/users/{user_id}:get|example}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/users:get|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/users:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/mark_all_as_read:post|example}
|
||||
|
||||
{generate_code_example(javascript)|/mark_all_as_read:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/mark_all_as_read:post|example}
|
||||
|
@ -40,6 +42,8 @@
|
|||
|
||||
{generate_code_example(python)|/mark_stream_as_read:post|example}
|
||||
|
||||
{generate_code_example(javascript)|/mark_all_as_read:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/mark_stream_as_read:post|example}
|
||||
|
@ -72,6 +76,8 @@
|
|||
|
||||
{generate_code_example(python)|/mark_topic_as_read:post|example}
|
||||
|
||||
{generate_code_example(javascript)|/mark_all_as_read:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/mark_topic_as_read:post|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/users/me/subscriptions/muted_topics:patch|example}
|
||||
|
||||
{generate_code_example(javascript)|/users/me/subscriptions/muted_topics:patch|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl, exclude=["stream_id"])|/users/me/subscriptions/muted_topics:patch|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/users/me/muted_users/{muted_user_id}:post|example}
|
||||
|
||||
{generate_code_example(javascript)|/users/me/muted_users/{muted_user_id}:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/users/me/muted_users/{muted_user_id}:post|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/users/{user_id}/reactivate:post|example}
|
||||
|
||||
{generate_code_example(javascript)|/users/{user_id}/reactivate:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/users/{user_id}/reactivate:post|example}
|
||||
|
|
|
@ -52,10 +52,6 @@ potentially messy races, etc.
|
|||
|
||||
{generate_code_example(python)|/register:post|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/register:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/realm/playgrounds/{playground_id}:delete|example}
|
||||
|
||||
{generate_code_example(javascript)|/realm/playgrounds/{playground_id}:delete|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/realm/playgrounds/{playground_id}:delete|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/realm/filters/{filter_id}:delete|example}
|
||||
|
||||
{generate_code_example(javascript)|/realm/filters/{filter_id}:delete|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/realm/filters/{filter_id}:delete|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/messages/{message_id}/reactions:delete|example}
|
||||
|
||||
{generate_code_example(javascript)|/messages/{message_id}/reactions:delete|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl, exclude=["emoji_code", "reaction_type"])|/messages/{message_id}/reactions:delete|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/user_groups/{user_group_id}:delete|example}
|
||||
|
||||
{generate_code_example(javascript)|/user_groups/{user_group_id}:delete|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/user_groups/{user_group_id}:delete|example}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/messages/render:post|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/messages/render:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/realm/profile_fields:patch|example(admin_config=True)}
|
||||
|
||||
{generate_code_example(javascript)|/realm/profile_fields:patch|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/realm/profile_fields:patch|example}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/messages:post|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/messages:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/typing:post|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/typing:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/users/me/subscriptions:post|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/users/me/subscriptions:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/users/me/muted_users/{muted_user_id}:delete|example}
|
||||
|
||||
{generate_code_example(javascript)|/users/me/muted_users/{muted_user_id}:delete|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/users/me/muted_users/{muted_user_id}:delete|example}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/users/me/subscriptions:delete|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/users/me/subscriptions:delete|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/settings/display:patch|example}
|
||||
|
||||
{generate_code_example(javascript)|/settings/display:patch|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl, include=["left_side_userlist", "emojiset"])|/settings/display:patch|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/realm/filters/{filter_id}:patch|example}
|
||||
|
||||
{generate_code_example(javascript)|/realm/filters/{filter_id}:patch|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/realm/filters/{filter_id}:patch|example}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/messages/flags:post|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/messages/flags:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
{generate_code_example(python)|/messages/{message_id}:patch|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
{generate_code_example(javascript)|/messages/{message_id}:patch|example}
|
||||
|
||||
{tab|curl}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/settings/notifications:patch|example}
|
||||
|
||||
{generate_code_example(javascript)|/settings/notifications:patch|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl, include=["enable_offline_push_notifications", "enable_online_push_notifications"])|/settings/notifications:patch|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/streams/{stream_id}:patch|example}
|
||||
|
||||
{generate_code_example(javascript)|/streams/{stream_id}:patch|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl, include=["new_name", "description", "is_private"])|/streams/{stream_id}:patch|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/users/me/subscriptions/properties:post|example}
|
||||
|
||||
{generate_code_example(javascript)|/users/me/subscriptions/properties:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/users/me/subscriptions/properties:post|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/user_groups/{user_group_id}/members:post|example}
|
||||
|
||||
{generate_code_example(javascript)|/user_groups/{user_group_id}/members:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl, exclude=["delete"])|/user_groups/{user_group_id}/members:post|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/user_groups/{user_group_id}:patch|example}
|
||||
|
||||
{generate_code_example(javascript)|/user_groups/{user_group_id}:patch|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/user_groups/{user_group_id}:patch|example}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
{generate_code_example(python)|/users/{user_id}:patch|example}
|
||||
|
||||
{generate_code_example(javascript)|/users/{user_id}:patch|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/users/{user_id}:patch|example}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
{generate_code_example(python)|/realm/emoji/{emoji_name}:post|example}
|
||||
|
||||
{generate_code_example(javascript)|/realm/emoji/{emoji_name}:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/realm/emoji/{emoji_name}:post|example}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
{generate_code_example(python)|/user_uploads:post|example}
|
||||
|
||||
{generate_code_example(javascript)|/user_uploads:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/user_uploads:post|example}
|
||||
|
|
|
@ -154,7 +154,8 @@ def render_javascript_code_example(
|
|||
pattern = fr'^add_example\(\s*"[^"]*",\s*{re.escape(json.dumps(function))},\s*\d+,\s*async \(client, console\) => \{{\n(.*?)^(?:\}}| *\}},\n)\);$'
|
||||
with open("zerver/openapi/javascript_examples.js") as f:
|
||||
m = re.search(pattern, f.read(), re.M | re.S)
|
||||
assert m is not None
|
||||
if m is None:
|
||||
return []
|
||||
function_source_lines = dedent(m.group(1)).splitlines()
|
||||
|
||||
snippets = extract_code_example(function_source_lines, [], JS_EXAMPLE_REGEX)
|
||||
|
@ -164,7 +165,11 @@ def render_javascript_code_example(
|
|||
else:
|
||||
config = JS_CLIENT_CONFIG.splitlines()
|
||||
|
||||
code_example = []
|
||||
code_example = [
|
||||
"{tab|js}\n",
|
||||
"More examples and documentation can be found [here](https://github.com/zulip/zulip-js).",
|
||||
]
|
||||
|
||||
code_example.append("```js")
|
||||
code_example.extend(config)
|
||||
code_example.append("(async () => {")
|
||||
|
|
|
@ -128,7 +128,6 @@ def render_markdown_path(
|
|||
md_macro_extension = zerver.lib.markdown.include.makeExtension(
|
||||
base_path="templates/zerver/help/include/"
|
||||
)
|
||||
extensions = md_extensions
|
||||
if "api_url" in context:
|
||||
# We need to generate the API code examples extension each
|
||||
# time so the `api_url` config parameter can be set dynamically.
|
||||
|
@ -136,11 +135,14 @@ def render_markdown_path(
|
|||
# TODO: Convert this to something more efficient involving
|
||||
# passing the API URL as a direct parameter.
|
||||
extensions = [
|
||||
*extensions,
|
||||
zerver.openapi.markdown_extension.makeExtension(
|
||||
api_url=context["api_url"],
|
||||
),
|
||||
*md_extensions,
|
||||
]
|
||||
else:
|
||||
extensions = md_extensions
|
||||
|
||||
if not any(doc in markdown_file_path for doc in docs_without_macros):
|
||||
extensions = [md_macro_extension, *extensions]
|
||||
|
||||
|
|
Loading…
Reference in New Issue