RealRaven2000 / SmartTemplates

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

Support `selection` as parameter for `replaceText` - so we can transform selected text from smart fragments #289

Closed RealRaven2000 closed 4 months ago

RealRaven2000 commented 5 months ago

Usage:

We want to do replacements in the selected text, for instance, the string

Menu >> submenu >> command

should be transformed into

Menu » submenu » command

Additionally we could add some markup to display the text in italic (or wrap a layout span around it). Example for such a smart fragment:

<i>%replaceText(">>","»",selection)%</i>

Ideally the text (html) should still be selected after the replacement operation, this way we could concatenate multiple such commands for some powerful formatting.

RealRaven2000 commented 5 months ago

Here is new version with the funciton added. Result:

image

By highlighting a line below (even if it has additional HTML such as bold or colored) we can transform it to a cursive string replacing all instances of ">>" with the Guillemet (right pointing double angle quotation mark) by using the following fragment:

<i>%replaceText(">>","»",selection)%</i>

At the moment if removes the existing selection state, so re-selecting the inserted string would be a nice-to-have. But this is already very useful to me!

smartTemplate-fx-4.5pre42.zip


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

RealRaven2000 commented 5 months ago

Found some regressions that made %matchTextFromBody()% misbehave. Fixed in the version below:

smartTemplate-fx-4.5pre44.zip


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

RealRaven2000 commented 5 months ago

Added documentation in Variables tab + localized to most supported languages:

smartTemplate-fx-4.5pre56.zip


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

RealRaven2000 commented 5 months ago

Found another regression that had problems with multiple smartTempalte variables in the same line (overmatching and combining multiple lines) such as To: "%to(name)%"&lt;%to("( %",mail)%&gt;

smartTemplate-fx-4.5pre57.zip

this one should be more stable


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

RealRaven2000 commented 4 months ago

Implemented in 4.5 released on 14/05/2024