Defining a "style-after" style

This forum is for all Flare issues related to styles, stylesheets and XML.
todd.richardson
Sr. Propeller Head
Posts: 187
Joined: Thu Aug 07, 2008 6:43 am
Location: Massachusetts

Defining a "style-after" style

Post by todd.richardson »

I would like to specify a particular style to always be used after another style (for example, a p.body style under a h1 style). How is this done in Flare? I can't seem to find the appropriate property in the stylesheet.

Thanks.
Todd Richardson
Engineering Team Lead – Customer Experience | IntervalZero

Windows 10, Flare 2020
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Defining a "style-after" style

Post by LTinker68 »

There is no such functionality. At least, not that I'm aware of. You can create a complex selector that controls how a <p> tag that immediately follows an <h1> tag appears, but you can't specify that the <h1> tag is always followed by a <p> tag or class thereof.

Of course, when you create a new topic, the heading style you select (h1 by default) in the Add Topic screen is always followed by a simple <p> tag when the topic is created. So if there's no real requirement for you to use p.body instead of p, then I'd stick to the base <p> tag. Is there a particular reason why you need to use p.body?
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Andrew
Propellus Maximus
Posts: 1237
Joined: Fri Feb 10, 2006 5:37 am

Re: Defining a "style-after" style

Post by Andrew »

Yes, a complex selector does exist for style after style. I use it in my tables.

The syntax is <preceding_element> + <proceeding_element>

So if I wanted to create a different style for any p tag that was preceded by an h1 tag, here is the code:

Code: Select all

h1 + p 
{
     margin-top: 0px;
}
This would mean any p tag that comes after an h1 tag has a zero-pixel margin at the top.

See this resource for more information on complex selectors.
Flare v6.1 | Capture 4.0.0
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Defining a "style-after" style

Post by LTinker68 »

That's the complex selector I was talking about, but that doesn't mean that the <h1> tag is automatically followed by a <p>, or in his example <p class="body">. You still have to manually add the paragraph tag after the <h1> tag (although most programs, including Flare, automatically do that) and then apply the "body" class to the paragraph tag.

You could have multiple complex selectors like h1 + p, h1 + div, h1 + p.note, and so on, but so far as I know, there's no way to specify what tag is automatically inserted into the topic following the h1 tag.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Andrew
Propellus Maximus
Posts: 1237
Joined: Fri Feb 10, 2006 5:37 am

Re: Defining a "style-after" style

Post by Andrew »

Ah, I see. I misunderstood the original post. I should have known there was a reason you hadn't mentioned the complex selector. :P Yep, definitely don't know a way to specify a "next tag."

My best stab at a solution would be that, if you know two (or more) tags always go together in order, you could create a snippet of them, and insert that and convert to text instead of changing the style...but honestly, inserting snippets is probably more trouble than changing the style manually.
Flare v6.1 | Capture 4.0.0
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Defining a "style-after" style

Post by doc_guy »

Sorry to but in and threadjack, but can I officially recommend that you don't use a "body" class for <p>?

People who migrate from Frame often want a "body" element, so they throw a "body" class onto the <p> element which is totally unnecessary and creates a huge hassle for yourself and sets up the possibility of confusion and non-parallel paragraphs down the road.

The body tag in Frame is equivalent to the <p> element in Flare is equivalent to the normal style in Word. (Which isn't proper grammar, but it is kind of like a mathematical equation.)

For the default paragraph style, use <p>. If you need special classes of <p>, go ahead and create them. But for all the love of Flare, do yourself a favor and don't use a body class for <p>.

<breath>

Alrighty now. I fell better getting that off my chest... :roll:
Paul Pehrson
My Blog

Image
MikeKatz
Sr. Propeller Head
Posts: 133
Joined: Tue Mar 07, 2006 5:54 pm

Re: Defining a "style-after" style

Post by MikeKatz »

I submitted a request for this awhile ago. The more people that submit, the better chance that it will come!
Mike
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Defining a "style-after" style

Post by doc_guy »

Seems like a tricky implementation. I mean, you'd have to do it in the style sheet, which isn't really equipped for this type of thing, because the style sheet would need to be aware of all the other possible styles that you've created. In the Flare interface, yeah they can do this. but it isn't going to be valid CSS (though lots of Flare-specific stuff isn't valid CSS, so what is one more thing?)....

It' would be cool.

Though, now I think about it, I bet that this could really take shape with the forthcoming DITA support. Essentially, what you are doing is creating a structure that you want to enforce, which is the whole point of structured authoring, which DITA is.

Hmmm... something to think about.
Paul Pehrson
My Blog

Image
todd.richardson
Sr. Propeller Head
Posts: 187
Joined: Thu Aug 07, 2008 6:43 am
Location: Massachusetts

Re: Defining a "style-after" style

Post by todd.richardson »

Thanks, everyone, for your input on this.

Paul -
The p.body style I used in my example was simply that - an example.
Todd Richardson
Engineering Team Lead – Customer Experience | IntervalZero

Windows 10, Flare 2020
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Defining a "style-after" style

Post by doc_guy »

Oh good. I'm glad.

Sorry to rant. I think it was kind of late in the day on Friday.... :)
Paul Pehrson
My Blog

Image
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Defining a "style-after" style

Post by NorthEast »

todd.richardson wrote:I would like to specify a particular style to always be used after another style (for example, a p.body style under a h1 style). How is this done in Flare? I can't seem to find the appropriate property in the stylesheet.
You can define this behaviour for the Flare editor in the stylesheet, using the properties mc-next-tag and mc-next-class, e.g.:

Code: Select all

h1
{
	mc-next-tag: p;
	mc-next-class: body;
}
This means that if you press enter after an h1 heading in the editor, the next line will have a p tag and body class.

These properties don't show up in the stylesheet editor, so you need to open the stylesheet in text view to add them.

One thing I haven't worked out how to do is to reset the class, e.g. if you had a style p.note, I don't know how to use the mc-next-class property to set the next line to just p (with no class).
todd.richardson
Sr. Propeller Head
Posts: 187
Joined: Thu Aug 07, 2008 6:43 am
Location: Massachusetts

Re: Defining a "style-after" style

Post by todd.richardson »

Excellent - thank you.
Todd Richardson
Engineering Team Lead – Customer Experience | IntervalZero

Windows 10, Flare 2020
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Defining a "style-after" style

Post by LTinker68 »

Dave Lee wrote:You can define this behaviour for the Flare editor in the stylesheet, using the properties mc-next-tag and mc-next-class...
Oooh, when did they add that?

To use your example, Dave, couldn't you use the following:

Code: Select all

p.note
{
   mc-next-tag: p;
}
If there's no class specified then it seems like it would default back to the base (parent) tag.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
todd.richardson
Sr. Propeller Head
Posts: 187
Joined: Thu Aug 07, 2008 6:43 am
Location: Massachusetts

Re: Defining a "style-after" style

Post by todd.richardson »

I didn't see these values in the stylesheet, so I added them to the style through the text editor. Works great.
Todd Richardson
Engineering Team Lead – Customer Experience | IntervalZero

Windows 10, Flare 2020
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Defining a "style-after" style

Post by LTinker68 »

I don't have Flare open at the moment, but they most likely appeared under the "Unclassified" group when the view is set to "Show: Property Groups" and you're in Advanced view.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Defining a "style-after" style

Post by doc_guy »

Wow.

Learn something new every day.
Paul Pehrson
My Blog

Image
SteveS
Senior Propellus Maximus
Posts: 2090
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Re: Defining a "style-after" style

Post by SteveS »

Dave Lee wrote: One thing I haven't worked out how to do is to reset the class, e.g. if you had a style p.note, I don't know how to use the mc-next-class property to set the next line to just p (with no class).
Create a class p.after_head and set its mc-next-class property?
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
Andrew
Propellus Maximus
Posts: 1237
Joined: Fri Feb 10, 2006 5:37 am

Re: Defining a "style-after" style

Post by Andrew »

LTinker68 wrote:I don't have Flare open at the moment, but they most likely appeared under the "Unclassified" group when the view is set to "Show: Property Groups" and you're in Advanced view.
They don't appear in Flare 4 (not sure about 4.1...don't have that installed at work yet).
Flare v6.1 | Capture 4.0.0
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Defining a "style-after" style

Post by LTinker68 »

Andrew wrote:
LTinker68 wrote:I don't have Flare open at the moment, but they most likely appeared under the "Unclassified" group when the view is set to "Show: Property Groups" and you're in Advanced view.
They don't appear in Flare 4 (not sure about 4.1...don't have that installed at work yet).
They don't appear in 4.1.40 either. Alright, Dave Lee, spill... Where did you find those properties?
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Defining a "style-after" style

Post by NorthEast »

LTinker68 wrote:They don't appear in 4.1.40 either. Alright, Dave Lee, spill... Where did you find those properties?
Here, here...
http://forums.madcapsoftware.com/viewto ... 64&p=33583

LTinker68 wrote:If there's no class specified then it seems like it would default back to the base (parent) tag.
Nope, it doesn't reset the class if you have the same tag, e.g. if your p.note style just had mc-next-tag: p set and no
mc-next-class, the next line would be a p.note too. Setting the mc-next-class to something like none (or anything else I tried) just gave me a style p.none.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Defining a "style-after" style

Post by LTinker68 »

Dave Lee wrote:
LTinker68 wrote:They don't appear in 4.1.40 either. Alright, Dave Lee, spill... Where did you find those properties?
Here, here...
http://forums.madcapsoftware.com/viewto ... 64&p=33583
Ok, then, Dan G... Same question.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
forfear
Propellus Maximus
Posts: 766
Joined: Sat Feb 16, 2008 3:37 am
Location: Jungle Jingles

Re: Defining a "style-after" style

Post by forfear »

Is it possible that Dave Lee, opened the Flare schemas and scanned it through to discover this super secret super powerful tip? :)

anyway this is coming in very useful to me now. this has got to be, for me, one of those hard to find, super good undocumented super top secret things, that not even the support team knows.
If you submit your bug feedback request here, the more likely it'll get fixed or included in a future release
Open Utilities PageLayout Resizer for Flare/Blaze | Batch builder
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Defining a "style-after" style

Post by NorthEast »

forfear wrote:Is it possible that Dave Lee, opened the Flare schemas and scanned it through to discover this super secret super powerful tip? :)

No, just got a good memory - it was dang that originally posted the tip.
forfear
Propellus Maximus
Posts: 766
Joined: Sat Feb 16, 2008 3:37 am
Location: Jungle Jingles

Re: Defining a "style-after" style

Post by forfear »

I really must find some way to make this topic sticky or a favourites...3rd time on i had to search the forums for this one tip. :)
If you submit your bug feedback request here, the more likely it'll get fixed or included in a future release
Open Utilities PageLayout Resizer for Flare/Blaze | Batch builder
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Defining a "style-after" style

Post by NorthEast »

forfear wrote:I really must find some way to make this topic sticky or a favourites...3rd time on i had to search the forums for this one tip. :)
There's a 'Bookmark topic' link at the bottom of the page - it's easy to miss!
Post Reply