Snippet variables in attribute values - a bug?
Posted: Tue Aug 01, 2017 1:22 pm
I don't know if anyone can help... I'm using Flare's new snippet variables feature to alter certain words in the snippet according to the context in different topics. It works well with simple text-based variables, but when I try to use a variable in an attribute for a cross-reference target -
- it doesn't work. The default value of the variable CustomVariables.xrefTarget is always used, even when the snippet has an override in its snippet variables.
I.e. if the default value of CustomVariables.xrefTarget is "#making_a_wardrobe", and I override it in a snippet import with "#making_a_chair" -
- the override is ignored, and the default variable value is used in the output. Since the default value points to a non-existent anchor, clicking the link just takes you to the top of the page (because the first character is #, i.e. the current page, and nothing after that makes sense to the browser). The link in the output looks like this:
Note that the data-mc-variable-override attribute is empty, and surely it shouldn't be.
I'm guessing that this is a bug that got overlooked because this is, admittedly, a bit of an edge-case scenario. However, if anyone can think of a way around it, I'd be grateful, as I would rather not go back to using complex condition tag selectors to make dynamic snippets, which I used to do and eventually gave up on because it was harder work than copying and pasting.
Thanks,
Franky
Code: Select all
<MadCap:xref href="mcvariable:CustomVariables.xrefTarget"><span style="color: #0077c8;" class="mcFormatColor"><u>Making a Wardrobe</u></span></MadCap:xref>I.e. if the default value of CustomVariables.xrefTarget is "#making_a_wardrobe", and I override it in a snippet import with "#making_a_chair" -
- the override is ignored, and the default variable value is used in the output. Since the default value points to a non-existent anchor, clicking the link just takes you to the top of the page (because the first character is #, i.e. the current page, and nothing after that makes sense to the browser). The link in the output looks like this:
Code: Select all
<p>See <a href="#making_a_wardrobe" class="MCXref xref" data-mc-variable-override="">Making a Wardrobe</a>.</p>I'm guessing that this is a bug that got overlooked because this is, admittedly, a bit of an edge-case scenario. However, if anyone can think of a way around it, I'd be grateful, as I would rather not go back to using complex condition tag selectors to make dynamic snippets, which I used to do and eventually gave up on because it was harder work than copying and pasting.
Thanks,
Franky