![]() |
#511 | |
Member
![]() Posts: 23
Karma: 10
Join Date: Apr 2014
Location: France
Device: PB622
|
Quote:
Anyhow, the format I save is indeed epub and the device is save_to_disk and, of course, I saved the plugboard. But I have another peace of information. It did not appear earlier to me as I am more often downloading my ebooks on device via Dropbox. But the plugboard works fine when Device is PB622 (my device). Only when Device is save_to_disk does it not work. So am I the only one or does it not work for save_to_disk and others don't bother? |
|
![]() |
![]() |
![]() |
#512 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Sep 2013
Location: Moscow, Russia
Device: iPad
|
![]()
I wrote template for new column to table view:
Code:
{author_sort:re(, ([^\s.])[^\s.]*(?:(?:$|\s|\.)+),, \1. } Anybody know why? What's wrong? |
![]() |
![]() |
Advert | |
|
![]() |
#513 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
You have three (
![]() More on this in the calibre template tutorial: http://manual.calibre-ebook.com/template_lang.html Function reference: http://manual.calibre-ebook.com/template_ref.html Try: Code:
{author_sort:re(([^\s.])[^\s.]*(?:(?:$|\s|\.)+), \1. } Last edited by eschwartz; 07-03-2014 at 10:48 AM. |
![]() |
![]() |
![]() |
#514 | |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Sep 2013
Location: Moscow, Russia
Device: iPad
|
![]() Quote:
Of course, I read the manual. And did some help script on Python, but still need help. Why this template have an ERROR? Spoiler:
|
|
![]() |
![]() |
![]() |
#515 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
I just noticed the closing parenthesis in re() was missing too. There seems to be few problems, really.
What are you trying to do? EDIT: It looks like you want to abbreviate all author first names? "Wood, Sir John" becomes "Wood, S. John" but "Ball, Harry" becomes "Ball, H." Last edited by eschwartz; 07-03-2014 at 11:24 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#516 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
You will need to escape the comma as "\," (but in the python script, since the pattern was quoted, escaping wasn't necessary).
It still errors, I'm not sure why, but it is more complex than it needs to be, so... Try this template, which I rewrote from scratch: Code:
{author_sort:re(\, (\w)\w*,\, \1.)} Search for: comma, space, letter (captured), letters. [Stop at the first non-letter value.] Replace with: comma, space, captured first letter, period Last edited by eschwartz; 07-03-2014 at 11:29 PM. |
![]() |
![]() |
![]() |
#517 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,908
Karma: 7076137
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
@eschartz: this call to re is a prime candidate for template program mode. There are too many ways that the single function mode parser can get confused by the embedded parens and commas. Using TPM eliminates all of that.
|
![]() |
![]() |
![]() |
#518 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Sep 2013
Location: Moscow, Russia
Device: iPad
|
|
![]() |
![]() |
![]() |
#519 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,908
Karma: 7076137
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
A template that produces what you want for the example you provided is Code:
{author_sort:'re($, '([, ]+)(\w)\w*', '\1\2.')'} |
|
![]() |
![]() |
![]() |
#520 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
This should work, though: Code:
program: re( field('author_sort'), '(\w)\w+\b(?!,)', '\1.' ) ![]() At some point I thought I'd try list_re to fix your example. But I discovered this: Code:
program: list_re( field('author_sort'), '&', '(.*)', '\1' ) ![]() Last edited by eschwartz; 07-07-2014 at 05:56 PM. |
|
![]() |
![]() |
![]() |
#521 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,908
Karma: 7076137
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
BTW: a better fix would be to use the new function list_re_group so you can separate the identification of which names to include from the munging of the names. |
|
![]() |
![]() |
![]() |
#522 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Hmm, weird.
Anyway, I thought the only thing list_re_group() did was to apply templates and stuff to replacements in a list -- I just realized you can limit what gets passed to the re_group with a separator AND a regex. P.S. The documentation for all three functions you added is a little weird, indented plus list_re_group is referred to as list_re (the second one???) in template_ref.html. The indents I believe are because the documentation builder does hierarchical bulleted lists when it sees tabs. You indented with tabs, which is usually reasonable. All of Kovid's functions are indented with four spaces. https://bugs.launchpad.net/calibre/+bug/1339296 |
![]() |
![]() |
![]() |
#523 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 20,852
Karma: 27620684
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
How can the Series number be shown in Roman Numerals in the Book Jacket.
The setting in Look & Feel does not appear to have any effect on the Book Jacket. So wondered if it's possible to overcome with something in Code:
%CALIBRE_CONFIG_DIRECTORY%\resources\catalog\template.xhtml BR Last edited by BetterRed; 07-16-2014 at 02:12 AM. |
![]() |
![]() |
![]() |
#524 |
eBook Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
Hi All:
I have been having trouble with a save_to_disk plugboard that does not seem to be working but I cannot figure out why. Code:
This is my plugboard: {#purchased1:.7} - {title_sort} - {author} - {tags} |
![]() |
![]() |
![]() |
#525 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
(The template itself is valid.) I cannot think of anything that would override Preferences ==> Import/Export ==> Saving books to disk. |
|
![]() |
![]() |
![]() |
Tags |
custom column, tag, tags |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
custom column i need a little help | shinken | Calibre | 3 | 09-15-2010 03:41 AM |
Using Custom Metadata in Save Template | EJvdH | Calibre | 1 | 07-02-2010 06:06 AM |
Accessories Decalgirl Kindle 2 custom skin template | srmalloy | Amazon Kindle | 6 | 04-09-2010 09:55 PM |
Donations for Custom Recipes | ddavtian | Calibre | 5 | 01-23-2010 04:54 PM |
Help understanding custom recipes | andersent | Calibre | 0 | 12-17-2009 02:37 PM |