mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix some escaping issues in the template sections of the manual
This commit is contained in:
parent
2c1bbd4296
commit
0c923d9a4f
@ -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.
|
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>`.
|
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:
|
:hidden:
|
||||||
|
|
||||||
generated/en/template_ref
|
generated/en/template_ref
|
||||||
|
|
||||||
|
@ -924,9 +924,9 @@ class BuiltinSublist(BuiltinFormatterFunction):
|
|||||||
'of zero is assumed to be the length of the list. Examples using '
|
'of zero is assumed to be the length of the list. Examples using '
|
||||||
'basic template mode and assuming that the tags column (which is '
|
'basic template mode and assuming that the tags column (which is '
|
||||||
'comma-separated) contains "A, B, C": '
|
'comma-separated) contains "A, B, C": '
|
||||||
'{tags:sublist(0,1,\\,)} returns "A". '
|
'{tags:sublist(0,1,\\\\,)} returns "A". '
|
||||||
'{tags:sublist(-1,0,\\,)} returns "C". '
|
'{tags:sublist(-1,0,\\\\,)} returns "C". '
|
||||||
'{tags:sublist(0,-1,\\,)} returns "A, B".'
|
'{tags:sublist(0,-1,\\\\,)} returns "A, B".'
|
||||||
)
|
)
|
||||||
|
|
||||||
def evaluate(self, formatter, kwargs, mi, locals, val, start_index, end_index, sep):
|
def evaluate(self, formatter, kwargs, mi, locals, val, start_index, end_index, sep):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user