![]() |
#91 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thanks
![]() Any ideas why the second part of this template isn't removing the URIs? Code:
program: publisher = $publisher; ids = $identifiers; u = select(ids, 'uri'); g = select(ids, 'gutenberg'); if publisher == 'Project Gutenberg' && u != g then n = re(u, '^http://www.gutenberg.org/(\d+)', '\1'); ids = list_union(ids, strcat('gutenberg:', n), ',') fi; if publisher == 'Project Gutenberg' && u && g then ids = list_difference(ids, strcat('uri:', u), ',') fi; ids |
![]() |
![]() |
![]() |
#92 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Also, both conditions check for "publisher == 'Project Gutenberg'". You could test that once and put the other tests as nested ifs. |
|
![]() |
![]() |
Advert | |
|
![]() |
#93 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Actually I think it's a mistake of what I thought template tester was doing; I was testing with books that only had uri. If I add gutenberg: and test again it removes the uri: identifier.
|
![]() |
![]() |
![]() |
#94 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Also, preferably I would just skip the Publisher and check for a uri: contains http://www.gutenberg.org/ but I'm not sure how to do that.
![]() |
![]() |
![]() |
![]() |
#95 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
Advert | |
|
![]() |
#96 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
@chaley: Running the following template returns true i.e "1"
Code:
program: '' inlist 'first,second' Last edited by capink; 05-08-2021 at 06:07 PM. |
![]() |
![]() |
![]() |
#97 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
It isn't clear to me what the expression is looking for. If you looking for an empty list then there are several ways to do that, such as a == '' or list_count() == 0. If you are looking for an item in a list then you must explicitly decide what happens if the item is empty. Does it match, or does it fail? If you know you want the left-hand expression to match *something* then you can use Code:
substr('^', value, '$') inlist whatever |
|
![]() |
![]() |
![]() |
#98 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
I think str_in_list() is a good answer.
I was using it in action chains conditions where some variables can return empty values, so I had to nest the value in if statment to make sure it is not an empty string: Code:
program: clicked_column = list_item(globals(_event_args), 1, ','); if clicked_column then if clicked_column inlist field_names('is_multiple:true,is_names:false') then 'true' fi fi Edit: The below code is working well Code:
program: clicked_column = list_item(globals(_event_args), 1, ','); tag_like = field_names('is_multiple:true,is_names:false'); str_in_list(tag_like, ',', clicked_column, 'true', '') Last edited by capink; 05-08-2021 at 07:11 PM. |
![]() |
![]() |
![]() |
#99 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
To work around another FanFicFare issue, I want to make a template that removes either 'In-Progress' or 'Complete' from tags if #fanficstatus is 'Anthology.'
Code:
program: status = $#fanficstatus; tags = $tags; if status == 'Anthology' then tags = list_difference(tags, strcat('In-Progress', 'Complete'), ',') else tags fi Last edited by ownedbycats; 05-10-2021 at 07:08 PM. |
![]() |
![]() |
![]() |
#100 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Try this:
Code:
program: status = $#fanficstatus; tags = $tags; if status == 'Anthology' then tags = list_difference(tags, 'In-Progress,Complete', ',') else tags fi Code:
strcat('In-Progress', 'Complete') Code:
In-ProgressComplete Last edited by capink; 05-10-2021 at 07:20 PM. |
![]() |
![]() |
![]() |
#101 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thank you
![]() |
![]() |
![]() |
![]() |
#102 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
This resets the time to 12:00:00. Did I make a mistake?
|
![]() |
![]() |
![]() |
#103 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
That S&R doesn't do anything. Templates are not evaluated as search expressions; they are interpreted as plain text. A template is evaluated only if you use "Template" as the source field, and then only if you put it in the "Template" box.
The replacement of /1 is also plain text. I suspect you wanted \1. What are you trying to do? |
![]() |
![]() |
![]() |
#104 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I accidentally wiped out my Audit Log while troubleshooting plugins so I was copying the column to itself so that AL had a record of the original values. I figured out what I had to do though.
|
![]() |
![]() |
![]() |
#105 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
![]() Searching for /1 finds nothing because that character sequence doesn't exist in an ISO date. Replacing with /1 would replace with exactly that text, /1, but since nothing was found, nothing was replaced. You probably wanted search for ^(.*)$ and replace with \1. This matches the entire source and replaces it with itself |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Library Management: various questions not worth their own thread | ownedbycats | Library Management | 225 | 07-27-2025 02:07 PM |
[Metadata Source Plugin] Questions regarding parse select, docs and ref templates | Boilerplate4U | Development | 13 | 07-07-2020 02:35 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 |
Thread management questions | meme | Feedback | 6 | 01-31-2011 05:07 PM |