Page 1 of 1

Conditional Formatting?

PostPosted: Mon Feb 27, 2017 9:57 am
by TBallad
Hi All -

I have a group of topics that appear in two different outputs. The problem I'm running into is that in Output 1 these topics are a full chapter, so they need to be formatted thusly, with page one using the Chapter First page layout, etc. In Output 2, they are simply a subsection of an existing chapter, so the first page of the topic group needs to use the "Right/Left" layout.

Any ideas on how I can get this to work without duplicating content?


Re: Conditional Formatting?

PostPosted: Mon Feb 27, 2017 10:53 am
by devjoe
In a Flare project, what decides if a topic starts a new chapter are settings on its TOC entry.

So make two copies of the TOC entry, one conditioned for the first project and one conditioned for the second. (The topic itself does not need any special conditioning and appears in both outputs.)
Then you can set the TOC entry for one output to start a new chapter and the other one to behave normally.

If there are subtopics under this topic in the TOC, they will inherit the condition of the parent node, and you'll have to deal with that. Either copy all of those, or if having two copies which can get out of sync is a problem, make a separate TOC for the contents and include it under both copies of the first TOC entry.

Re: Conditional Formatting?

PostPosted: Wed Mar 01, 2017 8:21 am
by TBallad
Sorry, I should have included this in my original post. The problem is that the chapter heading page layout has a dark blue background, so I've created a <p> style that changes the font color to white. On a normal page, the font color should be black. So changing the page layout in the TOC is no big deal, but the font colors are a problem:

Target A:
Topic as standalone chapter, text uses the p.chapterFirst style.

Target B:
Topic as part of a larger chapter, text should use the p style (not p.chapterFirst).

Does that make more sense?

Re: Conditional Formatting?

PostPosted: Wed Mar 01, 2017 12:43 pm
by devjoe
So what you really want is conditional styles.

One way to do this is to have two different style sheets. In this case, you'd make a variant of p.chapterFirst which have the white font in one stylesheet and black in the other and is applied to the paragraphs in this topic. You can set the target-specific stylesheets in the target.

Another way is to make two different versions of the topic. Then you put conditionally tagged references to both in your TOC like in my first solution. The lazy way to do this just has the p.chapterFirst style applied in one and not in the other.

To keep these from getting out of sync, put all the body content into a snippet. Then each topic just has the snippetblock (and maybe the initial heading if those are different styles) in the body. Along with this, you define a style body.chapterFirst in one snippet, and use complex selectors like "body.chapterFirst p" (and possibly for other styles besides p) to set the text color. You might also find this an easier way to apply this chapterFirst formatting, rather than styling every paragraph in a topic. [I am hoping here that the first topic is never longer than a page and the second topic is configured to start on a new page, rather than just setting p.chapterFirst up to the last paragraph that fits on the first page! But if not, this should still give you ideas how to deal with things.]

Re: Conditional Formatting?

PostPosted: Mon Mar 06, 2017 9:48 am
by TBallad
Thanks - that did the trick! I ended up putting the body (only two paragraphs) into a snippet, then added it twice to a single topic - once for each target with conditional styles applied (see below). It violates DRY, but it's the most elegant solution available.


<condition: QSG>
<p class = "chapterFirst"><snippet></P>

<condition: UG>