05-01-2021, 04:28 PM | #91 |
Custom User Title
Posts: 9,328
Karma: 63265021
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 |
05-01-2021, 05:19 PM | #92 | |
Grand Sorcerer
Posts: 11,948
Karma: 7225107
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 | |
|
05-01-2021, 05:30 PM | #93 |
Custom User Title
Posts: 9,328
Karma: 63265021
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.
|
05-01-2021, 09:33 PM | #94 |
Custom User Title
Posts: 9,328
Karma: 63265021
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.
|
05-02-2021, 05:18 AM | #95 |
Grand Sorcerer
Posts: 11,948
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
Advert | |
|
05-08-2021, 06:02 PM | #96 |
Wizard
Posts: 1,134
Karma: 1954142
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. |
05-08-2021, 06:24 PM | #97 | |
Grand Sorcerer
Posts: 11,948
Karma: 7225107
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 |
|
05-08-2021, 07:03 PM | #98 |
Wizard
Posts: 1,134
Karma: 1954142
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. |
05-10-2021, 07:05 PM | #99 |
Custom User Title
Posts: 9,328
Karma: 63265021
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. |
05-10-2021, 07:18 PM | #100 |
Wizard
Posts: 1,134
Karma: 1954142
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. |
05-10-2021, 07:36 PM | #101 |
Custom User Title
Posts: 9,328
Karma: 63265021
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thank you
|
05-13-2021, 08:32 PM | #102 |
Custom User Title
Posts: 9,328
Karma: 63265021
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?
|
05-14-2021, 03:01 AM | #103 |
Grand Sorcerer
Posts: 11,948
Karma: 7225107
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? |
05-14-2021, 03:08 AM | #104 |
Custom User Title
Posts: 9,328
Karma: 63265021
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.
|
05-14-2021, 03:12 AM | #105 | |
Grand Sorcerer
Posts: 11,948
Karma: 7225107
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 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Library Management: various questions not worth their own thread | ownedbycats | Library Management | 156 | 07-23-2024 11:45 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 |