RealRaven2000 / SmartTemplates

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

Add parameters for converting to uppercase, lowercase or capitalising of text matching function #288

Closed RealRaven2000 closed 2 months ago

RealRaven2000 commented 3 months ago

Text matching functions such as matchTextFromBody() will be even more useful if they allow conversion of case - these can be supplied with an additional parameter such as:

%matchTextFromBody("Customer.*\n\-+\n(.*)\n",1,capitalize)%
%matchTextFromSubject("Customer.*\n\-+\n(.*)\n",1,uppercase)%
%matchTextFromBody("Customer.*\n\-+\n(.*)\n",1,lowercase)%

%header.prefix.matchFromBody(subject,"Customer.*\n\-+\n(.*)\n",1,capitalize)%
RealRaven2000 commented 3 months ago

Here is a preview / tryout version:

smartTemplate-fx-4.5pre35.zip

The formatting parameters (capitalize, uppercase, lowercase, camelcase) can also be combined with the toclipboardparameter:

%matchTextFromBody("Customer.*\n\-+\n(.*)\n",1,capitalize,toclipboard)%

To install, download archive and drop into Thunderbird Add-ons Manager (don't extract contents).

RealRaven2000 commented 2 months ago

I decided to also add support applying these text transformation to the address variables, as in the following example:

%recipient(firstname,uppercase,lastname,capitalize)%
%from(name,lowercase)%

The switch will format all previous components in the line (but not overwrite earlier transformations of a different switch), so e.g. in the example "1,uppercase,2,3,lowercase" 1 will be in uppercase, 2 and 3 will be in lowercase.

smartTemplate-fx-4.5pre70.zip


To install, download archive and drop into Thunderbird Add-ons Manager (don't extract contents).

RealRaven2000 commented 2 months ago

Implemented in 4.5 released on 14/05/2024