Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 12-30-2022, 12:19 AM   #1
DBorG
Member
DBorG began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Jul 2015
Device: Android tablet
Exclamation from where does this ", " comes??

I created custom column "Comic Staff" from different custom columns "Comic Inker", "Comic Letterer", "Comic Editor" etc.
I use this template for creation of column:

{#com_inker:|(inker) |, }{#com_letterer:|(letterer) |, }{#com_colorist:|(colorist) |, }{#com_editor:|(editor) |, }{#com_cover_artist:|(cover artist) |, }

but in columns view it shows ", " at the beginning:

, (colorist) name of Colorist, (cover artist) name of Cover Artist, (editor) name of Comic Editor, (inker) name of Inker, (letterer) name of Letterer

how to get rid of that column+space at beginning?

I know that it sorts alphabetically, and if i remove "," from Comic Colorist it will lose ", " on beginnings, but if next comic doesn't have colorist it will again show it at beginning for Cover artist.

Its a small thing but it bugs me.

Thanks in advance
DBorG is offline   Reply With Quote
Old 12-30-2022, 08:01 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by DBorG View Post
I created custom column "Comic Staff" from different custom columns "Comic Inker", "Comic Letterer", "Comic Editor" etc.
I use this template for creation of column:

{#com_inker:|(inker) |, }{#com_letterer:|(letterer) |, }{#com_colorist:|(colorist) |, }{#com_editor:|(editor) |, }{#com_cover_artist:|(cover artist) |, }

but in columns view it shows ", " at the beginning:

, (colorist) name of Colorist, (cover artist) name of Cover Artist, (editor) name of Comic Editor, (inker) name of Inker, (letterer) name of Letterer

how to get rid of that column+space at beginning?

I know that it sorts alphabetically, and if i remove "," from Comic Colorist it will lose ", " on beginnings, but if next comic doesn't have colorist it will again show it at beginning for Cover artist.

Its a small thing but it bugs me.

Thanks in advance
Your problem: you are constructing a list where there is always a comma at the end. This tells calibre to add an empty item to the list. You need to remove the last comma, which is made more complicated by the fact that not all the referenced columns have values so you can't know in advance which comma to remove.

There are several ways to do the job, but I think this General Program Mode template is the easiest to understand. It first generates the same value as your template then uses the re() function to remove the trailing comma. Note that the re() searches for comma, not comma-space. This is required because leading and trailing spaces are removed by template().
Code:
program:
	v = template('{#com_inker:|(inker) |, }{#com_letterer:|(letterer) |, }{#com_colorist:|(colorist) |, }{#com_editor:|(editor) |, }{#com_cover_artist:|(cover artist) |, }');
	re(v, ',$', '')
chaley is offline   Reply With Quote
Advert
Old 12-31-2022, 05:36 AM   #3
Fynjisx
Connoisseur
Fynjisx began at the beginning.
 
Posts: 91
Karma: 10
Join Date: Jul 2022
Location: Greenland
Device: xiaomi
Quote:
Originally Posted by DBorG View Post
{#com_inker:|(inker) |, }}
Thanks in advance
what does the
Code:
...|(inker) |,...
construction do???
Fynjisx is offline   Reply With Quote
Old 12-31-2022, 05:38 AM   #4
Fynjisx
Connoisseur
Fynjisx began at the beginning.
 
Posts: 91
Karma: 10
Join Date: Jul 2022
Location: Greenland
Device: xiaomi
Quote:
Originally Posted by chaley View Post
General Program Mode template is the easiest to understand.
I never understood this grammar
Fynjisx is offline   Reply With Quote
Old 12-31-2022, 06:16 AM   #5
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Fynjisx View Post
what does the
Code:
...|(inker) |,...
construction do???
See this section of the calibre template language manual.
chaley is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pressing "Restore Defaults" under "Book Details" wipes all "Look & Feel" settings. MarjaE Library Management 1 03-30-2021 11:46 AM


All times are GMT -4. The time now is 04:54 PM.


MobileRead.com is a privately owned, operated and funded community.