Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
integrations-docs: Move markdown macros include files.
Lauryn Menard5f9dc76d54ac
diff --git a/docs/documentation/integrations.md b/docs/documentation/integrations.mdindex c544adf5aef..35376ec426b 100644--- a/docs/documentation/integrations.md+++ b/docs/documentation/integrations.md@@ -64,7 +64,7 @@ phrases and steps at the location of the macros. Macros help eliminaterepeated content in our documentation.The source for macros is the Markdown files under-`templates/zerver/help/include` in the+`templates/zerver/integrations/include/` in the[main Zulip server repository](https://github.com/zulip/zulip). If you findmultiple instances of particular content in the documentation, you canalways create a new macro by adding a new file to that folder.diff --git a/templates/zerver/help/include/append-stream-name.md b/templates/zerver/integrations/include/append-stream-name.mdsimilarity index 100%rename from templates/zerver/help/include/append-stream-name.mdrename to templates/zerver/integrations/include/append-stream-name.mddiff --git a/templates/zerver/help/include/append-topic.md b/templates/zerver/integrations/include/append-topic.mdsimilarity index 100%rename from templates/zerver/help/include/append-topic.mdrename to templates/zerver/integrations/include/append-topic.mddiff --git a/templates/zerver/help/include/change-zulip-config-file.md b/templates/zerver/integrations/include/change-zulip-config-file.mdsimilarity index 100%rename from templates/zerver/help/include/change-zulip-config-file.mdrename to templates/zerver/integrations/include/change-zulip-config-file.mddiff --git a/templates/zerver/help/include/configure-matrix-bridge.md b/templates/zerver/integrations/include/configure-matrix-bridge.mdsimilarity index 100%rename from templates/zerver/help/include/configure-matrix-bridge.mdrename to templates/zerver/integrations/include/configure-matrix-bridge.mddiff --git a/templates/zerver/help/include/congrats.md b/templates/zerver/integrations/include/congrats.mdsimilarity index 100%rename from templates/zerver/help/include/congrats.mdrename to templates/zerver/integrations/include/congrats.mddiff --git a/templates/zerver/help/include/create-a-generic-bot.md b/templates/zerver/integrations/include/create-a-generic-bot.mdsimilarity index 100%rename from templates/zerver/help/include/create-a-generic-bot.mdrename to templates/zerver/integrations/include/create-a-generic-bot.mddiff --git a/templates/zerver/help/include/create-an-incoming-webhook.md b/templates/zerver/integrations/include/create-an-incoming-webhook.mdsimilarity index 100%rename from templates/zerver/help/include/create-an-incoming-webhook.mdrename to templates/zerver/integrations/include/create-an-incoming-webhook.mddiff --git a/templates/zerver/help/include/create-bot-construct-url.md b/templates/zerver/integrations/include/create-bot-construct-url.mdsimilarity index 100%rename from templates/zerver/help/include/create-bot-construct-url.mdrename to templates/zerver/integrations/include/create-bot-construct-url.mddiff --git a/templates/zerver/help/include/create-stream.md b/templates/zerver/integrations/include/create-stream.mdsimilarity index 100%rename from templates/zerver/help/include/create-stream.mdrename to templates/zerver/integrations/include/create-stream.mddiff --git a/templates/zerver/help/include/download-python-bindings.md b/templates/zerver/integrations/include/download-python-bindings.mdsimilarity index 100%rename from templates/zerver/help/include/download-python-bindings.mdrename to templates/zerver/integrations/include/download-python-bindings.mddiff --git a/templates/zerver/help/include/event-filtering-instruction.md b/templates/zerver/integrations/include/event-filtering-instruction.mdsimilarity index 100%rename from templates/zerver/help/include/event-filtering-instruction.mdrename to templates/zerver/integrations/include/event-filtering-instruction.mddiff --git a/templates/zerver/help/include/git-append-branches.md b/templates/zerver/integrations/include/git-append-branches.mdsimilarity index 100%rename from templates/zerver/help/include/git-append-branches.mdrename to templates/zerver/integrations/include/git-append-branches.mddiff --git a/templates/zerver/help/include/git-webhook-url-with-branches.md b/templates/zerver/integrations/include/git-webhook-url-with-branches.mdsimilarity index 100%rename from templates/zerver/help/include/git-webhook-url-with-branches.mdrename to templates/zerver/integrations/include/git-webhook-url-with-branches.mddiff --git a/templates/zerver/help/include/install-matrix.md b/templates/zerver/integrations/include/install-matrix.mdsimilarity index 100%rename from templates/zerver/help/include/install-matrix.mdrename to templates/zerver/integrations/include/install-matrix.mddiff --git a/templates/zerver/help/include/webhook-url-with-bot-email.md b/templates/zerver/integrations/include/webhook-url-with-bot-email.mdsimilarity index 100%rename from templates/zerver/help/include/webhook-url-with-bot-email.mdrename to templates/zerver/integrations/include/webhook-url-with-bot-email.mddiff --git a/templates/zerver/help/include/webhook-url.md b/templates/zerver/integrations/include/webhook-url.mdsimilarity index 100%rename from templates/zerver/help/include/webhook-url.mdrename to templates/zerver/integrations/include/webhook-url.mddiff --git a/zerver/lib/templates.py b/zerver/lib/templates.pyindex edd4560d859..354f8079e3a 100644--- a/zerver/lib/templates.py+++ b/zerver/lib/templates.py@@ -83,7 +83,10 @@ docs_without_macros = [@items_tuple_to_dict@register.filter(name="render_markdown_path", is_safe=True)def render_markdown_path(- markdown_file_path: str, context: Optional[Dict[str, Any]] = None, pure_markdown: bool = False+ markdown_file_path: str,+ context: Optional[Dict[str, Any]] = None,+ pure_markdown: bool = False,+ integration_doc: bool = False,) -> str:"""Given a path to a Markdown file, return the rendered HTML.@@ -127,10 +130,6 @@ def render_markdown_path(zerver.lib.markdown.help_relative_links.makeExtension(),zerver.lib.markdown.help_emoticon_translations_table.makeExtension(),]- if md_macro_extension is None:- md_macro_extension = zerver.lib.markdown.include.makeExtension(- base_path="templates/zerver/help/include/"- )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.@@ -146,6 +145,14 @@ def render_markdown_path(else:extensions = md_extensions+ if integration_doc:+ md_macro_extension = zerver.lib.markdown.include.makeExtension(+ base_path="templates/zerver/integrations/include/"+ )+ else:+ md_macro_extension = zerver.lib.markdown.include.makeExtension(+ base_path="templates/zerver/help/include/"+ )if not any(doc in markdown_file_path for doc in docs_without_macros):extensions = [md_macro_extension, *extensions]diff --git a/zerver/views/documentation.py b/zerver/views/documentation.pyindex 4056f4e6233..7e2f06244fb 100644--- a/zerver/views/documentation.py+++ b/zerver/views/documentation.py@@ -325,6 +325,6 @@ def integration_doc(request: HttpRequest, integration_name: str = REQ()) -> Httpif isinstance(integration, HubotIntegration):context["hubot_docs_url"] = integration.hubot_docs_url- doc_html_str = render_markdown_path(integration.doc, context)+ doc_html_str = render_markdown_path(integration.doc, context, integration_doc=True)return HttpResponse(doc_html_str)