Formatting paragraphs with conditions

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
Vibeke B
Propeller Head
Posts: 75
Joined: Thu Mar 15, 2018 7:14 am
Location: Denmark

Formatting paragraphs with conditions

Post by Vibeke B »

Hi!

I am looking into have three or four different versions of a user manual based on conditions. I will create targets for each version, but 98 percent of the manuals are identical. For review purposes, it would be clever to create one pdf with all the conditions, where the paragraphs with conditions are marked, e.g. with a background color, so we can just review one pdf in stead of having to review three or four. Any suggestion how to achieve this? My ideas are limited to creating a p class for each condition but that requires that I change this before release. I suppose I really want a condition on a condition; is that a thing?

Looking forward to your ideas!

Regards,
Vibeke
ChoccieMuffin
Senior Propellus Maximus
Posts: 2632
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Formatting paragraphs with conditions

Post by ChoccieMuffin »

Thinking off the top of my head, you can do this.

1. Create a "REVIEW" medium in your stylesheet.
2. Create a "REVIEW" target.
2. Create styles in your stylesheet to apply the conditions and, in the REVIEW medium only, apply background colours as you want.
3. Apply those styles, not just the conditions, in your topics. (This is likely to be what takes the most time, though you may be able to do a search and replace in the text editor if you're happy working like that.)
4. In your REVIEW target, don't exclude any of the conditions, and generate your target.

Think that should work.
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Vibeke B
Propeller Head
Posts: 75
Joined: Thu Mar 15, 2018 7:14 am
Location: Denmark

Re: Formatting paragraphs with conditions

Post by Vibeke B »

Thanks for your input. I was thinking along those lines except the part about the REVIEW medium. I don't fully understand what a 'medium' is in the style sheet though of course I am aware of the non-print and print mediums and know how to select them for the output.

So I created the Review medium and selected it for this review target, but when playing with this, I cannot see the styles I created in the Review medium in the Style drop-down. I can only see them if I add them to the regular part of my style sheet. What did I do wrong?

If I have a <p> class styled with a background for review, don't I have to change all those styles in each topic before I create the output without the background anyway?
ChoccieMuffin
Senior Propellus Maximus
Posts: 2632
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Formatting paragraphs with conditions

Post by ChoccieMuffin »

Assuming you have a condition tag set defined that includes Prod_A, Prod_B, Prod_C etc, create the styles to apply the conditions in your DEFAULT medium, and only in the REVIEW medium add the background colours.

So this is what you need to add to your DEFAULT medium (assuming you've created a condition tag set "Products" that Prod_A and Prod_B are in):

.Product_A
{
mc-conditions: Prod_A;
}

.Product_B
{
mc-conditions: Prod_B;
}

This means that you can apply the generic styles .Product_A or .Product_B to anything in your topics, such as headings, paragraphs, lists or spans, and this applies the condition.

If your primary target doesn't use the DEFAULT medium but instead uses a different medium, add the new bits to any other mediums in your stylesheet. (You don't need to include anything inside the style because it'll automatically inherit what's in the default, but it means you can apply that generic style whatever stylesheet is being used to display your content in the XML editor.)

.Product_A
{
}

.Product_B
{
}

In your REVIEW medium, add this (pick your own colours - these would be horrible!):

@media REVIEW
{

.Product_A
{
background-color: #FFE353;
}

.Product_B
{
background-color: #0288D1;
}

}

Now to what you need to do in your topics. If you look in the text editor you've probably got something like this:

<h2 MadCap:conditions="Products.Prod_A">This is Prod A's heading</h2>
<h2 MadCap:conditions="Products.Prod_B">This is the heading for Prod B<h2>
<p MadCap:conditions="Products.Prod_A">text to do with Prod A only</p>
<p>Text to do with everything.</p>

You WILL have to go through your topics to change where you've just applied the conditions to removing the conditions and applying the style, so you'll end up with something like this:

<h2 class="Prod_A>This is Prod A's heading</h2>
<h2 class="Prod_B">This is the heading for Prod B<h2>
<p class="Prod_A">text to do with Prod A only</p>
<p>Text to do with everything.</p>

When you generate your Product A target, exclude the condition Products.Prod_B. You will see lines 1, 3 and 4, without a background colour.
When you generate your Product B target, exclude the condition Products.Prod_A. You will see lines 2 and 4, without a background colour.
When you generate your REVIEW target, don't exclude any of the product conditions. You will see lines 1, 2, 3 and 4, with Prod A and Prod B lines having their own background colour.

So you were almost there - take the last couple of steps and you'll get to the finish. Good luck, and let us know how you get on.
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Vibeke B
Propeller Head
Posts: 75
Joined: Thu Mar 15, 2018 7:14 am
Location: Denmark

Re: Formatting paragraphs with conditions

Post by Vibeke B »

Thank you so much! I will experiment with your suggestions and see if I can get it to work :)

Edit: OMG, it works! This is awesome, thank you so much :D
Post Reply