New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow using escaped commas \,
within text parameters of variables, where possible
#280
Comments
Notes: Here is a new version which allows a bunch of new things: my test file: %toclipboard("pigs\, dogs\, birds and beetles")%
%header.set(subject,"here is some text for the subject\, a lot of text \, followed by clipped text: [",clipboard,"]")%
%file("../img/invalid-tab.png","here are some examples. 1\, 2\, 3...",width=450px,height=90px)%
<p>conditional text:
%conditionalText(forwardMode,"here is some text\, inline","here is some text\, attachText")%
</p>
%replaceText("find this\, peasant","replaced\, adapted and overcome!")%
%deleteText("yours\,")%
<p>
%matchTextFromSubject("some text\,12 not found",0,"nothing found, therefore I insert: Hello\, world!! Here\, there and everywhere.")%
</p>
%deleteQuotedText("blabla\, bla",1)%
%replaceQuotedText("search me, yeah","<p>hallo\, quoted world!</p>",1)% To test the version above, download the zip file, drag the file into Thunderbird Add-ons Manager, do not extract contents or if won't install. |
Next version, this one allows (escaped) commas in multiparameter variables such as %replaceQuotedText()% and %replaceText()%. Examples on how to escape all commas: %replaceText("find this\, peasant","replaced\, adapted and overcome!")%
%replaceQuotedText("search me\, yeah","<p>hallo\, quoted world\, and every one else!</p>",1)%
%header.set(subject,"here is some text for the subject\, a lot of text \, followed by clipped text: [",clipboard,"]")% note: only To test the version above, download the zip file, drag the file into Thunderbird Add-ons Manager, do not extract contents or if won't install. |
While testing with smart fragments I found both the function This means we can now modify an email we have just written (or loaded via a template) by replacing text via a smart fragment, which makes it actually potentially useful. Here is the result: To test the version above, download the zip file, drag the file into Thunderbird Add-ons Manager, do not extract contents or if won't install. |
we can now use a smart fragment to delete or replace text from the body of the email. This can be potentially much more useful.
Implemented in 4.4 - published 28/03/2024 |
Some variables such as the following replacement commands allow entering a piece of plain text for searching or replacing. (find, replace, altText. The problem is if the user wants to include a comma within the text - the parameters are broken up using a standard split routine, which regards the comma as delimiter between the params:
So if we were to write an example like:
this will be split into the following array with 3 parameters:
Which will lead to undesired outcomes or the command failing completely. So in order to support commas within these text parameters, SmartTemplates should support escaped commas, like so:
The backslash will be used to tell the parser that the comma is part of a single parameter - the algorithm will detect these and recombine the array:
The text was updated successfully, but these errors were encountered: