![]() |
#31 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,189
Karma: 63194629
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Also while making that template I noticed if I accidentally put $$fanficcat (which is a column that does not exist), the first clause returned for every book. Is this intended?
|
![]() |
![]() |
![]() |
#32 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,906
Karma: 7076137
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Do you mean the slashes in this statement?
Code:
list_re($tags, ',', '\.', '\') Unfortunately the regexp-based template language lexical analyser cannot handle escaped backslashes. To do what you want you must use some other character. Quote:
Code:
re(sublist($tags, 0, 1, ','), '^(.*?)($|\..*$)', '\1') Last edited by chaley; 04-12-2021 at 05:03 PM. Reason: Correct the argument order for sublist |
|
![]() |
![]() |
Advert | |
|
![]() |
#33 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,906
Karma: 7076137
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
#34 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,189
Karma: 63194629
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I found a post saying that both slashes could be used and it'll be normalized, so I switched it:
Code:
program: if $$#fanficcat then re(sublist($tags, ',', 0, 1), '\.', '/') elif $formats == 'PDF' then 'PDF' else re(sublist($tags, ',', 0, 1), '^(.*?)($|\..*$)', '\1') fi |
![]() |
![]() |
![]() |
#35 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,906
Karma: 7076137
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
sublist(list_string, start_index, end_index, separator) |
|
![]() |
![]() |
Advert | |
|
![]() |
#36 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,189
Karma: 63194629
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Code:
program: # Returns 'Fanfiction/Fandom' for fanfics if $$#fanficcat then re(sublist($tags, 0, 1, ','), '\.', '/') # Returns 'PDF' for PDFs elif $formats == 'PDF' then 'PDF' # Returns topmost tag for all other books else re(sublist($tags, 0, 1, ','), '^(.*?)($|\..*$)', '\1') fi ![]() Last edited by ownedbycats; 04-12-2021 at 05:08 PM. |
![]() |
![]() |
![]() |
#37 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,189
Karma: 63194629
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Question: If you have two if statements that are mutually exclusive:
Code:
program: if $#enum== 'foo' then 'foo' else $#enum == 'bar' then 'bar' fi Last edited by ownedbycats; 04-13-2021 at 01:38 PM. |
![]() |
![]() |
![]() |
#38 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,906
Karma: 7076137
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Functionally, no, as long as you can truly guarantee mutual exclusivity. However, there might be differences in performance. The most common ones should be first.
|
![]() |
![]() |
![]() |
#39 | |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,189
Karma: 63194629
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
In regards to this:
Quote:
|
|
![]() |
![]() |
![]() |
#40 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,906
Karma: 7076137
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Your bug report was about multiple book search and replace. That dialog in regexp mode supports "Template" as the source field.
|
![]() |
![]() |
![]() |
#41 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,189
Karma: 63194629
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I see it now.
![]() ![]() |
![]() |
![]() |
![]() |
#42 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,189
Karma: 63194629
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Question: Can a gpm statement be used for a save template?
I currently have a #kobopath gpm composite which then passes itself into my save templates; I thought I could skip that intermediary step. Last edited by ownedbycats; 04-14-2021 at 04:14 PM. |
![]() |
![]() |
![]() |
#43 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,906
Karma: 7076137
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Why? These templates predate the template language by several years. |
|
![]() |
![]() |
![]() |
#44 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,189
Karma: 63194629
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Ok. That's good to know that before I started trying to kludge something together.
![]() |
![]() |
![]() |
![]() |
#45 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,189
Karma: 63194629
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
This (it's still a WIP; I am still debating whether this will be better than multiple non-template rules) returns a syntax error about an unexpected end of program near "unknown." Where exactly is the mistake?
Code:
program: vl = $#vls; pc = $$#pagecount; fmt = $$#formats; lang = $$#languages if 'Cleanup' in vl then # Checks for a missing format if fmt == '' then 'add_book.png' fi # Checks for a missing pagecount if pc == 'None' then 'cover_flow.png' fi # Checks for a missing language if lang == 'None' then 'languages.png' fi # Checks for an ORIGINAL_EPUB in formats if fmt == 'ORIGINAL_EPUB' then 'add_book.png' fi # Returns a generic icon if no specific issue is flagged else 'polish.png' fi Last edited by ownedbycats; 04-16-2021 at 01:18 AM. |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |