From 1e123e35cf80788c7d3ba94e2bc3583b48048242 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 24 Dec 2020 09:58:26 +0530 Subject: [PATCH] manual formatting --- manual/template_lang.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/manual/template_lang.rst b/manual/template_lang.rst index 6ebb766437..c9956cf177 100644 --- a/manual/template_lang.rst +++ b/manual/template_lang.rst @@ -401,19 +401,19 @@ An ``if`` produces a value like any other language expression. This means that a * ``program: a = if field('series') then 'foo' else 'bar' fi; a`` * ``program: a = field(if field('series') then 'series' else 'title' fi); a`` -The template language supports **``for`` expressions** with the following syntax: +The template language supports **``for`` expressions** with the following syntax:: for <> in <>: <> rof - + The expression must evaluate to either a metadata field lookup key, for example ``tags`` or ``#genre``, or a comma-separated list of values. If the result is a valid lookup name then the field's value is fetched, otherwise the list is broken into its individual values. Each resulting value in the list is assigned to the variable ``id`` then the ``expression_list`` is evaluated. Example: This template removes the first hierarchical name for each value in Genre (``#genre``), constructing a list with -the new names. +the new names:: program: new_tags = ''; @@ -481,7 +481,7 @@ The full method signature is: column_name=None, template_cache=None, strip_results=True, template_functions=None, global_vars={}) - + **Template writer: how to access the additional information** @@ -509,7 +509,7 @@ Example: the following SFM template returns either the series name or the string The equivalent template in TPM is :: ``{series:'ifempty($, 'no series')'}`` - + The equivalent template in GPM is:: ``program: ifempty(field('series'), 'no series')``