Skip to content
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 %replaceText% and %deleteText% to work on content that was imported using %file()% #244

Closed
RealRaven2000 opened this issue Jun 27, 2023 · 2 comments
Assignees

Comments

@RealRaven2000
Copy link
Owner

RealRaven2000 commented Jun 27, 2023

We often need to import text fragments ("building blocks") that have a generic message but need to include some specific keywords, such as a product name or URL. At the moment the following pattern does not work within the text that is imported:

Template:

  %file("snippets/why-renew.html")%   
  %replaceText("{addonName}","quickFilters")%
  %replaceText("{github}","https://github.com/RealRaven2000/quickFilters")%

Contained file (why-renew.html)

<p> 
  All changes of the Add-on {addonName} can be seen as they are 
  created and tracked <a href="{github}/issues">on Github</a>;
</p>

At the moment, SmartTemplates does the replacements before the file is loaded into the template. Expected behavior: First load the file and replace its contents into the template, then do the text replacements afterwards.

@RealRaven2000
Copy link
Owner Author

Preview version with changed behavior:

smartTemplate-fx-3.17.1pre5.zip

New behavior: SmartTemplates first loads the file and replaces its contents into the template, then executes the text replacements afterwards. As demonstrated in the example above, it can also be used to modify HTML markup and affect things like HTML attributes such as the URL of a web link.

To install the preview version, as always download the zip file and drag it into Add-ons Manager (do not extract contents).

@RealRaven2000
Copy link
Owner Author

Implemented in 4.0b3 published on 17/02/2023

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

No branches or pull requests

1 participant