View Single Post
Old 07-03-2014, 11:46 AM   #513
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 7,350
Karma: 12814281
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 () commas in that template. Commas separate arguments in the function. re() takes three arguments -- val, pattern, replacement -- and the first is inferred as author_sort from the template. (val is only used in general and template program mode, not single-function mode which is what we are using here). You have also left args 1 & 3 empty.

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 11:48 AM.
eschwartz is offline   Reply With Quote