22 Commits

Author SHA1 Message Date
jeanluc
55d31e01c2
feat: Add _copier_operation variable (#1733)
* Makes `exclude` configuration templatable.
* Adds a `_copier_operation` variable to the rendering contexts for `exclude` and `tasks`, representing the current operation - either `copy`~~, `recopy`~~ or `update`.

This was proposed here: https://github.com/copier-org/copier/issues/1718#issuecomment-2282643624
2025-03-09 20:37:12 +00:00
Axel H.
1dabe8eb1e
feat(context): expose a _copier_phase context variable 2025-03-02 16:40:57 +01:00
Jairo Llopis
25bc06d01d feat(external_data): load data from other YAML files
When composing templates, it's often needed to be able to load answers from other templates that you know are usually combined with yours. Or any other kind of external data.

@moduon MT-8282
2025-02-16 08:00:21 +00:00
Kj
557c0d6144
feat: add dynamic file structures in loop using yield-tag (#1855)
Add jinja2 extension for yield tag, allow _render_path to generate multiple paths and contexts when yield tag is used.

The tag is only allowed in path render contexts. When rendering within a file, it doesn't make sense. Use the normal for tag there. If you use yield, you'll get an exception.

Fixes https://github.com/copier-org/copier/issues/1271
2025-01-18 08:24:32 +00:00
jeanluc
2e7629e3d6
docs: restructure context vars, add undocumented ones (#1856) 2024-11-12 21:54:40 +01:00
Sigurd Spieckermann
a75066e34c docs: use autorefs for section references 2023-08-05 20:33:57 +02:00
Sigurd Spieckermann
1031601332 docs: use relative path to Markdown file for page linking 2023-07-19 13:48:49 +02:00
Mitch Negus
c79482580e
docs: fix filesystem view to match text (and homepage) (#1136) 2023-05-14 07:19:03 +00:00
Sigurd Spieckermann
474be856c1
docs: use tree fence for filesystem trees (#998)
* docs: use tree fence for filesystem trees

* docs: remove dashed lines in filesystem tree
2023-02-25 07:23:14 +00:00
Raphael Krupinski
20a13b98f4
feat: add native OS directory separator variable in _copier_conf.sep to allow generating dynamic directory structures
* feat(Worker): make sure the parent directory of the target file exists before writing to it
* feat(_copier_conf): add directory separator (os.sep) to _copier_conf

Fix #692
2023-01-27 12:11:11 +00:00
Xuan Hu
a1c882e0ba docs: No redundant empty lines for _copier_answers.
Signed-off-by: Xuan Hu <i@huxuan.org>
2022-12-20 11:28:10 +00:00
Sigurd Spieckermann
e682269cd5 docs: unify shell code blocks 2022-09-09 16:05:20 +01:00
Sigurd Spieckermann
5a6d930a45 docs: update Jinja2 docs URL to v3.1.x 2022-08-28 09:18:17 +01:00
Sigurd Spieckermann
fc6bb03a6d docs: fix spelling 2022-08-26 09:47:49 +01:00
Jairo Llopis
04c99e85a9 feat: support getting template commit hash with {{ _copier_conf.vcs_ref_hash }}
When targeting reproducible builds, we need to have exact and immutable hashes.

Until now, there was only one way to get template commit. You could only get the tag, or the best serializable approach to obtain a commit from a tag.

Using this new helper, you can get what you need.
2022-06-13 10:44:04 +01:00
Timothée Mazzucotelli
3d41685a39 docs: Add minimal example to "creating" page 2022-01-13 21:35:11 +01:00
Timothée Mazzucotelli
77e3e53c4b refactor: Remove json method from Copier conf 2021-12-20 14:50:20 +00:00
Jairo Llopis
2a944bf736 docs: update with latest changes
🤦‍♂️ it seems I forgot to document a lot of changes.
2021-04-20 07:21:36 +01:00
Jairo Llopis
cdb563a96d Add 4-space indentation to .md files
Mkdocs uses `python-markdown`, and [they say](https://python-markdown.github.io/#differences):

> The syntax rules clearly state that when a list item consists of multiple paragraphs, “each subsequent paragraph in a list item must be indented by either 4 spaces or one tab” (emphasis added). However, many implementations do not enforce this rule and allow less than 4 spaces of indentation. The implementers of Python-Markdown consider it a bug to not enforce this rule.

As we were using 2 spaces for markdown files (which looks better in source code), some indented lists were not displaying properly in the docs page.

Thus I change the setting to 4 spaces. Prettier will now enforce them, and mkdocs will display things properly.
2020-08-10 12:59:07 +00:00
Jairo Llopis
a456f59b7a A little polish on docs
- Prepare for a new release.
- Add configuring page, with more explicit docs and examples for each option.
- Remove configuration stuff from creation page.
- Comparisons are ugly, so remove them from the index page.
2020-08-10 11:27:52 +00:00
Alexandre Chaussier
173db40a1d Docs: Add a warning about "!include" usage with YAML files 2020-08-03 13:09:58 +01:00
Timothée Mazzucotelli
3ad2c67a20 Autodoc 2020-07-31 15:02:58 +02:00