Can snippets have stylesheets?

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
tbean
Propeller Head
Posts: 48
Joined: Wed Jan 16, 2008 1:59 pm
Location: SE Pennsylvania

Can snippets have stylesheets?

Post by tbean »

I am trying to apply a custom span.class ("span.FieldName", nothing fancy, just some bolding) to a word that is in a snippet. When I select the word and then open my Styles list, I do see styles, just not the ones in my project-specific stylesheet. I'm guessing these are the styles from Flare's default .css. However, I can't figure out how to attach my stylesheet to the snippet so that the snippet has access to my span.class.

I'm not trying to do much formatting, as I want the snippet to adopt the styles of the topics it ends up in, but this is something that would be consistent throughout the entire project.

I notice that in the Properties dialog for snippets, there is no "Stylesheet" option. Does this mean that snippets cannot be associated with stylesheets?
Tracey
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Can snippets have stylesheets?

Post by LTinker68 »

When you create a snippet file (Project > Add Snippet), there is an option to specify a stylesheet at that time. If you select "(default)" instead of the named stylesheet (e.g., "Styles"), then it creates the snippet file without a stylesheet reference. (Which, to me, is inconsistent. Everywhere else in Flare, if you specify default then it uses the only available stylesheet. So that's kind of a bug.)

If you didn't specify a stylesheet at the time you created the snippet, then you can still apply it, just not through the Properties screen. Open the snippet file, then left-click on the html block in the show blocks area of the XML Editor. Select Stylesheet Links from the menu that appears. When you click on that, you get a screen where you can select the stylesheet you want to use (click the << arrows to add the stylesheet reference to the snippet file).
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
KevinDAmery
Propellus Maximus
Posts: 1985
Joined: Tue Jan 23, 2007 8:18 am
Location: Darn, I knew I was around here somewhere...

Re: Can snippets have stylesheets?

Post by KevinDAmery »

I think the rationale behind having snippets default to not having a stylesheet is that normally, when it comes time to create your output the snippet will be part of a larger topic, and the topic will have a stylesheet reference. If the snippets all had their own stylesheet reference, it would be possible for different parts of the built html page to be pointing to different stylesheets. While it is perfectly legal for sections of a page to use a different styles, it does introduce the risk of inconsistent appearance in the final result--Madcap was likely attempting to minimize that risk, making it so that you had to explicitly tell each snippet to use a different stylesheet if that was what you wanted. If the default behaviour was the other way, a slip of the mouse could result in your built output looking like a ransom note :mrgreen:

Having said that, it does present a problem when you want to reference styles in your snippets that don't appear in bog standard HTML.

FWIW, I don't normally run into this issue because I use the "other" way to make snippets: I compose the content as part of a topic, then select it and use the "make snippet" function.
Until next time....
Image
Kevin Amery
Certified MAD for Flare
tbean
Propeller Head
Posts: 48
Joined: Wed Jan 16, 2008 1:59 pm
Location: SE Pennsylvania

Re: Can snippets have stylesheets?

Post by tbean »

Ahhh.... yes, of course. Don't know why I didn't think of *that* method immediately. :wink: I wonder why the process to associate a stylesheet is so different for a snippet than it is for a topic?

Thanks for your help (again).
Tracey
gfevrier
Propeller Head
Posts: 45
Joined: Thu Jul 30, 2009 12:10 pm
Location: Tampa, Florida
Contact:

Re: Can snippets have stylesheets?

Post by gfevrier »

Lisa,

Thank you for this! It was really helpful. I've been searching for this for hours.
LTinker68 wrote:When you create a snippet file (Project > Add Snippet), there is an option to specify a stylesheet at that time. If you select "(default)" instead of the named stylesheet (e.g., "Styles"), then it creates the snippet file without a stylesheet reference. (Which, to me, is inconsistent. Everywhere else in Flare, if you specify default then it uses the only available stylesheet. So that's kind of a bug.)

If you didn't specify a stylesheet at the time you created the snippet, then you can still apply it, just not through the Properties screen. Open the snippet file, then left-click on the html block in the show blocks area of the XML Editor. Select Stylesheet Links from the menu that appears. When you click on that, you get a screen where you can select the stylesheet you want to use (click the << arrows to add the stylesheet reference to the snippet file).
Gina G. Wadley, M.Ed.
Staff Information Developer
http://www.ifcatscouldwrite.com

"The most valuable of all talents is that of never using two words when one will do." -- Thomas Jefferson
Post Reply