Style applied to block snippet works in PDF, not HTML

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
Sarianna
Propeller Head
Posts: 33
Joined: Thu Aug 08, 2013 5:29 am

Style applied to block snippet works in PDF, not HTML

Post by Sarianna »

Apologies if this issue has already been covered somewhere; I could not find a thread on this particular problem on the forum in other discussions of snippet use.

Edit: I'm using Flare 9.1.2.

My project has hundreds of parameter descriptions that I have implemented as snippets for easier change control, because the same descriptions may be used in several places over a number of documents. Some of these snippet descriptions are several paragraphs long and contain other snippets.

In both PDF and HTML output, I would like lists of parameters to be displayed like this:

parameter_name (style p.ListHead)
Parameter description goes here... (style p.ListBody, should be clearly indented from ListHead)

As the Flare XML Editor does not allow applying a paragraph style to a block snippet, I have applied the p.ListBody style (default medium) to the snippet blocks manually in the text editor. This looks just like it should in the XML editor in both print and web layout, as well as in PDF output, but the HTML output loses the indentation (i.e., I assume it is not applying the p.ListBody style at all), which makes the end result less clear to read. (The p.ListBody style indents just fine in HTML for regular non-snippety paragraph text.)

Here is the XML code used:

Code: Select all

 <h1>Test topic</h1>
        <p>Testing snippets:</p>
        <p class="ListHead">log section (style p.ListHead)</p>
        <p class="ListBody">This paragraph is formatted in style p.ListBody which should be clearly indented compared to p.ListHead. Multi-paragraph snippet inserted as block and p.ListBody style applied manually. The parameter descriptions  are snippets within the larger snippet.</p>
        <p class="ListBody">
            <MadCap:snippetBlock src="../Resources/Snippets/Configuration parameters/Test snippet_log.flsnp" />
        </p>
        <p class="ListHead">log section</p>
        <p class="ListBody">Same snippet inserted as text instead of block does not work at all: <MadCap:snippetText src="../Resources/Snippets/Configuration parameters/Test snippet_log.flsnp" /></p>
Here is the PDF output, which looks like I want it to look:
Test PDF output_small.jpg
And here is the HTML output with all indentation lost in the block snippet sections of the text:
Test HTML output_small.jpg
As can be seen here, inserting the snippet as text does not work at all for multi-paragraph snippets. The paragraph division is lost, as are the snippets embedded within (the log_path etc. descriptions).

So my question is really this: Is there any way I can make a manually applied paragraph style stick to a block snippet in HTML output? And if not, any hints on other ways I could present a similar list of parameters in a clear, reader-friendly, easily updatable way? I would like to avoid tables if I can, because the parameter descriptions can get quite long and unwieldy for a table cell.

Thanks in advance,
Sarianna
You do not have the required permissions to view the files attached to this post.
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Re: Style applied to block snippet works in PDF, not HTML

Post by kwag_myers »

You might have the style set for Medium:Print. Open your CSS in NotePad (from the context menu) and see if the style is listed under @media print (which is usually near the bottom). If so, copy and paste the style above the @media print section and see if that fixes the HTML.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
Sarianna
Propeller Head
Posts: 33
Joined: Thu Aug 08, 2013 5:29 am

Re: Style applied to block snippet works in PDF, not HTML

Post by Sarianna »

In Notepad my p.ListBody style listed is under @media non-print. In the Flare stylesheet editor, it is under "Medium: (default)", which, if I have understood correctly, is valid for all media types. And it seems to work perfectly well for both PDF and HTML output for ordinary paragraph text, it is just the HTML output of block snippets that does not seem to be taking the style.

Actually, I tried to apply another completely unrelated paragraph style to a block snippet with the same result: it works in the PDF output but not the HTML. So it seems that the problem is not in the style itself but in the way Flare creates HTML output from a snippet with a manually added paragraph style (or possibly there's something wrong with my HTML target settings?).

This makes me wonder: Has anyone successfully (manually) applied paragraph styles to block snippets and obtained good-looking HTML output? Should I start thinking of another way to organize my information? I do like the idea of having parameter descriptions in block snippets for easy single-sourcing, but if the output format of block snippets is restricted to plain unindented paragraphs, I will have to figure out how to make my documents readable using this format.

Sarianna
Sarianna
Propeller Head
Posts: 33
Joined: Thu Aug 08, 2013 5:29 am

Re: Style applied to block snippet works in PDF, not HTML

Post by Sarianna »

Ok, I whiled away my Friday afternoon looking for a workaround. One thing that seems to work is putting the block snippets inside an indented div style (instead of an indented paragraph style). This is what I got in HTML for the above example with indented divs:
Test HTML with div.jpg
The code for this bit is:

Code: Select all

        <p class="ListHead">log</p>
        <div class="IndentSnippetBlock">
            <MadCap:snippetBlock src="../Resources/Snippets/Configuration parameters/Test snippet_log.flsnp" />
        </div>
where Test snippet_log.flsnp has embedded snippets thus:

Code: Select all

   <p>The <b>log</b> section defines  message logging.</p>
        <p>The <b>log</b> section contains the following parameters:</p>
        <p class="ListHead">log_path</p>
        <div class="IndentSnippetBlock">
            <MadCap:snippetBlock src="Test snippet_log_path.flsnp" />
        </div>
        <p class="ListHead">entries_per_file</p>
        <div class="IndentSnippetBlock">
            <MadCap:snippetBlock src="Test snippet entries_per_file.flsnp" />
        </div>
        <p class="ListHead">raw_format</p>
        <div class="IndentSnippetBlock">
            <MadCap:snippetBlock src="raw_format.flsnp" />
        </div>
Before I start manually changing all my snippet paragraph styles to divs, I'd like to ask the collective wisdom in this forum whether you think this is a good idea? Personally I'm not too familiar with working with XML and CSS outside Flare. Can you foresee problems with this kind of embedded div structure?

I don't mind doing a lot of manual formatting in setting up my documents for the first time (I am in the long process of importing old content from Word, updating and tweaking it), but in the long run, I would of course like to be able to maintain the documentation as smoothly as possible.

Sarianna
You do not have the required permissions to view the files attached to this post.
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Re: Style applied to block snippet works in PDF, not HTML

Post by kwag_myers »

Ah, my mistake. I missed the word "snippet" in your title (sorry). I keep telling myself to stay out of the forums until after my third coffee. Let me start over:

The only time I insert a snippet as text is when it's inline with other text, i.e., part of a paragraph. Everything else must go in as a block. I had a lot of trouble with bullet lists until I realized the difference. I have entire pages as snippets and as long as I insert them as blocks, life is good. I tried wrapping them in paragraphs like you did, but it didn't seem to make a difference.

I still think there's something set for print in your CSS. It's the only explanation I can come up with. Sorry I couldn't be more helpful.

Edit:
Sarianna wrote:In the Flare stylesheet editor, it is under "Medium: (default)"
You can't go by the Editor. It could have different settings under all three and you'd never know it. Look for MadCap:snippetBlock in NotePad. You may have it under both Print and Non-Print. If so, copy the Print values to the Non-Print entry.

This is the downside of having a tool with so many options. There are so many possibilities for something to mess you up.
Last edited by kwag_myers on Fri May 30, 2014 4:32 pm, edited 1 time in total.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Style applied to block snippet works in PDF, not HTML

Post by doc_guy »

Look at the code in your HTML output source, and see what styles are actually generated for the browser to use. Then you will be able to manipulate them in the style sheet so that it will build properly in the HTML5 output.
Paul Pehrson
My Blog

Image
Sarianna
Propeller Head
Posts: 33
Joined: Thu Aug 08, 2013 5:29 am

Re: Style applied to block snippet works in PDF, not HTML

Post by Sarianna »

Thanks for your comments! Strangely, when searching in Notepad, my stylesheet does not have snippetBlock defined at all, although using snippet blocks seems to work all right, except for this particular issue. My stylesheet is based on Flare's default stylesheet in the WebPrintMobile template, which does appear to include snippetBlock, so it must have dropped out of my stylesheet at some point during the editing. Perhaps I'll try to experiment with snippet output using Flare's unedited template and see what happens there.

As for the code in the HTML output, it appears to use the same style names as those defined in the Flare stylesheet, and the other styles do build properly, or at least they look ok in the output. Should the styles be generated as something different then, with different names or properties? I'm afraid my skills in HTML/CSS are still very limited, which is why I'm relying heavily on Flare to work its magic behind the scenes...

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

Re: Style applied to block snippet works in PDF, not HTML

Post by NorthEast »

I'm guessing that the problem is because your snippet contains a paragraph, and you're inserting this as a block snippet inside another paragraph; so that will create a paragraph inside a paragraph.
That would explain why you get some odd results; and more predictable results when using the snippet inside a div.

I'd suggest not putting the snippet inside anything (a paragraph or a div); and instead apply your indent style(s) inside the snippet itself.
Sarianna
Propeller Head
Posts: 33
Joined: Thu Aug 08, 2013 5:29 am

Re: Style applied to block snippet works in PDF, not HTML

Post by Sarianna »

Thanks Dave Lee! The problem is that in my documents, the snippet text (parameter description) needs to be indented in some contexts but not in others, so I would prefer to have the indentation separate from the snippet itself, if possible. So I guess divs are the way to go, unless I can figure out a practical way to reorganize the information.

In general, I would still be interested in hearing people's experiences with using snippet blocks inside divs: have you used this approach and does it work for you?

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

Re: Style applied to block snippet works in PDF, not HTML

Post by NorthEast »

Sarianna wrote:Thanks Dave Lee! The problem is that in my documents, the snippet text (parameter description) needs to be indented in some contexts but not in others, so I would prefer to have the indentation separate from the snippet itself, if possible. So I guess divs are the way to go, unless I can figure out a practical way to reorganize the information.

In general, I would still be interested in hearing people's experiences with using snippet blocks inside divs: have you used this approach and does it work for you?

Sarianna
The snippet could include the indent paragraph style - whether that style is used depends on how you insert the snippet.

If you insert a snippet as a text snippet, it will not use the paragraph style in the snippet; if you insert it as a block snippet, it will use the style in the snippet.
Post Reply