RealRaven2000 / SmartTemplates

Thunderbird Add-on: SmartTemplates
http://smarttemplates.quickfolders.org/
Other
25 stars 15 forks source link

All spaces after/before `%header.set(subject," text ")%` are trimmed away #292

Closed PsLanger closed 2 months ago

PsLanger commented 2 months ago

Hi, i've tried to add a space after the header subject text, but this doesn't work, even if i try to add two space.

In Detail: I've made a template for new E-Mails with: %header.set(subject,"[Example] ")% but the space after ] doesn't appear in the header, even with two spaces or plain text without brackets. Space seens to work only if there are character before an after it, at the beginning it also doesn't work.

Is this a bug?

Regards

RealRaven2000 commented 2 months ago

Yeah it's possible, you can export the whole settings like this:

image

this will export the templates for Write / Reply / Forward and any of the checkboxes on these pages.

RealRaven2000 commented 2 months ago

Yeah it is reproducible here, no need to send your template :

image

image

RealRaven2000 commented 2 months ago

Looks like there is a (likely unnecessary) call to trim() in my modifyHeader function:

image

The other purpose of the line is to replace potential whitespace / line breaks, I think this was designed to highlight an arbitrary portion from a text and copy it then paste it in the subject line (using the clipboard keyword), for example:

%header.append(subject,clipboard)%

by the way you can also concatenate multiple arguments, like so:

%header.set(subject,"[honeybadgers] ","Hi ",clipboard," here is your latest news!")%

Of course calling trim()may still have it's unwanted side effects here, so I will remove it for now, I don't think it will create any huge side effects:

smartTemplate-fx-4.5pre74.zip


To install the test version above, download the zip file and drag the it into Thunderbird Add-ons Manager (do not extract contents, it won't install like that)

PsLanger commented 2 months ago

Seems to be working, nice. Already bought pro yesterday for great service. ;)

My second idea was an variable to force space like   (what it already has done betreen characters/words if you don't format in html). Could be a solution if the trim should be necessary anyway.

RealRaven2000 commented 2 months ago

Seems to be working, nice. Already bought pro yesterday for great service. ;)

My second idea was an variable to force space like (what it already has done betreen characters/words if you don't format in html). Could be a solution if the trim should be necessary anyway.

yes, that may be a solution, as it is what the name processing - such as %recipient(firstname,lastname,mail,work.department,work.organization)% - already does. It simply concatenates the elements it can find in the addressbook and delimits them with a space. By the way another pitfall with spaces, my example in the previous comment had a mistake; SmartTemplates generally doesn't like the space after a comma that delimits parameters, and can lead to wrong results.

RealRaven2000 commented 2 months ago

Fixed in 4.5 released on 14/05/2024