Nobody has a clue? I guess it's a bug then. I can't believe nobody ever uses multiple text variables in the same paragraph.
On the forums, please allow more than one day to give you a response to your question. It was posted on a Sunday, and if other posters are anything like me, they're usually well away from this page on a Sunday.
That said, I do use more than one text variable in a line, but admit that I have never then relied on the same lines to be included into a table of contents. I can tell you that text variables (including live captions) have limitations, such as not fitting over two lines unless they are converted to static text (InDesign Help | Text variables - under the heading "insert text variables" in a "note" at the end of the paragraph).
However, I can confirm that I have tried to replicate your fault and indeed, am getting the same thing here. I'd report it as a bug if I were you: Adobe - Feature Request/Bug Report Form
I submitted a bug report now.
If more people could verify this bug and also submit one, it would really help to press this issue.
Amazingly this post is nearly 2.5 years old but the bug still is there: I just stumbled across it by generating a toc from headings with none, one or two variables. No variable and even one works fine, but the text is garbled as soon as you use more than one variable.
The only solution was to convert one of the variables to text. Strange that no one came across this bug.
You mean: "My only solution …".
Yes. I'd be glad for another one that didn't break the workflow. Since they are used for product names in technical documentation, those variables are an essential part of the process.
… 2.5 years later!
"True issues force some of us to push back even further limits they trample without hesitation for so long!!"
[ Script not for free! ]
Looks great! How much would that be?
In Private! (^/)