From ff9c0650fcb3db6e2624127f5fde4a83d46fb8e6 Mon Sep 17 00:00:00 2001 From: gwen Date: Fri, 9 Jan 2026 13:01:49 +0100 Subject: [PATCH] calculated ok --- docs/fill.rst | 20 +++++++++++--------- docs/tutorial/calculated.rst | 22 ++++++++++++++-------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/docs/fill.rst b/docs/fill.rst index c892ff5aa..f0e194bdb 100644 --- a/docs/fill.rst +++ b/docs/fill.rst @@ -1,6 +1,8 @@ Calculated default values ============================== +.. _calculated_variable: + Synopsis ----------- @@ -199,9 +201,9 @@ Inside a variable's `calculation` we can use relative path. "_" means that other For example, in variable2's `calculation`, we can use relative path: -- __.variable1 -- _.variable3 -- __.family2.subfamily1.variable4 +- `__.variable1` +- `_.variable3` +- `__.family2.subfamily1.variable4` But we cannot access to extra1 variables with relative path. @@ -222,8 +224,8 @@ Hire is a dynamic family "{{ suffix }}": For variable2's calculation, we can use: -- rougail.{{ suffix }}.variable3 -- _.variable3 +- `rougail.{{ suffix }}.variable3` +- `_.variable3` In this case, we get value for "variable3" with the same suffix as "variable2". @@ -231,13 +233,13 @@ For variable4's calculation, we have two possibility: - retrieves all values with all suffixes: - - rougail.{{ suffix }}.variable3 - - __.{{ suffix }}.variable3 + - `rougail.{{ suffix }}.variable3` + - `__.{{ suffix }}.variable3` - retrieves a value for a specified suffix: - - rougail.val1.variable3 - - __.val1.variable3 + - `rougail.val1.variable3` + - `__.val1.variable3` Examples ----------- diff --git a/docs/tutorial/calculated.rst b/docs/tutorial/calculated.rst index 588c58953..1d2bb1366 100644 --- a/docs/tutorial/calculated.rst +++ b/docs/tutorial/calculated.rst @@ -68,8 +68,8 @@ except that it is dedicated to the HTTPS protocol :ref:`and a boolean variable t This `https_proxy` family is identical to the `http_proxy` family except that it defines variables intended for the HTTPS protocol. -Calculated default values ------------------------------- +A default value calculated from another variable +-------------------------------------------------- .. type-along:: For those who follow the tutorial with the help of the git repository @@ -151,15 +151,19 @@ The target variable is `http_proxy.address`. .. note:: The `__.` notation means the parent path of the current subfamily path. -We then say that the `manual.https_proxy.address` and the the `manual.https_proxy.port` default values are *calculated*. +We then say that the `manual.https_proxy.address` and the `manual.https_proxy.port` default values are *calculated*. .. glossary:: calculated - We say that a variable's value or a default variable's value is calculated - when there is a pointer which refers to another variable's value - or if there is some :term:`jinja` code or a python function that calculates it. + We say that a variable's value or a default variable's value is calculated + when there is a pointer which refers to another variable's value. + + :ref:`Other types of calculations exists `, in which this type of behavior does not occur + (the "pointer" behavior, notably type copying). + +The other types of calculation we will be explained later in this tutorial. Notice that the default value is not changed when :term:`user data ` are settled. @@ -220,14 +224,16 @@ We have this result: ┗━━ 📓 port (HTTPS Port): 3128 -We see that the default value is not changed. +The `https_proxy` variable's value is indeed modified, but the default value is still a calculated value (so the default value is indeed the value of the variable `http_proxy.address`, i.e., `"http.proxy.net"`), while the value defined by the user is `https.proxy.net`. + +Here we see that the variable's default value is not changed, but rather its actual value. .. keypoints:: Key points progress **summary** We have learned how to set the default value of the `https_proxy.address` variable - with the default value of the `http_proxy.address` variable. We did the same + with the value of the `http_proxy.address` variable. We did the same `https_proxy.port` and the `https_proxy.port` variables. **notation**