Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 07-17-2018, 07:43 AM   #1
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Metadata plugboard problem

I use rating = 5 for books I have proofed and corrected. I'm trying to create a metadata plugboard which will flag this up in the filename, and tried this:
Code:
{rating:contains(5,✓ ,)}{title}
What I get is "✓Title" instead of the expected "✓ Title". Replacing the space after "✓" with a NBSP makes no difference. So I tried escaping the space with a backslash:
Code:
{rating:contains(5,✓\ ,)}{title}
and now I get "✓ itle" -- the space is there, but it overwrites the first character of the title...

Can anyone explain what is going on here, and how I can get both a space and the first character of the title to appear?
Phssthpok is offline   Reply With Quote
Old 07-18-2018, 01:33 AM   #2
Katja_hbg
Groupie
Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.
 
Posts: 167
Karma: 158116
Join Date: Oct 2015
Device: Kobo Glo HD (landscape), Kobo Aura One
Spaces will not be ignored when you use unbreakable spaces.
I did it this way: in word key alt together with 0160 on the number block
Copy that from word into plugboard.
Sounds stupid, but works.
Katja_hbg is offline   Reply With Quote
Old 07-18-2018, 02:15 AM   #3
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,908
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
@Phssthpok: When I look at that I think: "Where are the quotes?" Are you sure you shouldn't have quotes around the replacement string? I would expect a trailing space to be stripped off in without them.

And in the last case, I wonder if the "t" hasn't actually been removed, but whatever you are viewing it with is seeing "\t" and substituting a tab character.
davidfor is offline   Reply With Quote
Old 07-18-2018, 02:42 AM   #4
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: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Phssthpok View Post
Can anyone explain what is going on here, and how I can get both a space and the first character of the title to appear?
Leading and trailing spaces in the result of a template expression are stripped (removed) before that result is further processed. That is one reason the prefix and suffix options exist -- they are applied if the result is non-empty after being stripped, and without further stripping.

Use
Code:
{rating:contains(5,✓,)|| }{title}
@davidfor: he is using Single Function Mode, which doesn't use quoting. This can lead to ambiguities, which is why I prefer Template Program Mode or General Program Mode, depending on the task.
chaley is offline   Reply With Quote
Old 07-18-2018, 06:15 AM   #5
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by chaley View Post
Leading and trailing spaces in the result of a template expression are stripped (removed) before that result is further processed. That is one reason the prefix and suffix options exist -- they are applied if the result is non-empty after being stripped, and without further stripping.

Use
Code:
{rating:contains(5,✓,)|| }{title}
Aha! Thank you very much, problem solved! (I didn't see anything in TFM about template results being trimmed...?)

I'm still puzzled about losing the first letter of the title with a backslash-escaped space though...

Last edited by Phssthpok; 07-18-2018 at 06:23 AM.
Phssthpok is offline   Reply With Quote
Old 07-18-2018, 06:18 AM   #6
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by Katja_hbg View Post
Spaces will not be ignored when you use unbreakable spaces.
I did it this way: in word key alt together with 0160 on the number block
Copy that from word into plugboard.
Sounds stupid, but works.
But they are ignored. I tried it by pasting in an NBSP character, exactly as you described (except I copied mine from the Calibre editor's special characters panel). I presume all \s characters (which includes NBSP) are trimmed.
Phssthpok is offline   Reply With Quote
Old 07-18-2018, 06:22 AM   #7
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by davidfor View Post
And in the last case, I wonder if the "t" hasn't actually been removed, but whatever you are viewing it with is seeing "\t" and substituting a tab character.
It's the first character of the book title, not the first character of the word "title". It was actually the letter R in the case of the book I was experimenting with.
Phssthpok is offline   Reply With Quote
Old 07-18-2018, 06:34 AM   #8
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,908
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by Phssthpok View Post
It's the first character of the book title, not the first character of the word "title". It was actually the letter R in the case of the book I was experimenting with.
Of course.
davidfor is offline   Reply With Quote
Old 07-18-2018, 06:41 AM   #9
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: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Phssthpok View Post
I'm still puzzled about losing the first letter of the title with a backslash-escaped space though...
This happens because of the order of evaluation. First the individual templates are evaluated. In your case the first template will end with a \ because the space is stripped. The results are then concatenated. It seems that the title in your example begins with an R. If we assume the title is Ringworld then the result is
Code:
✓\Ringworld
The sequence \R is a carriage return, which gets converted by the output function to a space, resulting in
Code:
✓ ingworld
Other characters would behave differently, perhaps disappearing or perhaps generating some other output.

FWIW: backslashes in Single Function Mode can have strange behavior. Sometimes they are really escapes and sometimes they aren't. You should avoid them or use one of the other modes instead.
chaley is offline   Reply With Quote
Old 07-19-2018, 04:08 AM   #10
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by chaley View Post
This happens because of the order of evaluation...
Aha! Many thanks, now I finally understand...
Quote:
FWIW: backslashes in Single Function Mode can have strange behavior. Sometimes they are really escapes and sometimes they aren't. You should avoid them or use one of the other modes instead.
Yes, I think I've learnt that lesson
Phssthpok is offline   Reply With Quote
Reply

Tags
metadata plugboard, templates

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Metadata Plugboard - I don't get it... _daclaus Library Management 3 08-25-2013 12:13 PM
Metadata Plugboard Problem (mobi/kindle) alanHd Library Management 5 08-20-2012 05:44 AM
Metadata Plugboard problem - Bug? Jimbo724 Library Management 4 08-03-2012 04:20 AM
Metadata Plugboard IxiaAurea Calibre 1 11-05-2011 01:13 PM
Problem with Metadata Plugboard cheveguerra Calibre 3 10-05-2010 12:00 PM


All times are GMT -4. The time now is 04:02 AM.


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