comparison doc/introduction.rst @ 202:2e66178a09d8

Docu: Ban "keyword expansion" -- use "variable interpolation" instead "Variable interpolation" or "variable expansion" or "variable substitution" are the proper wordings.
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 05 May 2019 12:07:27 +0200
parents c6904d02beae
children fa660f084ceb
comparison
equal deleted inserted replaced
201:24f4ab79a3ab 202:2e66178a09d8
199 .. _getting-values: 199 .. _getting-values:
200 200
201 Getting configuration variables 201 Getting configuration variables
202 ------------------------------- 202 -------------------------------
203 203
204 Get a -- possibly expanded -- configuration variable's value with:: 204 Get a -- possibly interpolated -- configuration variable's value with::
205 205
206 value1 = config.getvar_s("key1") 206 value1 = config.getvar_s("key1")
207 207
208 Get a raw configuration variable's value with:: 208 Get a raw configuration variable's value with::
209 209
218 ``get this as `tree1.tree2.key4'``. 218 ``get this as `tree1.tree2.key4'``.
219 219
220 This is true for both methods :py:meth:`.Configuration.getvar` and 220 This is true for both methods :py:meth:`.Configuration.getvar` and
221 :py:meth:`.Configuration.getvar_s`. 221 :py:meth:`.Configuration.getvar_s`.
222 222
223 Both methods also perform :ref:`variable-expansion` and handle 223 Both methods also perform :ref:`variable-interpolation` and handle
224 :ref:`variable-namespaces`. Filtering is not supported. So -- the 224 :ref:`variable-namespaces`. Filtering is not supported. So -- the
225 variable name arguments of :py:meth:`.Configuration.getvar` and 225 variable name arguments of :py:meth:`.Configuration.getvar` and
226 :py:meth:`.Configuration.getvar_s` are of the form 226 :py:meth:`.Configuration.getvar_s` are of the form
227 ``[namespace:]variable``. 227 ``[namespace:]variable``.
228 228
289 config.getvar("OS:cwd") 289 config.getvar("OS:cwd")
290 290
291 yields the current working directory as :py:func:`os.getcwd` does. 291 yields the current working directory as :py:func:`os.getcwd` does.
292 292
293 293
294 .. _variable-expansion: 294 .. _variable-interpolation:
295 295
296 Variable Expansion 296 Variable Interpolation
297 ------------------ 297 ----------------------
298 298
299 Configuration variable values that are read with 299 Configuration variable values that are read with
300 :py:meth:`.Configuration.getvar_s` are subject to variable 300 :py:meth:`.Configuration.getvar_s` are subject to variable
301 expansion. The general syntactic pattern for this is:: 301 interpolation. The general syntactic pattern for this is::
302 302
303 {{[namespace:]variable[|filter[|filter...]]}} 303 {{[namespace:]variable[|filter[|filter...]]}}
304 304
305 I.e.: between double curly braces an optional `namespace` name followed by 305 I.e.: between double curly braces an optional `namespace` name followed by
306 a colon ``:``, the `variable` and then zero or more filters, each one 306 a colon ``:``, the `variable` and then zero or more filters, each one
307 introduced by a pipe symbol ``|``. 307 introduced by a pipe symbol ``|``.
308 308
309 Variables are expanded lately at runtime -- exactly when calling 309 Variables are expanded *lately* at runtime -- exactly when calling
310 :py:meth:`.Configuration.getvar_s`, 310 :py:meth:`.Configuration.getvar_s`,
311 :py:meth:`.Configuration.substitute_variables_in_obj` or 311 :py:meth:`.Configuration.substitute_variables_in_obj` or
312 :py:meth:`.Configuration.expand_variable` 312 :py:meth:`.Configuration.expand_variable`
313 313
314 314