View Single Post
Old 12-24-2021, 04:55 PM   #3
TheRealJohnAdams
Enthusiast
TheRealJohnAdams will blow your mind, man!TheRealJohnAdams will blow your mind, man!TheRealJohnAdams will blow your mind, man!TheRealJohnAdams will blow your mind, man!TheRealJohnAdams will blow your mind, man!TheRealJohnAdams will blow your mind, man!TheRealJohnAdams will blow your mind, man!TheRealJohnAdams will blow your mind, man!TheRealJohnAdams will blow your mind, man!TheRealJohnAdams will blow your mind, man!TheRealJohnAdams will blow your mind, man!
 
Posts: 42
Karma: 57668
Join Date: May 2020
Device: Kindle Oasis, Kobo Forma, Onyx Page
Quote:
Originally Posted by chaley View Post
My guess, and this is just a guess, is that the behavior started when you upgraded to calibre 5, at which point the python regular expression system changed.

Calibre has *forever* (since at least 2010) replaced sequences of spaces in template results with a single space. I think, but don't know, that python 3 includes non-breaking-spaces in the set of space characters while python 2 did not. I did not test this theory.

You can avoid removing sequences of spaces by using General Program Mode templates. For example, the template
Code:
program: $authors
doesn't remove internal non-breaking spaces. The template
Code:
{authors}
does remove them. The reason: internal spacing in GPM templates is under the control of the template writer while spacing in non-GPM templates can vary depending on template evaluation.

EDIT: Just to avoid some questions: the current behavior won't change back to what it was.
Thanks so much. Switching to program mode did fix my problem. In case anyone else comes here with the same goal I had, my "authors" plugboard template is as follows:
Code:
program: re($authors, ' &',',')
TheRealJohnAdams is offline   Reply With Quote