mc-conditions: am I understanding their purpose correctly?
mc-conditions: am I understanding their purpose correctly?
An article I was reading this morning mentioned mc-conditions. The feature sounded useful, just going by its name alone, so I Googled a bit and read the Flare help.
I think I understand what mc-conditions is for, but I'm not completely sure. Just as a sanity check, can somebody confirm if I've got the feature's purpose correct? Or have I got the wrong end of the stick completely?
If I understand correctly, setting mc-conditions for a class style in my stylesheet simply means that any text (or other content) in my topics that I apply that style to also gets that conditional content tag applied to it. That content will then get included/excluded as per the condition rules I've set up in my targets.
What it DOESN'T do is provide me any way to make the actual style parameters (fonts, text size or whatever) vary depending on a condition tag.
In other words:
STYLE CLASS applies CONDITION to some CONTENT allowing inclusion/exclusion in TARGET --- YES, IT DOES THIS
CONDITION turns on/off alternative definition of STYLE PROPERTIES in the STYLESHEET causing the text to look different --- NOPE, CAN'T DO THIS
I think I understand what mc-conditions is for, but I'm not completely sure. Just as a sanity check, can somebody confirm if I've got the feature's purpose correct? Or have I got the wrong end of the stick completely?
If I understand correctly, setting mc-conditions for a class style in my stylesheet simply means that any text (or other content) in my topics that I apply that style to also gets that conditional content tag applied to it. That content will then get included/excluded as per the condition rules I've set up in my targets.
What it DOESN'T do is provide me any way to make the actual style parameters (fonts, text size or whatever) vary depending on a condition tag.
In other words:
STYLE CLASS applies CONDITION to some CONTENT allowing inclusion/exclusion in TARGET --- YES, IT DOES THIS
CONDITION turns on/off alternative definition of STYLE PROPERTIES in the STYLESHEET causing the text to look different --- NOPE, CAN'T DO THIS
Re: mc-conditions: am I understanding their purpose correctl
P.S. if I really want to do the latter (alter style parameters such as text size or colour if a specific condition has been applied at the file level) then am I right in thinking it's the use of data-mc-conditions inside square brackets [ ] that I need to be exploring instead?
-
- Senior Propellus Maximus
- Posts: 2632
- Joined: Wed Apr 14, 2010 8:01 am
- Location: Surrey, UK
Re: mc-conditions: am I understanding their purpose correctl
Yes, you've got the gist of it.
I suggest that you look at using MEDIUMs, as that might allow you to get where you want to go.
I think it depends on how you're anticipating using your conditions, I don't quite understand what you're trying to achieve.
I suggest that you look at using MEDIUMs, as that might allow you to get where you want to go.
I think it depends on how you're anticipating using your conditions, I don't quite understand what you're trying to achieve.
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
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Re: mc-conditions: am I understanding their purpose correctl
Great. Thanks for confirming.ChoccieMuffin wrote:Yes, you've got the gist of it.
I'm working inside the @media print medium. I only want to change 2 or 3 styles. Any new medium would need to inherit everything else from the print medium. In effect, the new medium would have to be a child of the print medium. Is such a thing allowed in CSS, and in particular in Flare's implementation of CSS? I'm still on the learning curve when it comes to CSS so I really have no idea.ChoccieMuffin wrote:I suggest that you look at using MEDIUMs, as that might allow you to get where you want to go.
I want to change the formatting applied by 2 or 3 styles part way through my PDF. I don't want to create new style classes and apply them in the topics because that would hamper reuse of the topics.ChoccieMuffin wrote:I think it depends on how you're anticipating using your conditions, I don't quite understand what you're trying to achieve.
Thanks again,
Bruce
Re: mc-conditions: am I understanding their purpose correctl
That's actually quite tricky. If you're using the exact same topic in multiple places, then it's going to be exactly the same in each place. I can't think of a way to make each instance of the topic appear 'different', whether that's using conditions or anything else.bwofficer wrote:I want to change the formatting applied by 2 or 3 styles part way through my PDF. I don't want to create new style classes and apply them in the topics because that would hamper reuse of the topics.
But what you could do is use snippets. Create a snippet that contains the topic content, and use conditions to mark any differences in the styles or content.
Create multiple topics and insert the snippet in each.
Then use the topic properties snippet conditions to set the conditions used for that version of the topic.
-
- Senior Propellus Maximus
- Posts: 3669
- Joined: Thu Feb 02, 2006 9:57 am
- Location: Pittsford, NY
Re: mc-conditions: am I understanding their purpose correctl
As I understand CSS, each medium (e.g., the print medium) inherits only from the default medium and is independent of other mediums.bwofficer wrote:I'm working inside the @media print medium. I only want to change 2 or 3 styles. Any new medium would need to inherit everything else from the print medium.
In my own practice, I reserve the print medium for styling content that is printed from a browser. I create a PDF medium exclusively for the PDF output. It does not -- bc it cannot -- inherit from the print medium.
I'm not suggesting that you do the same, but I did want to point out that mediums inherit only from the default medium and not from other mediums.
Nita
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
Re: mc-conditions: am I understanding their purpose correctl
A short while after creating this thread, I stumbled upon the MadCap-specific parameter data-mc-conditions, which looks like it might help me do what I want.Dave Lee wrote:That's actually quite tricky. If you're using the exact same topic in multiple places, then it's going to be exactly the same in each place. I can't think of a way to make each instance of the topic appear 'different', whether that's using conditions or anything else.
I could tag the specific instances of the topic which I want to style differently by applying a condition tag on their TOC entries. The stylesheet would apply different formatting rules depending on whether data-mc-conditions detected that tag or not. I haven't tried it out, so I can't be sure if it would work, but I'm going to have a go when I've got the time.
Bruce
Re: mc-conditions: am I understanding their purpose correctl
Thanks, Nita.Nita Beck wrote:In my own practice, I reserve the print medium for styling content that is printed from a browser. I create a PDF medium exclusively for the PDF output. It does not inherit from the print medium.
I didn't even realise that you could create your own mediums until a few posts ago. MadCap's use of the print medium for styling PDFs (and other document-centric targets) in the Flare tutorials misled me into thinking the print medium always had to equate to a PDF/Word target. I hadn't even considered how you might want to style output printed from a browser. That's because I'm so focussed on PDFs. The manuals I'm writing will be published initially as PDFs only. Browsable html output is months if not years off. Nevertheless, having a specific PDF medium in my stylesheet for when I do want to distinguish seems sensible.
Bruce
Re: mc-conditions: am I understanding their purpose correctl
I can save you time there - it won't work.bwofficer wrote:A short while after creating this thread, I stumbled upon the MadCap-specific parameter data-mc-conditions, which looks like it might help me do what I want.
I could tag the specific instances of the topic which I want to style differently by applying a condition tag on their TOC entries. The stylesheet would apply different formatting rules depending on whether data-mc-conditions detected that tag or not. I haven't tried it out, so I can't be sure if it would work, but I'm going to have a go when I've got the time.
Conditions can't be directly used to control whether certain styles or rules in your stylesheet are applied - so you got this bit right:
Also, conditions set on a TOC item are not applied to content inside the topic, as they're only applicable to the TOC item itself. It's the target's condition settings that control the conditional content inside your topics.bwofficer wrote:CONDITION turns on/off alternative definition of STYLE PROPERTIES in the STYLESHEET causing the text to look different --- NOPE, CAN'T DO THIS
I don't think using target mediums will work for you either, as these mediums just let you control the stylesheet at the target level. So you can use them if you need different styles in separate targets/outputs, but you mentioned that you need different styles for an element within the same target/output. So target mediums aren't going to work in that scenario.
Anyway, I replied up there ^ to suggest snippets, which would work based on the info you've provided.
Re: mc-conditions: am I understanding their purpose correctl
Target mediums (the mediums you select in the target settings) are a pretty basic way to include additional CSS to a specific target/output.Nita Beck wrote:As I understand CSS, each medium (e.g., the print medium) inherits only from the default medium and is independent of other mediums.
There's no 'default' medium as such, it just means that it's CSS that isn't inside any medium (@media statement). Anything that's not inside a medium is always applied to your content in all outputs - so it's not being inherited by other mediums as such, the other mediums contain additional CSS that you can use to override any 'default' styles (or add additional styles).
The way Flare's target mediums work is quite basic. During the build process, Flare essentially copies and pastes what's in the medium to the end of your output stylesheet.
So if your source is like this:
Code: Select all
h1 { color: blue; }
@media print { h1 { color: red; } }
Code: Select all
h1 { color: blue; }
@media print { h1 { color: red; } }
h1 { color: red; }
Re: mc-conditions: am I understanding their purpose correctl
Dave Lee wrote:Target mediums (the mediums you select in the target settings) are a pretty basic way to include additional CSS to a specific target/output.
The way Flare's target mediums work is quite basic. During the build process, Flare essentially copies and pastes what's in the medium to the end of your output stylesheet.
So it works because the CSS at the end of the file will take precedence over the earlier CSS.
That's a useful insight. It's very helpful to know what's happening under the hood.
Thanks,
Bruce
Re: mc-conditions: am I understanding their purpose correctl
bwofficer wrote:A short while after creating this thread, I stumbled upon the MadCap-specific parameter data-mc-conditions, which looks like it might help me do what I want.
I could tag the specific instances of the topic which I want to style differently by applying a condition tag on their TOC entries. The stylesheet would apply different formatting rules depending on whether data-mc-conditions detected that tag or not. I haven't tried it out, so I can't be sure if it would work, but I'm going to have a go when I've got the time.
Yes, that saves me from going down a few more rabbit holes.Dave Lee wrote:I can save you time there - it won't work.
Conditions can't be directly used to control whether certain styles or rules in your stylesheet are applied.
Also, conditions set on a TOC item are not applied to content inside the topic, as they're only applicable to the TOC item itself. It's the target's condition settings that control the conditional content inside your topics.
I don't think using target mediums will work for you either, as these mediums just let you control the stylesheet at the target level. So you can use them if you need different styles in separate targets/outputs, but you mentioned that you need different styles for an element within the same target/output. So target mediums aren't going to work in that scenario.
Thanks,
Bruce