![]() |
#1 | ||
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 99
Karma: 15776
Join Date: Dec 2011
Device: PB912 Matt White
|
[Bug?] Field(s) in prefix/suffix
Could you confirm the malfunction I encountered using fields in prefix/suffix?
This template (just an example) works on books with and without series/series_index: Code:
{series:|{isbn}|}{title} Code:
{series_index:|{isbn}|}{title} {series_index:||{isbn}}{title} Quote:
I wonder, why the field series_index is considered at all for books where it's empty. The section "Advanced formatting" states: Quote:
|
||
![]() |
![]() |
![]() |
#2 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,923
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
I don't think inserting a field was ever envisioned in this manner.
I believe those positions expect 'literals' (characters). If you don't have a Series, you can't have a series index I believe you will need to us Program mode (And, Please don't ask me for help ![]() |
![]() |
![]() |
![]() |
#3 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 99
Karma: 15776
Join Date: Dec 2011
Device: PB912 Matt White
|
Quote:
But this one without fields in prefix and suffix works: Code:
{series_index:|test1|test2}{title} Last edited by Backi; 03-12-2012 at 08:08 PM. |
|
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,354
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
The use of template expressions within template expressions is highly unreliable. I consider it a bug that it works at all, and would take it out except that doing so would cause the people for whom it works to yell very loudly. You have hit one of the problems -- expecting { ... } to nest. There are cases where they do not, one of which is references to series_index in save_to_disk templates. In the failure case a { is paired with the nearest }, not with the matching nested }. In other words, the { in front of "series_index" is matched against the } following "isbn", not against the one following the '|' character. The other common failure case occurs when the value being inserted contains a template special character such as '|', '{', '}', or sometimes ','. You can express the equivalent of {series_index:|{isbn}|}{title} without nesting by using the following "template program mode" template. Code:
{series_index:'test($, strcat(field('isbn'), $), '')'}{title} Code:
program: s = field('series_index'); strcat(test(s, strcat(field('isbn'), s), ''), field('title')) |
|
![]() |
![]() |
![]() |
#5 | |||
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 99
Karma: 15776
Join Date: Dec 2011
Device: PB912 Matt White
|
Quote:
Quote:
Quote:
|
|||
![]() |
![]() |
![]() |
#6 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,354
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
You are right that the documentation can be improved, which is a never-ending task. In this case I copied the bold "Do not use subtemplates" warning from the single-function-mode section to the section discussing prefixes and suffixes. |
||
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Default value for read field (Yes/No-field) | opitzs | Library Management | 3 | 11-09-2011 07:17 AM |
Embedded font bug or CSS bug in ADE | JSWolf | ePub | 10 | 06-11-2011 02:34 PM |
How does one change the prefix? | AlexBell | Upload Help | 2 | 07-30-2010 07:31 AM |
Bug? "Insert metadata as page at start of book" doesnt encode Comments field properly | rollercoaster | Calibre | 2 | 04-24-2010 10:40 PM |