From 4c370de53300846674e5a80a9087ef414a6b4195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Sun, 24 Apr 2022 11:08:38 +0200 Subject: [PATCH] fixup! docs: Document the context hook extension --- docs/configuring.md | 3 ++- docs/faq.md | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/configuring.md b/docs/configuring.md index 76273c0fc..8f7610592 100644 --- a/docs/configuring.md +++ b/docs/configuring.md @@ -701,7 +701,8 @@ on them, so they are always installed when Copier is installed. - [`copier_templates_extensions.TemplateExtensionLoader`](https://github.com/copier-org/copier-templates-extensions): enhances the extension loading mecanism to allow templates writers to put their - extensions directly in their templates. It also allows to modify the context before + extensions directly in their templates. It also allows to modify the rendering context + (the Jinja variables that you can use in your templates) before rendering templates, see [using a context hook](../faq#how-can-i-alter-the-context-before-rendering-the-project). - [`jinja_markdown.MarkdownExtension`](https://github.com/jpsca/jinja-markdown): provides a `markdown` tag that will render Markdown to HTML using diff --git a/docs/faq.md b/docs/faq.md index e8883f6ab..db9b54bba 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -31,17 +31,17 @@ _jinja_extensions: ``` Following this example, you are supposed to provide a `context.py` file in the -`extensions` folder at the root of your template to modify the context. If for -example your `copier.yaml` contains a multiple-choice variable like this: +`extensions` folder at the root of your template to modify the context. If for example +your `copier.yaml` contains a multiple-choice variable like this: ```yaml title="copier.yaml" flavor: - type: str - choices: - - Docker - - Instances - - Kubernetes - - None + type: str + choices: + - Docker + - Instances + - Kubernetes + - None ``` The `context.py` file contains your context hook which could look like: