& Displayed Instead Of &

Started by Darius1968, February 15, 2023, 04:13:20 PM

Previous topic - Next topic

Darius1968

What need I do to have the ampersand enumerated in my file window tip instead of &?


Mario

No problem.

Image1.jpg
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

Which is perfect for simply displaying that text on my File Window Tip.  But, I'm interested in having the conversion done to the output of a variable with something like, pereplace:&==&amp~; embedded within the expression for said variable.  But, doing that, I get, &.  So, what do I have to do at this point? 


Mario

#3
Ah. You are using variables. You did not include this important info in your post.

The File Window Tip is designed to automatically detect the special & character in content and escapes it to not break XAML output.

If you use the variable {File.MD.title} for example (which is used in the default layout) and the metadata title contains a &, e.g. in "This & That", the File Window Tip will display "This & That" and not break. Because & is automatically escaped.
I have no idea what you are trying to achieve, or why you need to manually replace & in your variable. And keep in mind that, while variables are supper powerful and XMAL is too, not everything must necessarily work everywhere or in any combination or context. & has a special meaning for XAML, & and ; have a special meaning for variables.

From the pereplace help:pereplace uses the already escaped text for input. This means that a text initially containing unsafe HTML/XML characters like ' or < will contain the corresponding escape codes before it is handed over to pereplace. If your pereplace code replaces semicolons with something else, this will cause unwanted effects or even invalid XML/HTML code.

{File.MD.title|pereplace:~&amp~;==&amp~;FOO}
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook