From 5f5b2d9b78feb14ab219ea971a23e9ebdebf4a1c Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Mon, 12 Sep 2016 20:32:41 +0200 Subject: [PATCH 1/2] Fix example for using composite columns and lookup to switch paths in a save template by adding the # to the lookup name --- manual/template_lang.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manual/template_lang.rst b/manual/template_lang.rst index c55c42591e..8adeb29c94 100644 --- a/manual/template_lang.rst +++ b/manual/template_lang.rst @@ -457,9 +457,9 @@ The slash and the hyphen appear only if series is not empty. The lookup function lets us do even fancier processing. For example, assume that if a book has a series, then we want the folder structure `series/series index - title.fmt`. If the book does not have a series, then we want the folder structure `genre/author_sort/title.fmt`. If the book has no genre, we want to use 'Unknown'. We want two completely different paths, depending on the value of series. To accomplish this, we: - 1. Create a composite field (call it AA) containing ``{series}/{series_index} - {title'}``. If the series is not empty, then this template will produce `series/series_index - title`. - 2. Create a composite field (call it BB) containing ``{#genre:ifempty(Unknown)}/{author_sort}/{title}``. This template produces `genre/author_sort/title`, where an empty genre is replaced with `Unknown`. - 3. Set the save template to ``{series:lookup(.,AA,BB)}``. This template chooses composite field AA if series is not empty, and composite field BB if series is empty. We therefore have two completely different save paths, depending on whether or not `series` is empty. + 1. Create a composite field (give it lookup name #AA) containing ``{series}/{series_index} - {title'}``. If the series is not empty, then this template will produce `series/series_index - title`. + 2. Create a composite field (give it lookup name #BB) containing ``{#genre:ifempty(Unknown)}/{author_sort}/{title}``. This template produces `genre/author_sort/title`, where an empty genre is replaced with `Unknown`. + 3. Set the save template to ``{series:lookup(.,#AA,#BB)}``. This template chooses composite field #AA if series is not empty, and composite field #BB if series is empty. We therefore have two completely different save paths, depending on whether or not `series` is empty. Templates and Plugboards ------------------------ From 4ef1c42505b4db84da8f69983015cd340b0a5e1a Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Mon, 12 Sep 2016 20:38:04 +0200 Subject: [PATCH 2/2] Remove a stray single quote. --- manual/template_lang.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual/template_lang.rst b/manual/template_lang.rst index 8adeb29c94..137d2204a0 100644 --- a/manual/template_lang.rst +++ b/manual/template_lang.rst @@ -457,7 +457,7 @@ The slash and the hyphen appear only if series is not empty. The lookup function lets us do even fancier processing. For example, assume that if a book has a series, then we want the folder structure `series/series index - title.fmt`. If the book does not have a series, then we want the folder structure `genre/author_sort/title.fmt`. If the book has no genre, we want to use 'Unknown'. We want two completely different paths, depending on the value of series. To accomplish this, we: - 1. Create a composite field (give it lookup name #AA) containing ``{series}/{series_index} - {title'}``. If the series is not empty, then this template will produce `series/series_index - title`. + 1. Create a composite field (give it lookup name #AA) containing ``{series}/{series_index} - {title}``. If the series is not empty, then this template will produce `series/series_index - title`. 2. Create a composite field (give it lookup name #BB) containing ``{#genre:ifempty(Unknown)}/{author_sort}/{title}``. This template produces `genre/author_sort/title`, where an empty genre is replaced with `Unknown`. 3. Set the save template to ``{series:lookup(.,#AA,#BB)}``. This template chooses composite field #AA if series is not empty, and composite field #BB if series is empty. We therefore have two completely different save paths, depending on whether or not `series` is empty.