Fix some escaping issues in the template sections of the manual

This commit is contained in:
Kovid Goyal 2018-09-16 18:10:15 +05:30
parent 2c1bbd4296
commit 0c923d9a4f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 6 deletions

View File

@ -107,7 +107,7 @@ Function references appear in the format part, going after the ``:`` and before
Functions are always applied before format specifications. See further down for an example of using both a format and a function, where this order is demonstrated.
The syntax for using functions is ``{field:function(arguments)}``, or ``{field:function(arguments)|prefix|suffix}``. Arguments are separated by commas. Commas inside arguments must be preceeded by a backslash ( '\\' ). The last (or only) argument cannot contain a closing parenthesis ( ')' ). Functions return the value of the field used in the template, suitably modified.
The syntax for using functions is ``{field:function(arguments)}``, or ``{field:function(arguments)|prefix|suffix}``. Arguments are separated by commas. Commas inside arguments must be preceded by a backslash ( ``\`` ). The last (or only) argument cannot contain a closing parenthesis ( ``)`` ). Functions return the value of the field used in the template, suitably modified.
Important: If you have programming experience, please note that the syntax in this mode (single function) is not what you might expect. Strings are not quoted. Spaces are significant. All arguments must be constants; there is no sub-evaluation. **Do not use subtemplates (`{ ... }`) as function arguments.** Instead, use :ref:`template program mode <template_mode>` and :ref:`general program mode <general_mode>`.
@ -495,4 +495,3 @@ You might find the following tips useful.
:hidden:
generated/en/template_ref

View File

@ -924,9 +924,9 @@ class BuiltinSublist(BuiltinFormatterFunction):
'of zero is assumed to be the length of the list. Examples using '
'basic template mode and assuming that the tags column (which is '
'comma-separated) contains "A, B, C": '
'{tags:sublist(0,1,\\,)} returns "A". '
'{tags:sublist(-1,0,\\,)} returns "C". '
'{tags:sublist(0,-1,\\,)} returns "A, B".'
'{tags:sublist(0,1,\\\\,)} returns "A". '
'{tags:sublist(-1,0,\\\\,)} returns "C". '
'{tags:sublist(0,-1,\\\\,)} returns "A, B".'
)
def evaluate(self, formatter, kwargs, mi, locals, val, start_index, end_index, sep):