![]() |
#1 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,805
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
"Normal" template inside GPM template
Code:
program: if field('#readorder') then 'Reading List: {#readorder} #{#readorder_index:0>2s' fi ![]() Last edited by ownedbycats; 11-21-2020 at 09:23 PM. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,364
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Moderator Notice
Moved to its own thread |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,364
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Three solutions. I used #series for #readorder.
1) Use GPM and the template function: Code:
program: if field('#series') then template('Reading List: {#series} #{#series_index:0>2s}') fi Code:
{#series:|Reading List: |}{#series_index:0>2s| #|} Code:
program: f = field('#series'); if f then strcat( 'Reading List: ', f, ' #', format_number(field('#series_index'), '0>2d') ) fi |
![]() |
![]() |
![]() |
#4 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,805
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thank you.
|
![]() |
![]() |
![]() |
#5 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,805
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Code:
program: if field('#readorder') then template('Reading List: {#readorder} #{#readorder_index:0>2s}') else if field('#fanficcat') then template('{#fanficcat}') fi fi I'm not sure how exactly to tell it to not put anything in there if those two don't apply. (For reference, this is in the "subtitle" field on the KoboTouchExtended driver.) Last edited by ownedbycats; 12-02-2020 at 01:21 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,364
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Example: this template works on calibre 5.6, substituting '#series' for '#readorder' and '#enum' for '#fanficcat'. If neither is set the template produces an empty value. Code:
program: if field('#series') then template('Reading List: {#series} #{#series_index:0>2s}') else if field('#enum') then template('{#enum}') fi fi EDIT 2: Run calibre in debug mode and post the exception information. Last edited by chaley; 12-02-2020 at 01:27 PM. |
|
![]() |
![]() |
![]() |
#7 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,805
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
It shows a "PLUGBOARD TEMPLATE ERROR" as the subtitle itself.
There's only one part in the log mentioning the template itself: Code:
DEBUG: 0.0 KoboTouch:books - driver options= Driver:KoboTouchExtended, Options - format_map: ['kepub', 'epub', 'cbr', 'cbz', 'pdf', 'txt'], use_subdirs: True, read_metadata: True, use_author_sort: False, save_template: {#kobopath}/{author_sort}/{title} - {authors}, extra_customization: [], manage_collections: True, collections_columns: #kobocoll, create_collections: True, delete_empty_collections: True, ignore_collections_names: , upload_covers: True, dithered_covers: False, keep_cover_aspect: True, upload_grayscale: False, letterbox_fs_covers: False, png_covers: False, show_archived_books: False, show_previews: False, show_recommendations: False, update_series: True, update_core_metadata: True, update_purchased_kepubs: True, update_device_metadata: True, update_subtitle: True, subtitle_template: program: if field('#readorder') then template('Reading List: {#readorder} #{#readorder_index:0>2s}') else if field('#fanficcat') then template('{#fanficcat}') fi fi, modify_css: False, override_kobo_replace_existing: False, support_newer_firmware: True, debugging_title: , driver_version: 3.4.1, extra_features: True, upload_encumbered: False, skip_failed: False, hyphenate: False, smarten_punctuation: False, clean_markup: False, full_page_numbers: False, disable_hyphenation: False, file_copy_dir: , hyphenate_chars: 6, hyphenate_chars_before: 3, hyphenate_chars_after: 3, hyphenate_limit_lines: 2 |
![]() |
![]() |
![]() |
#8 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,805
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I was able to view the full subtitle on the Kobo itself by going into book details
Code:
PLUGBOARD TEMPLATE ERROR Formatter: Failed to scan program. Invalid input }') fi near '{#fanficcat' |
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,364
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
This doesn't make sense, assuming you are running in debug mode. The only time that string is used is if there is an exception during template processing. That exception is printed in the debug log. Are you running in debug mode? Are you seeing exceptions of any kind?
|
![]() |
![]() |
![]() |
#10 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,805
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I'm running in debug mode. I'm not getting any exceptions, just a broken subtitle.
|
![]() |
![]() |
![]() |
#11 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,364
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
This says that the template has a syntax error. Have you posted exactly what is in the subtitle option?
|
![]() |
![]() |
![]() |
#12 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,805
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Here's a picture of my Kobo showing the broken subtitle. Apologies for the blur, it's hard to hold the phone steady.
|
![]() |
![]() |
![]() |
#13 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,805
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
The subtitle is either supposed to show the current reading list or whatever the #fanficcat is. If it's neither of those two it should show nothing.
This is the template. It shows no error in the editor. Code:
program: if field('#readorder') then template('Reading List: {#readorder} #{#readorder_index:0>2s}') else if field('#fanficcat') then template('{#fanficcat}') fi fi |
![]() |
![]() |
![]() |
#14 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,805
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
When I put the template as a test composite column, the same book shows no error.
|
![]() |
![]() |
![]() |
#15 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,364
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
there are spaces or a tab after the right paren on the line
Code:
template('{#fanficcat}') |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Multiple regexes in "save book to disk" template? | Phssthpok | Library Management | 1 | 07-12-2018 04:20 AM |
"Add a book" template like "Save to disk"? | vr8ce | Library Management | 10 | 06-09-2017 08:16 AM |
Kindle newbie needs "template" HTML & CSS | Rich_H | Kindle Developer's Corner | 12 | 09-10-2012 11:16 PM |
Kindle Newbie needs "template" HTML & CSS | Rich_H | Workshop | 4 | 09-10-2012 08:33 PM |
Kindle DX optimal "page" size - PDF or Word template | guiyoforward | Amazon Kindle | 12 | 09-28-2010 07:05 PM |