Page 1 of 1

Reference Variables in Code Snippets

Posted: Thu Jun 20, 2024 3:34 am
by michaelatw
Hi everyone,

I am fairly new to Flare and I am currently working on some codeSnippets in our documentation. I was wondering, if (and how) I can use variables in a codeSnippet? I have about 20 code examples providing a path that uses a version number which is changing every few releases. The version number is a variable and i want to use this in the code snippets, so that i don't have to upgrade the content manually every other releases.

Can anyone help me?
Thanks in advance

Re: Reference Variables in Code Snippets

Posted: Thu Jun 20, 2024 8:14 am
by NorthEast
You can insert variables in the code snippet editor in this format:
[%=VariableFileName.VariableName%]

Note that you will not see variable text displayed in the XML editor, and it'll just show the code above. But that code will be replaced by the variable text when you preview or build the output.

Re: Reference Variables in Code Snippets

Posted: Thu Jun 20, 2024 11:41 pm
by michaelatw
Thank you so much! I tried that before and thought it didn't work, because it didn't preview the variable in the editor. I tried it now and it works perfectly. Thanks :)