View Single Post
Old 12-24-2021, 04:42 PM   #2
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: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
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.
chaley is offline   Reply With Quote