Skip to content

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

Closed

Description

@RealRaven2000

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.

Activity

  1. RealRaven2000 commented on Apr 29, 2024

    @RealRaven2000
    OwnerAuthor

    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).

  2. RealRaven2000 commented on Apr 29, 2024

    @RealRaven2000
    OwnerAuthor

    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).

  3. added 2 commits that reference this issue on Apr 29, 2024
  4. RealRaven2000 commented on Apr 29, 2024

    @RealRaven2000
    OwnerAuthor

    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).

  5. RealRaven2000 commented on May 1, 2024

    @RealRaven2000
    OwnerAuthor

    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).

  6. RealRaven2000 commented on May 14, 2024

    @RealRaven2000
    OwnerAuthor

    Implemented in 4.5 released on 14/05/2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions