View Single Post
Old 04-28-2011, 09:52 AM   #6
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,475
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
General program mode templates do not go between {} characters. They must begin with the word 'program:' and the program goes until the end of the string. The concept of a multiline template goes away, because the entire string is one template. It makes little sense to me for someone to use a general program mode template in the situation you are describing. If they *really* need something of that complexity to generate a field value, then they can use a composite column or build a python template function.

Template program mode expressions can in theory be multiline, but in practice they never are. I think it is safe not to support them.

One thing that my suggestion does not cover is fields that contain explicit newlines, where these newlines are significant. Non-multiple text fields come to mind. These normally use HTML, so I am not convinced this is a problem. Is it?

BTW: I have no particular problem with adding a parameter to safe_formatter not to collapse white space. I just want to be sure it is needed before I do it. If I do this, then you could pass the entire string in one go. The downside is that there would be no white space processing, so templates like
"abc {series} def" would evaluate to "abc def" (two spaces) if there is no series. Perhaps this is OK.

Last edited by chaley; 04-28-2011 at 09:54 AM.
chaley is offline   Reply With Quote