Variables don't break across lines, so the only way to do this is with two variables (and a manually typed hyphen). You can apply two character styles to the parts you want separated and use running header (character style) variables.
Thanks for the thought. Unfortunately some chapter headings don't need a line break so I guess the only way is to have two templates for the different chapter types using the two styles as you suggest for those that do break.
I've done what Peter suggests on a 3200 page book. It worked great and you don't need extra styles.
Style your Paragraph Heading using Nested style, find an upper limit for your 1 line of text, set your nested style to include the first say 30 characters, and this applies a character style.
Then set another character style for the 2nd line and apply that through the nested style.
Setup your variables to be
Running Head Line 1 - based on character style line 1
Running Head Line 2 - based on character style line 2
The document I did this on was very complex, the running headers had 4 different running headers on each page (8 different running heads per spread) that changed constantly. Working this way I was able to do it.
Alternatively there's a plugin that does this even better
Many ways to skin a cat, but I don't see a major problem here:
If your chapter title breaks over 2 lines, include the space-hyphen-space at the end of the first line, and colour it with the None swatch so it's invisble (if it's messing up your centering, make it very small).
Break the chapter titles with shift-return rather than a proper paragraph break so it's all a single paragraph.
That's it: The text variable will pick up the contents of the chapter title, but not the formatting, so in the text variable the hyphen will be visible.
OK. Thanks to your initial steer, I have a neat answer.
By creating a separate style for Chapter sub-head and a separate variable to pick up that text plus using the option in the text variable definition to include leading text., all work transparently. If there is no sub-heading then the initial text doesn't appear in the running head, which is exactly what I wanted to achieve.
Thanks very much for your help.
To manage this game [without Power Headers I truly recommand], you can:
1/ insert 2 nested line styles associated to the 2 char styles;
2/ use grep researches to convert these 2 NLS in current char styles;
3/ insert a space at the end of the para if only one line.
So, it can be done in 1 click using Multi-Find/Change!
User marked their own answer as correct - however it's the same process as I outlined earlier... hmmm
User did not mark answer as correct. Forum did that automatically. Hmmmmmmmmmmmmmmmm.
Or some staff wonk....
As the OP you can fix it if you like, or if you ask me to fix It as a moderator I have that power.
Now they're all marked as correct. I give up. Please sort it.