Just wanted to share our recent experience with Flare 2020 R2.
I hope this email can help other people, who use Flare variables inside JavaScript code.
Background
In the HTML Master Page, we have JavaScript code that contains Flare variables for URLs that lead to our PDF books.
Code: Select all
<script type="text/javascript">
function downloadPDF() {
var pdfURL = '<MadCap:variable name="Book_Variables.File_ID" />';
var win = window.open(pdfURL, '_blank');
}
</script>
Issue
When we built an HTML output in Flare 2020 R2, we noticed that all these URLs are broken because the URLs resolved from Flare variables were wrapped in a special style.
This does NOT happen in Flare 2020 or Flare 2019 versions - resolved variables in JavaScript code are NOT wrapped in any style.
Root Cause
In Flare 2020 R2, all variables are always wrapped in a special style due to the new feature - Styled Variables:
https://help.madcapsoftware.com/flare20 ... iables.htm
This explanation was provided to use in a MadCap Support Ticket S025467.
Workaround
We had to change our JavaScript code to use a RegEx to extract the required URL from the resolved URL.
There several ways to do this.
This is what we did:
Code: Select all
<script type="text/javascript">
function downloadPDF() {
const RegExPattern = new RegExp('http(s){0,1}\:\/\/downloads\.checkpoint\.com\/download\.htm\\?ID=(\\w+)', 'i');
var pdfURL_resolved = '<MadCap:variable name="Book_Variables.File_ID" />';
var pdfURL_final = pdfURL_resolved.match(RegExPattern);
var win = window.open(pdfURL_final[0], '_blank');
}
</script>