Quote:
Originally Posted by Bozana
I'm not looking for title case. I'm looking for Proper Case. Title case leaves the "a" and "the" as l ower case etc.., when converted. Whilst, Proper Case makes ALL first letters to Upper case, including "A" and "The" etc..
Title case:
He Lives in Edmonton, but Services all Over the Region, as a Electrican
Proper Case:
He Lives In Edmonton, But Services All Over The Region, As A Electrican
I already know that trick with Title Case that you've showed... I'm chasing Proper Case...
Thank you anyway. 
|
You can do this with Bulk metadata edit / Search & replace using "template" as the source.
- Backup your library in case things go pear shaped.
- Select all the books you want to change.
- Go to Bulk metadata edit, search & replace tab. Make it look like the following:

The template code is:
Code:
python:
def evaluate(book, context):
import re
nt = []
for w in re.split(r'([ _.()])', book.get('title')):
nt.append(w.capitalize())
return ''.join(nt)
The r'([ _.()])' is the list of letters that separate words to be capitalized. This choice may not be the best for your library. You might want to add more letters. You could use r'(\W)', all non-alphabetic letters, but this might do the wrong thing with words like "_aaa" (aaa would not be capitalized) or "a.b" (b would not be capitalized). The choice depends on how much cleanup is required. Personally, I would use r'(\W)' and clean up the odd wrong title.
If you change the template you can test it on some books using the template editor before running it in Search & replace.
- Press OK. Wait. Changing titles requires writing the disk, which can take some time.
- Check the results. If they aren't what you want then restore the backup.
EDIT: This template uses
the python title() function to "Return a titlecased version of the string where words start with an uppercase character and the remaining characters are lowercase." It does a better job in some cases but suffers from changing words like "isn't" to "Isn'T".
Code:
python:
def evaluate(book, context):
return book.get('title').title()