Quote:
Originally Posted by Comfy.n
I thought the template used for titles would run fine for authors, but I couldn't make it work. Here's what I want to automate via Action Chains:
One click executes a search and replace to change 'john smith' to 'John Smith'.
Tried this in bulk metadata dialog:
@chaley, I wonder if such a feature would be implementable/welcome in the bulk MDE, similar to the title case functionality.
edit: just found how to do this, without a template, in Bulk MDE: it's 'Apply function after replace'
|
The template didn't work because authors is a multi-valued field (a list). The template must process it author-by-author. Like this:
Code:
python:
def evaluate(book, context):
import re
new_auts = []
for author in book.authors:
aut = []
for w in re.split(r'([ _.()])', author):
aut.append(w.capitalize())
new_auts.append(''.join(aut))
return ' & '.join(new_auts)