Mercurial > hgrepos > Python > libs > ConfigMix
comparison docs/introduction.rst @ 708:e692216f8756
Allow also "," characters to act as a separator within a filter-chain.
The first filter is introduced by a "|", optional other ones may be introduced
by a "|" or a ",".
| author | Franz Glasner <f.glasner@feldmann-mg.com> |
|---|---|
| date | Tue, 15 Aug 2023 11:14:51 +0200 |
| parents | 3a9d661d33b5 |
| children | a8bcb22341cd |
comparison
equal
deleted
inserted
replaced
| 707:10fbc23b4dba | 708:e692216f8756 |
|---|---|
| 458 are subject to variable interpolation. | 458 are subject to variable interpolation. |
| 459 The general syntactic pattern for this is:: | 459 The general syntactic pattern for this is:: |
| 460 | 460 |
| 461 {{[namespace:]variable[|filter[|filter...]]}} | 461 {{[namespace:]variable[|filter[|filter...]]}} |
| 462 | 462 |
| 463 or:: | |
| 464 | |
| 465 {{[namespace:]variable[|filter[,filter...]]}} | |
| 466 | |
| 463 I.e.: between double curly braces an optional `namespace` name followed by | 467 I.e.: between double curly braces an optional `namespace` name followed by |
| 464 a colon ``:``, the `variable` and then zero or more filters, each one | 468 a colon ``:``, the `variable` and then zero or more filters, the first one |
| 465 introduced by a pipe symbol ``|``. | 469 introduced by a pipe symbol ``|`` the following ones introduced by a |
| 470 comma ``,`` or a pipe symbol ``|``. The comma ``,`` should be preferred. | |
| 466 | 471 |
| 467 Variables are expanded *lately* at runtime -- exactly when calling | 472 Variables are expanded *lately* at runtime -- exactly when calling |
| 468 :py:meth:`.Configuration.getvar_s`, | 473 :py:meth:`.Configuration.getvar_s`, |
| 469 :py:meth:`.Configuration.getvarl_s`, | 474 :py:meth:`.Configuration.getvarl_s`, |
| 470 :py:meth:`.Configuration.substitute_variables_in_obj` or | 475 :py:meth:`.Configuration.substitute_variables_in_obj` or |
| 472 | 477 |
| 473 .. note:: Special characters within namespace, key and filter names | 478 .. note:: Special characters within namespace, key and filter names |
| 474 *must* be quoted (see :ref:`quoting`) when using variable | 479 *must* be quoted (see :ref:`quoting`) when using variable |
| 475 interpolation syntax. | 480 interpolation syntax. |
| 476 | 481 |
| 482 .. note:: Commata ``,`` and pipe symbols ``|`` are not allowed within | |
| 483 filter names. | |
| 484 | |
| 477 | 485 |
| 478 Filter functions | 486 Filter functions |
| 479 ~~~~~~~~~~~~~~~~ | 487 ~~~~~~~~~~~~~~~~ |
| 480 | 488 |
| 481 Interpolated values can be processed through a series of filter functions:: | 489 Interpolated values can be processed through a series of filter functions:: |
| 482 | 490 |
| 483 {{my.variable|filter1|filter2}} | 491 {{my.variable|filter1|filter2|filter3}} |
| 492 | |
| 493 or:: | |
| 494 | |
| 495 {{my.variable|filter1,filter2,filter3}} | |
| 484 | 496 |
| 485 Available filter functions are: | 497 Available filter functions are: |
| 486 | 498 |
| 487 ``urlquote`` | 499 ``urlquote`` |
| 488 | 500 |
