![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
|
Template: various questions not worth their own thread
I'll try to use this thread for smaller questions to avoid spamming up this section even more.
![]() Is there any semantic difference between Code:
"foobar" in #column Code:
#column in "foobar" |
![]() |
![]() |
![]() |
#2 | |
Grumpy old git
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,380
Karma: 3933793
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
#column == 'foobar is a strange word' If in your situation the two always both succeed then you probably should be using '==' instead of 'in'. EDIT: Or one of the list operators. Last edited by chaley; 03-31-2021 at 02:43 PM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
|
In my case, I was doing this:
Code:
&& publisher == '(Archive of Our Own|FanFiction.net)' Code:
&& publisher in '(Archive of Our Own|FanFiction.net)' Code:
&& '(Archive of Our Own|FanFiction.net)' in publisher |
![]() |
![]() |
![]() |
#4 | |
Grumpy old git
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,380
Karma: 3933793
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
It seems like you are checking if some string matches some item in a list. In that case you probably should use list_contains() instead of 'in'. Something like: Code:
list_contains($publisher, ',', '^(Archive of Our Own|FanFiction.net)$', 1, '') |
|
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
|
I had assigned publisher = $publisher;
Also, what is the name used for these things used to avoid typing the same thing over and over again? e.g. Code:
status = $#fanficstatus; publisher = $publisher; ids = $identifiers; u = select(ids, 'url'); a = select(ids, 'ao3'); f = select(ids, 'ffnet'); |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Grumpy old git
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,380
Karma: 3933793
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
![]() Quote:
|
|
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
|
"local variables" would probably work well for this.
|
![]() |
![]() |
![]() |
#8 |
null operator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,994
Karma: 20473833
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Grace Hopper would have called it: WORKING STORAGE
![]() BR |
![]() |
![]() |
![]() |
#9 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
|
Question:
Quote:
|
|
![]() |
![]() |
![]() |
#10 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,747
Karma: 67437891
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
|
![]() |
![]() |
![]() |
#11 | |
Grumpy old git
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,380
Karma: 3933793
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
![]() That notation describes the "form" of valid calls of the function. It uses 'placeholders' to distinguish between different values. The notation "[, something]" says that the ", something" is optional: zero or one occurrence of what is between the brackets. The notation "[, something]*" says that it is optional but you can have zero to "a lot" of occurrences. Often "somethings" with the same name are the same thing, while "somethings" with different names are not necessarily the same thing. The notation is an approximation of a formal grammar. I tend to use approximations of EBNF grammars. In this formal system, things that are literal would be in quotes. In that case, what you referenced should be formally written Code:
'strcat' '(' expression [ ',' expression ]* ')' This template language grammar is intended to be formal. I think it is correct but I haven't put it through a grammar verifier to be sure. Taking all the above together, "strcat(a, [, b]*)" says that the literal 'strcat' is followed by:
|
|
![]() |
![]() |
![]() |
#12 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
|
Just curious: is the term "composite column" used anywhere in the Calibre UI? In the column dropdown itself, it's "columns built from other columns."
|
![]() |
![]() |
![]() |
#13 | |
Grumpy old git
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,380
Karma: 3933793
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
|
|
![]() |
![]() |
![]() |
#14 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
|
|
![]() |
![]() |
![]() |
#15 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
|
When using a template in Action Chains to set a boolean column, should I use "Yes/No" or "True/False"?
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
A few questions... (template language, mainly) | Clem2605 | Library Management | 2 | 12-30-2020 03:25 AM |
Questions on Kobo [Interfered with another thread topic] | spdavies | Kobo Reader | 8 | 10-12-2014 11:37 AM |
[OLD Thread] Some questions before buying the fire. | darthreader13 | Kindle Fire | 7 | 05-10-2013 09:19 PM |
[Old Thread] Save Template not working | TGinAZ | Calibre | 7 | 01-18-2012 01:03 AM |
Thread management questions | meme | Feedback | 6 | 01-31-2011 05:07 PM |